Building a codebase-query MCP server in about 100 lines of Python
12/03/2026 — 12/03, 21:16·1 sources (all)·1 reports (all)
Key takeaways
- A developer built a codebase-query MCP server in about 100 lines of Python using the official mcp SDK. It parses a repository into an import…
Background & analysis
On December 3, 2026, a post in DEV Community's AI section described a custom MCP server written in roughly 100 lines of Python for querying a code repository. The author built it on the official mcp SDK: an MCPServer instance is created, plain functions are marked with the @mcp.tool() decorator, and the server is started with mcp.run(). The post notes that on mcp 1.x the same class is called FastMCP.
The server uses Python's standard-library ast module to parse a repository into an import graph and exposes three tools: who_imports, imports_of and most_imported. Counting docstrings and blank lines, the implementation comes to 116 lines.
For performance, the author tested it on a Django repository containing 2,943 Python files. The first call parses every file and took 30 to 36 seconds; after that, each query returned quickly. The report ends there and does not mention any later updates or releases of the server.
AI-generated from 1 reports · updated 2 days ago
- Heat index
- 25
- All sources
- 1
- All reports
- 1
- First seen
- 2 days ago
Reports on this story headlines open the original
Using the official mcp SDK, the author builds an MCP server in roughly 100 lines of Python that parses a repo into an import graph with the stdlib ast module and exposes three tools: who_imports, imports_of and most_imported. On a Django repo with 2,943 Python files, the first call took 30 to 36 seconds to parse everything, after which each query returned quickly.
DEV Community · AIAI score 59
Other stories people are talking about
- Heat index 49Tutorial: building a read-only DuckDB query MCP server in Python with FastMCP1 sources
- Heat index 880RisingOpenAI growth stalls as Nvidia delays 10-Q, sparking AI and chip stock selloff16 sources
- Heat index 830RisingMiniMax M4 scores 47 on Intelligence Index; M4.1 in development18 sources
- Heat index 665Alibaba open-sources Qwen4-35B-A3B with 1M context16 sources
- Heat index 590RisingOpenAI memo makes revenue its north-star metric ahead of IPO9 sources
How is heat calculated?About the methodHide
Heat counts how many independent sources covered a story in the last 48 hours: one source counts once no matter how many posts it published, decaying with a 24-hour half-life. What ranks first is what many people are talking about.
This page aggregates public feeds. Headlines and summaries are machine-organized and remain the property of the original authors; verify important facts at the source. If you believe a headline or summary infringes your rights, email the contact address in the footer with the page URL and basis of your claim, and we will remove or replace it after review.
- Surge
- Discussion rising fast
- New
- First report within 6 hours
- Rising
- Still gathering discussion

