{
  "markdown": "# 🗺️ sourcemap-retrace-mcp\n\n[![npm](https://img.shields.io/npm/v/sourcemap-retrace-mcp)](https://www.npmjs.com/package/sourcemap-retrace-mcp)\n[![CI](https://github.com/vola-trebla/sourcemap-retrace-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/vola-trebla/sourcemap-retrace-mcp/actions)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)\n\n**Your app crashed in production. The stack trace is useless. Your AI agent has no idea where the bug is.**\n\nMCP server that decodes minified production stack traces back to original TypeScript source files, lines, and columns — using source maps. Before your agent spends 20 minutes guessing at obfuscated code.\n\n---\n\n## 🤔 The problem\n\nYour monitoring tool sends you this:\n\n```\nTypeError: Cannot read properties of undefined (reading 'userId')\n    at e.<anonymous> (main.a3f2c1.js:1:47821)\n    at h (vendor.d4e5f6.js:1:12045)\n    at processQueue (main.a3f2c1.js:1:89234)\n```\n\nYou ask your agent to debug it. The agent reads `main.a3f2c1.js`. It's 40,000 characters of minified JavaScript. It has no idea what `e.<anonymous>` at column 47821 means.\n\n`sourcemap-retrace-mcp` maps that back to:\n\n```\n    at validateSession (src/auth/session.ts:142:8)\n    at handleRequest (src/api/middleware.ts:67:3)\n```\n\nNow the agent knows exactly where to look.\n\n---\n\n## 🛠️ Tools\n\n### `retrace_stack`\n\nDecode a minified stack trace back to original TypeScript source locations. Pass the raw stack trace and the directory containing your `.js.map` files.\n\n```\nRetrace Results\n  Frames mapped: 3  |  Unmapped: 1\n\nTypeError: Cannot read properties of undefined (reading 'userId')\n    at validateSession (src/auth/session.ts:142:8)\n    at handleRequest (src/api/middleware.ts:67:3)\n    at processQueue (src/queue/processor.ts:28:12)\n    at Module._compile (node:internal/modules/cjs/loader:1376:14)\n```\n\n### `retrieve_code_context`\n\nShow the original source lines surrounding a mapped error location — with line numbers and a column pointer.\n\n```\nCode Context\n  File: src/auth/session.ts\n  Target: line 142, column 8\n\n  139 │   const session = await getSession(token);\n  140 │   if (!session) throw new AuthError(\"invalid token\");\n  141 │\n> 142 │   return session.userId;\n        │         ^\n  143 │ }\n  144 │\n  145 │ export async function refreshSession(token: string) {\n```\n\n### `audit_sourcemap_match`\n\nValidate that `.map` files in your dist directory are present and point to source files that actually exist on disk. Catches stale or missing maps before deployment.\n\n```\nSourcemap Audit\n  Directory: dist/\n  Files checked: 4\n  OK: 3  |  Missing maps: 0  |  Broken sources: 1\n\n  ✓ main.a3f2c1.js — 47 source(s) mapped\n  ✓ vendor.d4e5f6.js — 312 source(s) mapped\n  ✓ worker.b1c2d3.js — 8 source(s) mapped\n  ⚠ legacy.e7f8a9.js — 2 source(s) not found on disk:\n      ../src/utils/deprecated.ts\n      ../src/utils/compat.ts\n```\n\n---\n\n## ⚡ Setup\n\n```json\n{\n  \"mcpServers\": {\n    \"sourcemap-retrace\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"sourcemap-retrace-mcp\"]\n    }\n  }\n}\n```\n\n---\n\n## 🚀 Usage\n\n> \"I have a production error. Here's the stack trace: [paste]. My dist files are in /path/to/dist. Retrace it, show me the code around the error, and tell me what's wrong.\"\n\nThe agent runs `retrace_stack`, then `retrieve_code_context` on the mapped location, and can finally read the actual TypeScript that crashed.\n\nWorks great alongside:\n\n- [env-secret-exposure-analyzer-mcp](https://www.npmjs.com/package/env-secret-exposure-analyzer-mcp) — scan for secrets before deploying\n- [release-readiness-triage-mcp](https://www.npmjs.com/package/release-readiness-triage-mcp) — CI health check before release\n\n---\n\n## 📦 Links\n\n- **npm:** [npmjs.com/package/sourcemap-retrace-mcp](https://www.npmjs.com/package/sourcemap-retrace-mcp)\n- **GitHub:** [github.com/vola-trebla/sourcemap-retrace-mcp](https://github.com/vola-trebla/sourcemap-retrace-mcp)\n\n## License\n\nMIT\n",
  "bytes": 3934,
  "sha": "e701d6ca5ef540cb1a79a1ab0a3a3bea55f1df837abb4e117f8644be1a5a586a",
  "repo_slug": "vola-trebla/sourcemap-retrace-mcp",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_vola_trebla_sourcemap_retrace__d76bd733/readme"
}