Codebase Copilot MCP Server
Provides tools to search and read code within the tqdm repository, enabling AI agents to explore and answer questions about the codebase.
Click on "Install 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., "@Codebase Copilot MCP ServerHow does tqdm's update method 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.
Codebase Copilot
An AI coding assistant built from scratch to learn and demonstrate four core building blocks of modern AI systems: RAG, Agents, MCP, and Multi-Agent orchestration — applied to a real codebase (tqdm).
Instead of using a framework that hides how these systems work, every layer here is built manually in plain Python, so the internals are fully understood, debugged, and explainable.
What it does
Point it at a codebase (tqdm, in this case) and ask questions like "what is the tqdm class and how does its update method work?" — it retrieves the relevant code, reasons about what it needs, and generates an accurate, grounded answer.
Related MCP server: @lex-tools/codebase-context-dumper
Architecture — four progressive stages
1. RAG (index.py, query.py)
Parses the codebase using Python's
astmodule, splitting code into meaningful chunks (whole functions/classes, not arbitrary word-count slices)Embeds each chunk locally using
sentence-transformersStores embeddings in a local
ChromaDBvector databaseRetrieves the most relevant chunks for a question and generates an answer via the Groq API (
openai/gpt-oss-120b)
Real bug fixed: naive word-count chunking caused the main tqdm class (spread across a large file) to never surface in search results, since no single chunk represented it well. Fixed by switching to AST-based chunking — splitting by function/class boundaries instead, with large classes further split by individual method.
2. Agent (agent.py)
Gives the model two tools:
search_codeandread_fileThe model decides autonomously which tool to use, when, and whether it needs another step before answering — instead of a fixed search-then-answer sequence
Includes safeguards for real agent failure modes: malformed tool arguments, repeated/looping tool calls, and forced convergence to a final answer within a step budget
3. MCP Server (server.py, test_mcp_client.py)
Wraps
search_codeandread_fileas a standard Model Context Protocol server, making them accessible to any MCP-compatible client — not just this project's own scriptVerified with a custom MCP client that connects over stdio, lists available tools, and calls them successfully against the live database
4. Multi-Agent System (multi_agent.py)
Three specialized agents coordinated by an orchestrator:
Retriever — searches the codebase (with a targeted secondary search for specific method names)
Explainer — writes an answer from retrieved context
Reviewer — checks the answer for accuracy and completeness against the actual context, and can send it back to the Explainer with specific feedback for revision (up to 2 rounds)
Real bug fixed: the Reviewer initially approved an answer that incorrectly claimed information was "missing," when it was actually present in the codebase — the Retriever just hadn't surfaced it. This exposed a real multi-agent design flaw: a Reviewer can only judge consistency with the context it's given, not whether the Retriever gathered the right context in the first place. Fixed by improving retrieval coverage and adding an explicit check in the Reviewer's prompt for this failure pattern.
Tech stack
Python — core language
ChromaDB — local vector database
sentence-transformers (
all-MiniLM-L6-v2) — local embeddingsGroq API (
openai/gpt-oss-120b) — LLM inferenceMCP (Model Context Protocol) — standardized tool exposure
Setup
Clone this repo and create a virtual environment:
python -m venv venv source venv/bin/activate # Windows: venv\Scripts\activate pip install -r requirements.txtClone tqdm's source into a
repofolder (or pointREPO_PATHinindex.pyat any other small Python codebase):git clone https://github.com/tqdm/tqdm.git repoAdd a
.envfile with your Groq API key:GROQ_API_KEY=your_key_hereBuild the index:
python index.pyTry any of the four stages:
python query.py # Week 1: plain RAG python agent.py # Week 2: agent with tools python server.py # Week 3: MCP server (run test_mcp_client.py in a separate terminal to test it) python multi_agent.py # Week 4: multi-agent system
What I learned
Building this project surfaced real engineering problems that don't show up in tutorials:
Retrieval quality is a hard ceiling on generation quality, no matter how good the LLM is
Chunking strategy matters more than embedding model choice for code specifically
Agents need explicit guardrails against looping and malformed tool calls
A "reviewer" agent is only as good as the context it's reviewing against — multi-agent systems can still fail silently if earlier stages don't surface the right information
Future directions
Smarter multi-agent flow where the Reviewer's feedback can trigger the Retriever again, not just the Explainer
Swap the local embedding model for a larger hosted one (e.g. Voyage AI) to compare retrieval quality
Extend to support editing code, not just answering questions about it
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityAmaintenanceA Model Context Protocol (MCP) server that helps large language models index, search, and analyze code repositories with minimal setup14992MIT
- AlicenseAqualityDmaintenanceA Model Context Protocol (MCP) server designed to easily dump your codebase context into Large Language Models (LLMs).163Apache 2.0
- Alicense-qualityBmaintenanceAgent-safe code retrieval MCP server that indexes repositories and provides semantic search, file navigation, call graph analysis, and bounded file reading tools for coding agents.3,977,9623MIT
- AlicenseAqualityAmaintenanceEnables AI coding agents to efficiently explore codebases by providing structural outlines, module digests, symbol bodies, and AST-aware grep via MCP.428MIT
Related MCP Connectors
An MCP server that gives your AI access to the source code and docs of all public github repos
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Search your AI chat history (ChatGPT, Claude, Codex) from any MCP client. Remote, private, read-only
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/farahibreez18-ds/codebase-copilot'
If you have feedback or need assistance with the MCP directory API, please join our Discord server