Source_map_parser
About
Sourcemapparser is a WebAssembly-based Source Map parser that maps JavaScript error stack traces back to source code and extracts relevant context information. It is designed for developers debugging minified or compiled JavaScript code.
Details
- Author
- MasonChow
- GitHub stars
- 2
- Downloads
- 267
- Categories
- Media
Jump to
- Parses stack traces to original source code locations.
- Supports batch processing of multiple stack traces.
- Extracts surrounding context code lines.
- Looks up original source context for compiled positions.
- Unpacks all source files from a source map.
Setting up with Highlight
This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:
- Download and install Highlight from highlightai.com/download
- Navigate to the plugins tab and select "Add Custom Plugin"
-
Configure the plugin with the settings below
Plugin Name
Source_map_parserCommand (node, npx, python, etc.)Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.
- Enable "Start Automatically" if you want the plugin to start when Highlight launches
From the repository
Run it directly via NPX: npx -y source-map-parser-mcp@latest (requires Node.js 20+). Alternatively, install as an npm package and embed the tools into your own MCP server. Configure runtime parameters through environment variables SOURCE_MAP_PARSER_RESOURCE_CACHE_MAX_SIZE and SOURCE_MAP_PARSER_CONTEXT_OFFSET_LINE.
parse_stack
# Parse Error Stack Trace This tool allows you to parse error stack traces by providing the following: - A downloadable source map URL. - The line and column numbers from the stack trace. The tool will map the provided stack trace information to the corresponding source code location using the source map. It also supports fetching additional context lines around the error location for better debugging. ## Parameters: - **stacks**: An array of stack trace objects, each containing: - **line**: The line number in the stack trace. - **column**: The column number in the stack trace. - **sourceMapUrl**: The URL of the source map file corresponding to the stack trace. - **ctxOffset** (optional): The number of additional context lines to include before and after the error location in the source code. Defaults to 5. ## Returns: - A JSON object containing the parsed stack trace information, including the mapped source code location and context lines. - If parsing fails, an error message will be returned for the corresponding stack trace.
lookup_context
# Lookup Source Code Context This tool looks up original source code context for a specific line and column position in compiled/minified code. ## Parameters: - **line**: The line number in the compiled code (1-based) - **column**: The column number in the compiled code - **sourceMapUrl**: The URL of the source map file - **contextLines** (optional): Number of context lines to include before and after the target line (default: 5) ## Returns: - A JSON object containing the source code context snippet with file path, target line info, and surrounding context lines - Returns null if the position cannot be mapped
unpack_sources
# Unpack Source Map Sources This tool extracts all source files and their content from a source map. ## Parameters: - **sourceMapUrl**: The URL of the source map file to unpack ## Returns: - A JSON object containing: - **sources**: Object with source file paths as keys and their content as values - **sourceRoot**: The source root path from the source map - **file**: The original file name - **totalSources**: Total number of source files found
Claude Desktop / Cursor
Paste into your MCP client config file to install this server.
{
"mcpServers": {
"source_map_parser": {
"source_map_parser": {
"command": "npx",
"args": [
"-y",
"source-map-parser-mcp"
]
}
}
}
}
McpServers
{
"source_map_parser": {
"command": "npx",
"args": [
"-y",
"source-map-parser-mcp"
]
}
}
Source Map Parser

<a href="https://glama.ai/mcp/servers/@MasonChow/source-map-parser-mcp">
</a>
This project implements a WebAssembly-based Source Map parser that can map JavaScript error stack traces back to source code and extract relevant context information. Developers can easily map JavaScript error stack traces back to source code for quick problem identification and resolution. This documentation aims to help developers better understand and use this tool.
MCP Integration
> Note: Requires Node.js 20+ support
Option 1: Run directly with NPX
npx -y source-map-parser-mcp@latest
Option 2: Download the build artifacts
Download the corresponding version of the build artifacts from the GitHub Release page, then run:
node dist/main.es.js
Use as an npm package (bring your own MCP server)
You can embed the tools into your own MCP server process and customize behavior.
Install:
npm install source-map-parser-mcp
Minimal server (TypeScript):
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
import {
registerTools,
Parser,
type ToolsRegistryOptions,
} from 'source-map-parser-mcp';
const server = new McpServer(
{ name: 'your-org.source-map-parser', version: '0.0.1' },
{ capabilities: { tools: {} } }
);
// Optional: control context lines via env
const options: ToolsRegistryOptions = {
contextOffsetLine:
Number(process.env.SOURCE_MAP_PARSER_CONTEXT_OFFSET_LINE) || 1,
};
registerTools(server, options);
// Start as stdio server
const transport = new StdioServerTransport();
await server.connect(transport);
// If you need programmatic parsing without MCP:
const parser = new Parser({ contextOffsetLine: 1 });
// await parser.parseStack({ line: 10, column: 5, sourceMapUrl: 'https://...' });
// await parser.batchParseStack([{ line, column, sourceMapUrl }]);
Build and Type Declarations
This project ships both ESM and CJS builds and a single bundled TypeScript declaration file.
- Build outputs:
- ESM: dist/index.es.js
- CJS: dist/index.cjs.js
- CLI entry: dist/main.es.js
- Types: dist/index.d.ts (single bundled d.ts)
Quick build locally:
npm install
npm run build
Using types in your project:
import {
Parser,
registerTools,
type ToolsRegistryOptions,
} from 'source-map-parser-mcp';
Runtime Parameter Configuration
> System runtime parameters can be flexibly configured through environment variables to meet the needs of different scenarios
- SOURCE_MAP_PARSER_RESOURCE_CACHE_MAX_SIZE: Sets the maximum memory space occupied by resource cache, default is 200MB. Adjusting this value appropriately can balance performance and memory usage.
- SOURCE_MAP_PARSER_CONTEXT_OFFSET_LINE: Defines the number of context code lines to display around the error location, default is 1 line. Increasing this value provides more context information, facilitating problem diagnosis.
Example:
```bash
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.
