CodeAgent MCP
A powerful, hosted Model Context Protocol (MCP) server that gives LLMs the ability to understand, navigate, and query any public GitHub repository.
README
🚀 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, indexes it using tree-sitter, and exposes a suite of code-intelligence tools via Server-Sent Events (SSE).
🌟 Vision & What It Is
The Problem: LLMs are great at writing code, but they struggle to explore large, unseen codebases. You can't just paste a 10,000-line repository into a chat window.
The Solution: CodeAgent acts as the "eyes and hands" of the LLM.
- The user tells the LLM: "Index this GitHub repo"
- The LLM calls our
index_github_repotool. - CodeAgent clones the repo to disk, parses every file into an Abstract Syntax Tree (AST) using tree-sitter, and stores all functions, classes, and imports in a PostgreSQL database.
- The LLM can now use tools like
search_symbols,find_callers, andread_codeto navigate the codebase precisely, fetching only the exact lines of code it needs.
🏗 Architecture
Here is exactly how CodeAgent works under the hood:
graph TD
subgraph Client [MCP Client]
LLM[Claude Desktop / Cursor / Web]
end
subgraph CodeAgent [CodeAgent Server]
FastMCP[FastMCP SSE Server]
SessionMgr[Session Manager]
Indexer[Tree-Sitter Indexer]
Tools[Code Intelligence Tools]
end
subgraph Storage [Storage Layer]
DB[(PostgreSQL)]
Disk[(Local Disk /tmp)]
end
LLM <-->|1. SSE Transport| FastMCP
FastMCP -->|2. Route Request| SessionMgr
FastMCP -->|4. Execute Tool| Tools
SessionMgr -->|3a. Git Clone| Disk
SessionMgr -->|3b. Trigger Indexing| Indexer
Indexer -->|Parse AST| Disk
Indexer -->|Store Symbols & Imports| DB
Tools -->|Query Metadata| DB
Tools -->|Read File Slices| Disk
Components
- FastMCP (SSE): The transport layer. Listens for HTTP requests and maintains a streaming connection with the LLM.
- Session Manager: Manages multi-tenant workspaces. Clones repos to
/tmp/codeagent_sessions/{id}and cleans them up after 24 hours. - Tree-Sitter Indexer: Scans the codebase, understands the language syntax (Python, JS, TS, etc.), and extracts symbols.
- Postgres: Stores relational metadata (
symbols,imports) for lightning-fast querying across massive codebases.
🛠 Available MCP Tools
CodeAgent equips the LLM with these exact capabilities:
| Tool | Description |
|---|---|
index_github_repo(github_url) |
Clones and indexes a public repo. Returns a unique session_id. |
search_symbols(query, session_id) |
Finds functions/classes by partial name using ILIKE search. |
list_all_symbols(kind, session_id) |
Lists all symbols filtered by kind (e.g., all classes). |
find_callers_tool(function_name, session_id) |
Greps the codebase for places where a function is called. |
read_code(file_path, start_line, end_line, session_id) |
Reads exact source code lines directly from disk. |
get_imports(file_path, session_id) |
Lists all imports recorded for a specific file. |
get_session_status(session_id) |
Checks if a repository session is ready for querying. |
🚀 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) → Integrations (or Connectors).
- Click Add Integration.
- Enter the Server URL:
https://codeagent-mcp.onrender.com/sse - Click 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 SSE as the transport.
- Enter URL:
https://codeagent-mcp.onrender.com/sse
Example Prompt:
"Index this repo: https://github.com/pallets/flask. Then tell me what the main application class looks like."
💻 Self-Hosting & Deployment
CodeAgent is fully open-source and easy to host yourself.
Prerequisites
- Python 3.11+
- PostgreSQL database (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 .env
# Edit .env and set your DATABASE_URL
Run the server locally:
python -m code_server.server
# Server will start at http://0.0.0.0:8000/sse
2. Deploy to Railway or Render (Free Tier)
- Push your code to GitHub.
- Go to Railway or Render.
- Create a new service from your GitHub repo.
- Set the
DATABASE_URLenvironment variable to your Postgres connection string. - 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 own Claude Desktop to
http://localhost:8000/sse. - Issue a Pull Request.
Areas to Improve (Ideas for PRs)
- Add Language Support: Currently, we parse Python, JS, and TS. Help us add Go, Rust, Java, or C++ by updating the
indexer.pytree-sitter grammars! - Smarter Chunking: Improve how
read_codereturns large files so the LLM context window doesn't get flooded. - Vector Search: Introduce
pgvectorto allow semantic searching (e.g., "Find the authentication logic") instead of just exact symbol matching. - File Tree Tool: Add a tool that returns the directory structure of the cloned repository.
Development Guidelines
- All DB-touching functions live in
code_server/tools.pyand must accept asession_id. - Tool wrappers for FastMCP live in
code_server/server.py. - We use
asyncpgfor database pooling. Never use blocking synchronous calls in the async event loop. - Use the
lifespanhook inserver.pyfor any startup/shutdown logic to avoidevent loop is closederrors.
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
Neon Database
MCP server for interacting with Neon Management API and databases
E2B
Using MCP to run code via e2b.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.