Skip to content
Conduit

mcp server

SynapseCode

Ultra-fast Code Graph & AST Pruning MCP Server for LLMs. Reduces context token consumption by 75%-90% in Claude, Cursor & AI Coding Agents.

nosleepman1/SynapseCodecommunitylistedunreviewed

Set up

Runs on your computer. Pick your agent and operating system.

This project does not publish an install method we can turn into a config. Follow the README instead.

README

synced Oct 28, 2026

SynapseCode

High-Performance AST Code Graph & Context Optimization Engine for Large Language Models

SynapseCode reduces context token consumption by 75% to 90% when interacting with LLMs such as Claude 3.5 Sonnet, GPT-4, and autonomous coding agents via the Model Context Protocol (MCP).

Go Version Protocol License CI


1. Problem Statement

When using AI code assistants, injecting full raw source files or dumping repository trees consumes tens to hundreds of thousands of tokens per prompt.

This creates three critical engineering bottlenecks:

  1. Financial Cost: High token consumption multiplies API usage bills.
  2. Latency: Time-to-first-token (TTFT) degrades significantly with large prompt payloads.
  3. Context Degradation: Unnecessary implementation details dilute the attention of the model, increasing hallucination rates (Lost in the Middle phenomenon).

2. Technical Solution

SynapseCode continuously analyzes your codebase into an in-memory directed dependency graph:

  • AST Extraction: Extracts symbol declarations, types, interfaces, and signatures without full function bodies.
  • Multi-Edge Dependency Graph: Maps relations including CALLS, IMPORTS, DEFINES, IMPLEMENTS, and EXTENDS.
  • Personalized PageRank (PPR): Calculates centrality and relevance scores seeded by user task terms.
  • Adaptive Knapsack Token Budgeting: Selects target implementations and direct 1-hop dependency skeletons under a strict token budget (e.g., 3,500 tokens).
  • Zero-Dependency Persistent Cache: Caches parsed file metadata on disk (.synapse/cache.json) for sub-30ms incremental startup.
  • Live File Watcher (fsnotify): Continuously syncs the code graph in the background without restarting the server.
  • Model Context Protocol (MCP): Exposes 6 standardized JSON-RPC 2.0 tools over stdio to Claude Desktop, Cursor, and IDE extensions.

3. Benchmarks

Evaluation performed on a 120,000-token repository refactoring task:

MetricRaw File InjectionSynapseCode (MCP)Improvement
Prompt Size124,000 tokens4,200 tokens-96.6%
API Cost (Claude 3.5 Sonnet)$0.372 / request$0.012 / request31x reduction
Time to First Token (TTFT)9.4 seconds1.3 seconds7.2x faster
Context CoherenceLow (Noise)High (Targeted)Deterministic

4. Supported Languages & Frameworks

  • Go (.go)
  • TypeScript & JavaScript (.ts, .tsx, .js, .jsx, .mjs, .cjs) — Full ES6+, arrow functions, class methods, enums, interfaces.
  • Python (.py) — Async defs, decorators (@dataclass, @property, @classmethod), multiple inheritance.
  • Rust (.rs) — Structs, traits, and impl blocks.
  • Java (.java) — Spring Boot annotations (@RestController, @Service, @Autowired, @GetMapping), Java records, enums, interfaces.
  • PHP (.php, .phtml) — Laravel controllers, Eloquent models, PHP 8+ attributes (#[Route]), traits, enums.
  • C# (.cs) — ASP.NET Core controllers ([ApiController], [Route], [HttpGet]), records, enums, interfaces, async tasks.
  • C & C++ (.c, .cpp, .cc, .cxx, .h, .hpp) — Headers, namespaces, classes with multiple inheritance, templates, structs, enum classes.
  • Pluggable architecture allowing seamless community contributions for additional languages.

5. Quickstart

Installation

Using Go Toolchain:

go install github.com/nosleepman1/SynapseCode/cmd/synapse@latest

Pre-built Binaries:

Download the latest pre-compiled archive for Linux, macOS, or Windows from the Releases page.


Claude Desktop Integration

Add the following configuration to your claude_desktop_config.json:

{
  "mcpServers": {
    "synapse-code": {
      "command": "synapse",
      "args": ["mcp", "--path", "/path/to/your/repository", "--watch"]
    }
  }
}

Restart Claude Desktop. SynapseCode provides full Model Context Protocol support:

1. Tools:

  • get_repo_map: Generates an architectural overview with language and symbol category distributions.
  • get_context_for_task: Retrieves full target implementations and direct 1-hop skeletons under a strict token budget.
  • get_symbol_callers: Inspects all callers and dependents of a given symbol across the codebase to prevent regressions.
  • get_symbol_definition: Retrieves the full definition, signature, location, documentation, and body of any symbol.
  • get_impact_analysis: Calculates the blast radius of modifying a symbol (direct callers, transitive dependents, affected files, impacted test suites, risk severity LOW to CRITICAL).
  • get_file_outline: Returns a structured outline of all symbols defined in a file with line numbers and signatures.

2. Resources (synapse://graph/...):

  • synapse://graph/summary: High-level codebase metrics (total files, symbols, dependency edges).
  • synapse://graph/languages: Symbol counts broken down across all supported languages.
  • synapse://graph/symbols: Master index of all exported functions, classes, and interfaces.
  • synapse://graph/file/{path}: Formats a structured outline of all symbols in a file.
  • synapse://graph/symbol/{name}: Full definition, signature, docstring, and incoming callers of a symbol.

3. Guided Prompts:

  • refactor_safe: Step-by-step refactoring instruction with blast radius, callers, and dependency contracts.
  • generate_unit_tests: Prompts comprehensive unit test suites with mocks for external dependencies.
  • audit_architecture: Architectural coupling and dependency health check.
  • explain_symbol: Architectural role, upstream dependents, and downstream contracts of any symbol.

Command Line Interface (CLI)

# Scan and persist codebase graph index to .synapse/cache.json
synapse index --path /path/to/repo

# Force re-indexing all files, bypassing existing cache
synapse index --force

# Search codebase symbols with Okapi BM25 and Reciprocal Rank Fusion (RRF)
synapse query "jwt token validation" --path /path/to/repo

# Generate an architectural map under 2000 tokens
synapse map --path /path/to/repo

# Extract targeted context for a specific task
synapse context "fix token verification in jwt service" --budget 3500

# Start MCP server on standard I/O with live filesystem watching
synapse mcp --path /path/to/repo --watch

6. Architecture Overview

Source Repository
       |
       v
File Discovery (Scanner + Ignore Rules)
       |
       v
AST Parsing (Go, TS/JS, Python, Rust)
       |
       v
In-Memory Dependency Graph (Nodes & Edges)
       |
       +-------------------------------+
       |                               |
       v                               v
BM25 Lexical Index             Personalized PageRank
       |                               |
       +---------------+---------------+
                       |
                       v
       Knapsack Token Budget Selector
                       |
                       v
            Structured Context Pack
                       |
                       v
            Model Context Protocol
                       |
                       v
              AI Coding Assistant

Detailed technical specifications are available in ARCHITECTURE.md and PROJECT_SPEC.md.


7. Contributing

Contributions are welcome. Please consult CONTRIBUTING.md and CODE_OF_CONDUCT.md for development environment setup and guidelines.


8. License

SynapseCode is licensed under the MIT License.

↑↓ navigate openesc close