SuperAPI AI Directory

synapse-code-mcp

Structural code context via TypeScript AST analysis: compressed symbol indexes, dependency graphs and git diffs, without a vector database or embeddings.

Open website

About this tool

Synapse-code-mcp is a Model Context Protocol (MCP) server for code intelligence that connects local repositories to AI assistants. It enables AI assistants to explore codebases on demand, rather than copy-pasting entire files into prompts, thereby reducing context waste, improving response quality, and scaling to large projects. The project is currently in its early stages and is under active development.

Purpose

Synapse primarily addresses context quality issues in large-scale codebases: without setting up a vector database or embedding API, it provides AI assistants with structured code context, including a compressed symbol index, dependency graph, and git change diffs. For TypeScript/JavaScript, it provides deep analysis based on ts-morph (the TypeScript compiler API); for other languages, it uses regex-based extraction of function and class names, and can still read and search files normally.

Main Capabilities

  • get_project_index: Returns a compressed semantic map of the entire project, including the signatures of all exported functions, classes, interfaces, types, enums, and top-level constants, without function bodies. Suitable for calling first when exploring an unfamiliar codebase. Parameters include file_pattern (a glob to narrow the scope), include_non_exported, output_format (default markdown, can be set to json for structured output). For large projects, it is recommended to use file_pattern to index by area in batches.
  • get_semantic_context: Returns file contents and their local dependency graph, including everything needed to understand the code. You can set outline_only: true to return only signatures without implementation bodies; the output is constrained by benchmarks to no more than 50% of the full content length while preserving complete structural understanding. Parameters include file_path (required), depth (number of import hops, default 2), outline_only, output_format.
  • get_changed_files: Lists files changed relative to a certain git ref, grouped by status (Added / Modified / Deleted / Renamed), with optional line counts and full unified diff. Parameters include base_ref (default HEAD~1), include_diff, file_pattern.
  • get_project_tree: Displays the repository in a structured way and follows .gitignore rules. Parameters include path, max_depth, show_hidden.
  • search_codebase: Quickly performs text or regex searches in the project, returning matching file paths and line numbers. It prioritizes ripgrep, falling back to a pure Node.js scanner when unavailable. Parameters include query (required), file_pattern, is_regex, max_results.

Language Support and Dependency Graph

Synapse uses ts-morph (the TypeScript compiler API) for deep analysis of TypeScript and JavaScript; for other languages it uses regex to extract function and class names. Dependency graph traversal (following import / require chains) applies only to TypeScript/JavaScript. For other languages, Synapse can still read and search files normally, but will not traverse the import graph. Dependency graph traversal also follows relative imports (./foo, ../bar) as well as path aliases configured in compilerOptions.paths in tsconfig.json (such as @/components/Foo), as long as tsconfig.json exists in the project root directory. Projects without tsconfig.json fall back to resolving only relative paths.

Usage

Supports global installation (recommended) or running directly without installation. It can be configured for Claude Desktop (on macOS the path is ~/Library/Application Support/Claude/claude_desktop_config.json, on Windows the path is %APPDATA%\Claude\claude_desktop_config.json), Claude Code (CLI, can be added to ~/.claude/settings.json), Cursor (.cursor/mcp.json, placed in the user directory or project root directory), Windsurf (~/.codeium/windsurf/mcp_config.json). Replace /path/to/your/project with the absolute path of the repository to serve. You can run multiple Synapse instances, one per project, each using a different key under mcpServers.

A synapse.config.json can be placed in the project root to override default values. cacheEnabled (default true) controls the disk incremental index cache (.synapse-cache/index.json); get_project_index and get_semantic_context use it to skip re-parsing unchanged files. Set it to false to disable. All fields are optional, and CLI arguments take precedence over synapse.config.json.

Performance and Design Trade-offs

Measured on real open-source TypeScript repositories (single run, --depth 1 clone, no warm cache), performance is approximately 120-257 milliseconds, usable instantly on any repository without pre-indexing. The automated benchmark suite sets upper bounds on synthetic fixtures (3000 minimal .ts files) to catch worst-case regressions; the CI budget is a generous safety margin, not a performance estimate, and is used to catch catastrophic regressions (such as unexpected O(n²) defects). For large monorepos (1000+ files), it is recommended to use file_pattern to index in batches by area.

Compared with semantic search solutions using vector databases (such as Milvus, Qdrant) and embedding APIs (OpenAI, VoyageAI), Synapse does not have the ability to "find code by conceptual meaning" (such as "find authentication logic"); what it trades for is: zero external dependencies (no API keys, vector databases, or embedding providers), zero recurring cost, fully local and deterministic (the same input always produces the same output, data does not leave the local machine, no pre-indexing required), and instant usability on any repository. If you need natural language semantic search across millions of lines of multilingual code, a vector backend server is more suitable; if you want structured context (signatures, dependency graphs, diffs) without infrastructure, Synapse is built for exactly that.

Limitations and Security

Synapse is a read-only server and never writes to the filesystem or modifies git repositories. It has path traversal protection: every file read passes through resolveAndValidate(root, path),and if the resolved path escapes the project root, a PATH_ESCAPE error is thrown; the AI client receives only the error code, not the file contents. Root scope restriction: only the directory tree under --root is accessible, and paths pointing outside (such as ../../etc/passwd) are rejected at the validation layer. File size limit: files exceeding maxFileSize (default 512 KB) are rejected before reading. Binary detection: compiled artifacts and binary files are automatically detected and skipped. No outbound network calls: it communicates with MCP clients only through a local stdio pipe and makes no HTTP requests.

Use Cases and Dependencies

Recommended workflows include: exploring a new codebase, pre-PR code review, and debugging a feature. Runtime dependencies: git is required only for get_changed_files; ripgrep (optional) is used to significantly speed up searches, and if rg is not in $PATH it falls back to a pure Node.js scanner. You can use MCP Inspector for testing; it opens a browser UI to interactively call all tools and inspect inputs and outputs. The project structure, contribution guidelines (CONTRIBUTING.md), code of conduct (CODE_OF_CONDUCT.md, Contributor Covenant 2.1), and roadmap (ROADMAP.md) can be found in the repository. New users can browse issues labeled good first issue.