Skip to main content
Glama
README.md
# srcmap-mcp

[![npm version](https://img.shields.io/npm/v/srcmap-mcp.svg)](https://www.npmjs.com/package/srcmap-mcp)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
[![Node.js](https://img.shields.io/badge/node-%3E%3D20-brightgreen.svg)](https://nodejs.org/)
[![CI](https://github.com/BartWaardenburg/srcmap-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/BartWaardenburg/srcmap-mcp/actions/workflows/ci.yml)
[![Coverage](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/BartWaardenburg/4576777b0952d0be52c69aac3efb5c7c/raw/srcmap-mcp-coverage.json)](https://bartwaardenburg.github.io/srcmap-mcp/)
[![MCP](https://img.shields.io/badge/MCP-compatible-8A2BE2.svg)](https://modelcontextprotocol.io)

MCP server for source map debugging. Fetch, inspect, look up, and extract original sources from any production website — directly from your AI assistant.

The server supports MCP specification 2026-07-28. Clients that use the 2025 handshake also work.

## Add To Your Editor

### Claude Code

```bash
claude mcp add srcmap-mcp -- npx srcmap-mcp
```

### Codex CLI

```bash
codex --mcp-config '{"srcmap-mcp":{"command":"npx","args":["srcmap-mcp"]}}'
```

### Gemini CLI

```bash
gemini --mcp-config '{"srcmap-mcp":{"command":"npx","args":["srcmap-mcp"]}}'
```

### VS Code

Add to `.vscode/mcp.json`:

```json
{
  "servers": {
    "srcmap-mcp": {
      "command": "npx",
      "args": ["srcmap-mcp"]
    }
  }
}
```

<details>
<summary>Claude Desktop / Windsurf / Cline / Zed / Docker</summary>

### Claude Desktop / Windsurf / Cline

Add to your MCP config file:

```json
{
  "mcpServers": {
    "srcmap-mcp": {
      "command": "npx",
      "args": ["srcmap-mcp"]
    }
  }
}
```

### Zed

Add to Zed settings:

```json
{
  "context_servers": {
    "srcmap-mcp": {
      "command": {
        "path": "npx",
        "args": ["srcmap-mcp"]
      }
    }
  }
}
```

### Docker

```bash
docker run -i --rm ghcr.io/bartwaardenburg/srcmap-mcp
```

</details>

## Prerequisites

Node.js >= 20 and the `srcmap` CLI:

```bash
cargo install srcmap-cli
```

## Features

**8 tools** across 3 categories for complete source map debugging:

### Inspection (4 tools)

| Tool | Description |
|------|-------------|
| `sourcemap_info` | Show source map metadata and statistics |
| `sourcemap_validate` | Validate a source map file |
| `sourcemap_sources` | List all original source files in a source map |
| `sourcemap_mappings` | List mappings with pagination and source filtering |

### Lookup (2 tools)

| Tool | Description |
|------|-------------|
| `sourcemap_lookup` | Find original position for a generated position, with source context |
| `sourcemap_resolve` | Reverse lookup: find generated position for an original position |

### Fetch (2 tools)

| Tool | Description |
|------|-------------|
| `sourcemap_fetch` | Download a bundle and its source map from a URL |
| `sourcemap_extract_sources` | Extract all embedded original sources to disk |

## Configuration

| Variable | Required | Default | Description |
|----------|----------|---------|-------------|
| `SRCMAP_BINARY` | No | `srcmap` | Path to the srcmap CLI binary |
| `SRCMAP_CACHE_TTL` | No | `300` | Cache TTL in seconds (0 to disable) |
| `SRCMAP_TOOLSETS` | No | all | Comma-separated toolsets to enable |

Toolset names match the Features categories: `SRCMAP_TOOLSETS=lookup,fetch` enables only the lookup and fetch tools.

## Example Usage

### Debug a production error

> Sentry is showing `TypeError: Cannot read property 'items' of undefined` at `main-2f8a.js:1:34291` on https://app.example.com — what's the original source?

The assistant fetches the bundle and source map, looks up the position, and shows you the exact original file and line causing the error — with surrounding context.

### Investigate what's deployed

> What code is actually running on https://app.example.com? Extract the source tree so we can look around.

The assistant pulls the production bundles, extracts all original sources, and gives you the full project structure to explore.

### Trace a bug from a stack trace

> Users are reporting a crash on our checkout page. Here's the minified stack trace — can you trace each frame back to the original source?
>
> ```
> at https://cdn.example.com/checkout-a3f2.js:1:48293
> at https://cdn.example.com/checkout-a3f2.js:1:51007
> at https://cdn.example.com/vendor-9b1e.js:1:12844
> ```

The assistant resolves each frame to the original file, function name, and line number — turning a wall of minified positions into a readable stack trace.

## Development

```bash
pnpm install      # Install dependencies
pnpm dev          # Run in development mode
pnpm build        # Compile TypeScript
pnpm test         # Run tests
pnpm typecheck    # Type check without emitting
```

## License

MIT

TDQS

A4/5.0

Scored across 8 tools

Disambiguation4/5

The tools are mostly clearly distinct: lookup and resolve are explicit forward/reverse operations, while sources and extract_sources separate listing from writing files. The main overlap is between sourcemap_info and sourcemap_validate, which both report structural metadata, though their primary purposes are still distinguishable.

Naming Consistency5/5

All tools consistently use the sourcemap_ prefix with snake_case verb/noun naming. The pattern is predictable throughout the set.

Tool Count5/5

Eight tools are well-scoped for a source-map inspection and debugging server. Each tool covers a distinct part of the workflow without unnecessary bloat.

Completeness5/5

The surface covers the full source-map workflow: fetching, validation, metadata inspection, source listing/extraction, mappings listing, and bidirectional position lookup. No major dead ends are apparent for the stated domain.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues