astrograph
An MCP server with tools to stop AI agents from writing duplicate code. Fixes legacy code using highly efficient algorithms.
claude mcp add --transport stdio thaylo-astrograph docker run --rm -i --pull missing --add-host host.docker.internal:host-gateway -v .:/workspace -v ./.metadata_astrograph:/workspace/.metadata_astrograph thaylo/astrograph:latest
How to use
ASTrograph is an MCP server that prevents duplicate code writes by analyzing your codebase's structure using AST graphs. It blocks attempts to write new code that has the same abstract structure as existing code, regardless of variable names, formatting, or comments. This helps maintain unique implementations across a project and can be integrated into your IDE or CI workflow via MCP configuration. The server supports Python, JavaScript/TypeScript, Go, and attaches language servers for other languages, enabling real-time code structure comparisons during edits and merges. To use it, configure the astrograph MCP entry in your project (via Docker as shown) and connect your editor or tooling to the MCP server. The server loads and indexes your workspace on startup and re-indexes on file changes, so you’ll receive immediate feedback if a conflicting snippet is attempted.
How to install
Prerequisites:
- Docker installed and running on your machine
- Access to the project you want to index
- Basic knowledge of MCP configuration in your workspace
Install and run with Docker (recommended):
- Add the MCP configuration to your project root (e.g., .mcp.json) with the following content:
{
"mcpServers": {
"astrograph": {
"command": "docker",
"args": [
"run", "--rm", "-i", "--pull", "missing",
"--add-host", "host.docker.internal:host-gateway",
"-v", ".:/workspace",
"-v", "./.metadata_astrograph:/workspace/.metadata_astrograph",
"thaylo/astrograph:latest"
]
}
}
}
- Ensure your project is available at the mounted workspace path so Astrograph can index files.
- Start the container using your MCP tooling or run the docker command directly if you prefer to test locally.
If you prefer running Astrograph without Docker, you can install via Python (as shown in the README) and run the module directly:
pip install .
python -m astrograph.server
But the README primarily provides the Docker-based setup as the recommended path.
Additional notes
Tips and considerations:
- The Docker configuration mounts your project at /workspace inside the container and stores metadata in .metadata_astrograph. Ensure these paths are correct for your environment.
- The server reports its current version in serverInfo.version on connect, so you can track releases easily.
- Astrograph supports Python, JavaScript, TypeScript, and Go out of the box; other languages can attach language servers over TCP as described in the README.
- If you see performance issues on very large codebases, consider indexing in incremental passes or adjusting the workspace mount strategy to reduce I/O overhead.
- For Claude or Codex integration, follow the provided examples to configure the astrograph MCP server in their respective config files.
Related MCP Servers
jupyter
🪐 🔧 Model Context Protocol (MCP) Server for Jupyter.
packt-netops-ai-workshop
🔧 Build Intelligent Networks with AI
google-search-console
It connects directly to your Google Search Console account via the official API, letting you access key data right from AI tools like Claude Desktop or OpenAI Agents SDK and others .
Youtube
YouTube MCP Server is an AI-powered solution designed to revolutionize your YouTube experience. It empowers users to search for YouTube videos, retrieve detailed transcripts, and perform semantic searches over video content—all without relying on the official API. By integrating with a vector database, this server streamlines content discovery.
coder_db
An intelligent code memory system that leverages vector embeddings, structured databases, and knowledge graphs to store, retrieve, and analyze code patterns with semantic search capabilities, quality metrics, and relationship modeling. Designed to enhance programming workflows through contextual recall of best practices, algorithms, and solutions.
sqllite
🗄️ SQLite MCP Server