CodeAgent MCP
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@CodeAgent MCPHow does the file watching indexing system work?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
🚀 CodeAgent MCP
A powerful, hosted Model Context Protocol (MCP) server that gives LLMs (like Claude, Cursor, and Windsurf) the ability to understand, navigate, and query any public GitHub repository.
CodeAgent clones the repository, parses it using tree-sitter, generates lightning-fast vector embeddings via Hugging Face Serverless API / FastEmbed, and exposes a suite of advanced code-intelligence tools via Streamable HTTP.
🌟 Vision & What It Is
The Problem: LLMs are great at writing code, but they struggle to explore large codebases. Claude cannot hold a 500-file repository in context, nor can it efficiently build architecture diagrams or semantically search across thousands of functions natively.
The Solution: CodeAgent acts as the "eyes and hands" of the LLM with a 100% free, hosted backend.
The user tells the LLM: "Index this GitHub repo"
The LLM calls our
index_github_repotool.CodeAgent performs a shallow clone, parses every file into an Abstract Syntax Tree (AST) using tree-sitter in parallel (
< 0.1s), generates cloud vector embeddings via Hugging Face API (~0.3s, using 0% CPU & 0 MB RAM), and stores all symbols and imports in a PostgreSQL database via a single bulk transaction.The LLM can now instantly generate architecture diagrams, perform semantic vector searches, and navigate the codebase precisely.
Related MCP server: Headless Codebase Indexer
⚡ Performance Highlights & Upgrades
🚀 10x Fast Bulk Indexing: AST parsing and symbol collection happen entirely in memory, followed by 1 bulk database transaction (
conn.transaction()) rather than hundreds of individual SQL roundtrips.☁️ Zero-RAM Cloud Embeddings: Uses Hugging Face Serverless Inference API (
BAAI/bge-small-en-v1.5) for 0% CPU and 0 MB RAM overhead on cloud hosts (Render/Railway), preventing 512MB memory crashes.🛡 Multi-Tier Embedding Fallback: Seamless automatic failover: Hugging Face API → OpenRouter API → Local FastEmbed.
🎯 Full Session-Scoped Agent Loop: Multi-tenant
session_idpropagation across all code-intelligence tools including vector similarity search (semantic_search) and Mermaid.js architecture generation (generate_architecture).
🏗 Architecture
Here is exactly how CodeAgent works under the hood:
graph TD
subgraph Client [MCP Client]
LLM[Claude Desktop / Cursor / Windsurf]
end
subgraph CodeAgent [CodeAgent Server]
FastMCP[FastMCP Server]
SessionMgr[Session Manager]
Indexer[Tree-Sitter Parallel AST Parser]
Tools[Code Intelligence Tools]
end
subgraph External [Cloud Embeddings]
HF[Hugging Face Serverless API]
end
subgraph Storage [Storage Layer]
DB[(PostgreSQL + pgvector)]
Disk[(Local Disk /tmp)]
end
LLM <-->|1. Streamable HTTP Transport| FastMCP
FastMCP -->|2. Route Request| SessionMgr
FastMCP -->|4. Execute Tool| Tools
SessionMgr -->|3a. Git Clone| Disk
SessionMgr -->|3b. Trigger Bulk Indexing| Indexer
Indexer -->|Parse AST In-Memory| Disk
Indexer -->|Batch Text| HF
HF -->|384-dim Vectors| Indexer
Indexer -->|Single Bulk Transaction| DB
Tools -->|Query Metadata & Vectors| DB
Tools -->|Read File Slices| DiskComponents
FastMCP (Streamable HTTP): The transport layer. Listens for HTTP requests at
/mcpand maintains a streaming connection with the LLM.Tree-Sitter Parallel Indexer: Scans the codebase, understands syntax (Python, JS, TS, TSX), and extracts symbols and imports in milliseconds.
Hugging Face Serverless Embeddings: Computes 384-dimensional vector embeddings over HTTP via
router.huggingface.cowith fallback to OpenRouter / FastEmbed.Postgres + pgvector: Stores relational metadata and vector embeddings for lightning-fast semantic querying.
🛠 Available MCP Tools
CodeAgent equips the LLM with these exact capabilities:
Tool | Description |
| Clones and indexes a public repo in 1-pass bulk transaction. Returns a unique |
| Instantly returns a Mermaid.js class diagram of the entire repository's architecture. |
| Uses |
| Finds functions/classes by partial name using fast |
| Lists all symbols filtered by kind (e.g., all |
| Greps the codebase for places where a function is called. |
| Reads exact source code lines directly from disk with line numbers. |
| Lists all imports recorded for a specific file. |
🚀 Quick Start (Using the Hosted Version)
Want to try it immediately? Add our public hosted endpoint to your MCP client!
Using Claude Desktop
Open Claude Desktop.
Go to Settings (Gear Icon) → Connectors (or Edit
claude_desktop_config.json).Click Add Connector → Add Custom Connector (or configure custom MCP HTTP endpoint).
Enter the Server URL:
https://codeagent-mcp.onrender.com/mcpClick Connect.
Note: Claude Web (Chrome/Safari) does not support MCP yet. You must use the Claude Desktop macOS/Windows app.
Using Cursor
Go to Cursor Settings → Features → MCP.
Click Add New MCP Server.
Choose Streamable HTTP / HTTP as the transport.
Enter URL:
https://codeagent-mcp.onrender.com/mcp
Example Prompt:
"Index this repo: https://github.com/pallets/flask. Then, use the architecture tool to draw the complete class diagram. Finally, use semantic search to find where they handle request parsing."
💻 Self-Hosting & Deployment
CodeAgent is fully open-source and easy to host yourself.
Prerequisites
Python 3.11+
PostgreSQL database with
pgvectorextension enabled (e.g., Neon free tier)Git installed on the system
1. Local Development Setup
# Clone the repository
git clone https://github.com/YOUR_USERNAME/CodeAgent-MCP.git
cd CodeAgent-MCP
# Create virtual environment and install
python3 -m venv .venv
source .venv/bin/activate
pip install -e .
# Configure environment
cp .env.example .envSet your environment variables in .env:
OPENROUTER_API_KEY="sk-or-v1-your-key"
DATABASE_URL="postgresql://user:password@ep-host.neon.tech/neondb?sslmode=require"
HF_TOKEN="hf_your_huggingface_token"Run the server locally:
python -m code_server.server
# Server will start at http://0.0.0.0:8000/mcp2. Deploy to Render or Railway
Push your code to GitHub.
Create a new Web Service from your GitHub repo.
Set Environment Variables:
DATABASE_URL(PostgreSQL connection string)HF_TOKEN(Free Hugging Face token for zero-RAM cloud embeddings)OPENROUTER_API_KEY(OpenRouter API key)
Deploy! The platforms will automatically detect the
Dockerfileand expose port8000.
🤝 Instructions for Contributors
We love contributions! If you want to make CodeAgent smarter, faster, or add support for more languages, here is how you can help:
How to Contribute
Fork the repo and create your branch from
main.Set up locally using the Local Development Setup instructions above.
Make your changes. Ensure your code is well-commented and clean.
Test your changes by running the server locally and connecting your MCP client to
http://localhost:8000/mcp.Issue a Pull Request.
Areas to Improve (Ideas for PRs)
Add Language Support: Currently, we parse Python, JS, TS, and TSX. Help us add Go, Rust, Java, or C++ by updating the
indexer.pytree-sitter grammars!Autonomous Cloud PRs: Add WRITE capabilities (
edit_file,create_pull_request) so Claude can act as an autonomous SWE-agent on GitHub repos.Smarter Chunking: Improve how
read_codereturns large files so the LLM context window doesn't get flooded.
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
This server cannot be deployed
Maintenance
Related MCP Connectors
Code intelligence for LLMs. Analyze, search, and retrieve code from any public git repository.
Codebase intelligence for agents: 152 structured artifacts across 21 programs, one call.
Code intelligence for coding agents: semantic, AST, graph, and full-text search. 279+ languages.
Shared memory for coding agents. Stop re-explaining your codebase every session.
Related MCP Servers
- AlicenseNot gradedqualityAmaintenanceLocal-first code indexer that provides deep code understanding for Claude and other LLMs with symbol/text search across 48+ languages, semantic search capabilities, and real-time index updates through the Model Context Protocol.58MIT
- FlicenseNot gradedqualityDmaintenanceA minimalist indexing tool that provides AI agents with semantic search and structural AST parsing for deep codebase understanding. It enables autonomous agents to navigate large codebases predictably using vector embeddings and native language server capabilities like definition and reference tracking.-
- AlicenseNot gradedqualityCmaintenanceProvides a semantic understanding of your codebase by parsing with tree-sitter and building a graph of symbols and dependencies. Enables AI assistants to navigate code, analyze changes, and discover architecture using 18 tools with minimal context overhead.9 npm1MIT
- AlicenseAqualityBmaintenanceProvides Claude Code with a repository symbol graph via tree-sitter, enabling instant symbol lookup, file skeletons, call-site analysis, and persistent notes, reducing token usage by reading signatures instead of whole files.121MIT