{"$schema":"https://wellknown.network/schemas/agent-record-v1.json","schemaVersion":"1","id":"ag_f5kapazhqj6p","handle":"tokenspace-mcp","url":"https://wellknown.network/agents/tokenspace-mcp","links":{"self":"https://wellknown.network/agents/tokenspace-mcp/record.json","html":"https://wellknown.network/agents/tokenspace-mcp","markdown":"https://wellknown.network/agents/tokenspace-mcp/record.md","api":"https://wellknown.network/api/v1/agents/tokenspace-mcp","status":"https://wellknown.network/api/v1/agents/tokenspace-mcp/status","claim":"https://wellknown.network/agents/tokenspace-mcp/claim","claimApi":"https://wellknown.network/api/v1/claims","claimDescriptor":"https://wellknown.network/agents/tokenspace-mcp/claim.json","badge":"https://wellknown.network/agents/tokenspace-mcp/badge.svg","openapi":"https://wellknown.network/openapi.json","history":"https://wellknown.network/api/v1/agents/tokenspace-mcp/history","tools":"https://wellknown.network/api/v1/agents/tokenspace-mcp/tools"},"ard":{"identifier":"urn:air::server:tokenspace-mcp","type":"application/mcp-server-card+json"},"kind":"mcp_server","declared":{"name":"tokenspace-mcp","summary":"Surgical AST-based Python editing for AI agents — edit by symbol name, not text position. Built-in blast radius and token cost on every edit.","description":"# tokenspace-mcp\n\nSurgical AST-based Python editing for AI agents — edit by symbol name, not text position. Built-in blast radius and token cost on every edit.\n\n```bash\npip install tokenspace-mcp\n```\n\n## Why\n\nAI coding agents (Claude Code, Cursor, Aider) edit Python via string replacement or line numbers. This forces the agent to echo the old code to locate the edit, then echo the entire new file as output. On large files that wastes thousands of tokens per edit.\n\nTokenspace exposes four MCP tools that operate on symbol names:\n\n```\nedit_function_body(\"auth.py\", \"validate_token\", new_body)\n```\n\nNo echoing. No stale line numbers. Every edit returns a diff, a blast radius score, and a token cost — automatically.\n\n## Benchmark\n\nMeasured on **406 real functions** across 10 popular OSS projects (requests, flask, fastapi, django, httpx, pydantic, black, click, rich). All files verified with libcst round-trip.\n\n| Scenario | str\\_replace | Tokenspace | Reduction |\n|---|---|---|---|\n| Single edit — 406 functions total | 36,907 tokens | 18,674 tokens | **49.4%** |\n| 5 edits / same file — 10 files total | 70,948 tokens | 2,039 tokens | **95.4%** |\n\nThe multi-edit gap is large because `str_replace` pays the full file on every call. Tokenspace pays for `read_structure` once and only the function name + new body per subsequent edit.\n\n## MCP Tools\n\n| Tool | What it does |\n|---|---|\n| `read_structure` | File skeleton — signatures and line ranges, no bodies. ~3.4× cheaper than reading the file. |\n| `edit_function_body` | Replace a top-level function body by name. Writes to disk. Returns diff + metrics. |\n| `edit_class_method` | Replace a class method body by name. Writes to disk. Returns diff + metrics. |\n| `measure_edit` | Dry-run: compute blast radius and token cost without writing. |\n\n### Metrics returned on every edit\n\n- **blast_radius** — fraction of the file's symbols whose signature changed (0.0 = nothing changed structurally)\n- **patch_locality** — how contained the edit is …","publisher":null,"homepage":"https://github.com/VanshMomaya7/tokenspace-mcp","repository":"https://github.com/VanshMomaya7/tokenspace-mcp","version":"0.1.4","license":"MIT","protocols":["mcp"],"tags":["ai-agents","ast","claude","code-editing","libcst","mcp","python"],"pricing":null,"endpoints":[{"url":"pypi:tokenspace-mcp","type":"package_pypi","auth":null,"probeable":false}],"skills":null,"tools":null,"extra":null,"attribution":{"kind":"pypi","name":"pypi","license":"pypi","repoUrl":"pypi","summary":"pypi","version":"pypi","description":"pypi","homepageUrl":"pypi"}},"derived":{"capabilities":[{"slug":"content.writing","name":"Writing & Editing","confidence":1,"provenance":"derived"}],"categories":["content"],"language":"en"},"observed":{"status":"unknown","statusReason":"Distributed as a package to run locally; no network endpoint to check.","lastOkAt":null,"lastProbedAt":null,"statusComputedAt":null,"reliability30d":null,"latestObservations":[],"tools":null,"package":{"name":"tokenspace-mcp","registry":"pypi","observedAt":"2026-11-04T02:26:31.030Z","publishedAt":"2026-05-15T17:21:28.958848Z","latestVersion":"0.1.4"},"toolSurface":null,"endpointFacts":[]},"verification":{"claimed":false,"claimedAt":null,"proofs":[]},"provenance":{"sources":[{"source":"pypi","key":"tokenspace-mcp","url":"https://pypi.org/project/tokenspace-mcp/","firstSeenAt":"2026-09-10T14:22:48.907Z","fetchedAt":"2026-11-04T02:25:45.323Z","normalizedAt":"2026-11-04T02:25:45.323Z"}]},"firstSeenAt":"2026-09-10T14:22:48.907Z","updatedAt":"2026-11-04T02:26:31.030Z"}