Skip to content

feat: 支持自定义 mcp 服务使用 source map 工具#25

Merged
MasonChow merged 4 commits intomainfrom
feature/support-custom-mcp-server
Sep 26, 2025
Merged

feat: 支持自定义 mcp 服务使用 source map 工具#25
MasonChow merged 4 commits intomainfrom
feature/support-custom-mcp-server

Conversation

@MasonChow
Copy link
Owner

  • Added section for using the package as an npm module in custom MCP services.
  • Included minimal TypeScript example for integration.
  • Updated Node.js version requirement to 20+.
  • Documented build artifacts and TypeScript declaration files.

build: Improve build script and TypeScript configuration

  • Added error handling and cleanup in build.sh.
  • Configured TypeScript to generate declaration files and bundled them.
  • Created rollup configuration for bundling TypeScript declarations.

refactor: Update package.json for module exports and types

  • Set main, module, and types fields to point to built files.
  • Added exports field for better module resolution.

refactor: Implement tools registration for MCP server

  • Created tools.ts for registering MCP tools.
  • Refactored server.ts to use the new tools registration.
  • Added detailed documentation for the parse_stack tool.

fix: Enhance parser validation and error handling

  • Improved type validation for raw tokens from WebAssembly.
  • Added type guards and refined error messages in the parser.

chore: Remove unused guide.xml file and update tsconfig

  • Deleted guide.xml as it was no longer needed.
  • Updated tsconfig to include types directory for better type resolution.

test: Add TypeScript declaration file for source_map_parser_node

  • Created source_map_parser_node.d.ts for better type support in the project.

style: Update Vite configuration for library entry points

  • Modified Vite config to specify multiple entry points for better modularity.

- Added section for using the package as an npm module in custom MCP services.
- Included minimal TypeScript example for integration.
- Updated Node.js version requirement to 20+.
- Documented build artifacts and TypeScript declaration files.

build: Improve build script and TypeScript configuration

- Added error handling and cleanup in build.sh.
- Configured TypeScript to generate declaration files and bundled them.
- Created rollup configuration for bundling TypeScript declarations.

refactor: Update package.json for module exports and types

- Set main, module, and types fields to point to built files.
- Added exports field for better module resolution.

refactor: Implement tools registration for MCP server

- Created tools.ts for registering MCP tools.
- Refactored server.ts to use the new tools registration.
- Added detailed documentation for the parse_stack tool.

fix: Enhance parser validation and error handling

- Improved type validation for raw tokens from WebAssembly.
- Added type guards and refined error messages in the parser.

chore: Remove unused guide.xml file and update tsconfig

- Deleted guide.xml as it was no longer needed.
- Updated tsconfig to include types directory for better type resolution.

test: Add TypeScript declaration file for source_map_parser_node

- Created source_map_parser_node.d.ts for better type support in the project.

style: Update Vite configuration for library entry points

- Modified Vite config to specify multiple entry points for better modularity.
Copilot AI review requested due to automatic review settings September 26, 2025 17:16
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the source-map-parser-mcp project by enabling it to be used as an npm module in custom MCP services while also improving the overall build system and code quality. The changes include adding library-style exports, documentation updates, build system improvements, and enhanced type safety.

  • Added support for using the package as an npm module with TypeScript types and ES/CJS exports
  • Improved build system with TypeScript declaration bundling and better error handling
  • Refactored MCP tool registration into a separate reusable module

Reviewed Changes

Copilot reviewed 13 out of 15 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
vite.config.mjs Updated to build multiple entry points (index.ts and main.ts)
tsconfig.build.json New TypeScript config for generating declaration files
src/tools.ts New module that extracts and encapsulates MCP tool registration
src/server.ts Refactored to use the new tools module and improved Chinese documentation
src/parser.ts Enhanced type validation and error handling with proper type guards
src/index.ts New library entry point exporting public API
src/cachingFetch.ts Added buffer to ArrayBuffer conversion utility
rollup.config.dts.mjs New Rollup config for bundling TypeScript declarations
package.json Updated package.json with proper module exports and types
build.sh Enhanced build script with error handling and declaration bundling
README files Added documentation for npm module usage and updated Node.js version

MasonChow and others added 3 commits September 27, 2025 01:17
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 33.88430% with 80 lines in your changes missing coverage. Please review.
✅ Project coverage is 51.13%. Comparing base (0898106) to head (9f4457b).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
src/tools.ts 1.85% 53 Missing ⚠️
src/parser.ts 76.47% 12 Missing ⚠️
src/server.ts 0.00% 7 Missing ⚠️
src/cachingFetch.ts 14.28% 6 Missing ⚠️
src/index.ts 0.00% 1 Missing and 1 partial ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #25      +/-   ##
==========================================
+ Coverage   48.15%   51.13%   +2.97%     
==========================================
  Files           5        6       +1     
  Lines         353      397      +44     
  Branches       52       63      +11     
==========================================
+ Hits          170      203      +33     
- Misses        183      193      +10     
- Partials        0        1       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@MasonChow MasonChow merged commit 63dc372 into main Sep 26, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants