A coding assistant that discovers a project reads the files one by one and guesses how they connect. In a FastAPI API, the important information sits precisely in those connections: which route goes through which dependency, which schema mirrors which database model, which function writes to which table.
FastAPI-MCP-Architect is an MCP server, the protocol that lets a coding assistant call tools. Instead of reading blindly, the assistant asks precise questions and gets structured answers. The project is open source and published as an installable package.
Overall architecture
The server exposes typed tools, grouped around three engines. None of them runs the project's code: everything is read and analyzed, which makes the tool safe on any repository.
Semantic engineA language analysis engine finds a symbol's references and its definition, and renames it safely across all files.
Syntax treeReads the structure of the code: routes with their full path, the dependency injection tree, model fields and validators.
Knowledge graphA typed, queryable map of the whole application: neighbors, impact of a change, paths, audit and visual export.
Wide diagram: scroll it to the right.
Building the graph
Each file is read once to extract facts: functions, classes, imports, route decorators, injections, hard-coded SQL queries, rendered templates. Names are then resolved from one module to another through the imports, and the facts are assembled into typed nodes and edges: application, router, route, dependency, schema, database model, table.
Each file's facts are cached in the project. A file is read again only if its date or size has changed, and only if its content has actually changed. After the first build, questions stay fast even on a large project.
Wide diagram: scroll it to the right.
Asking the graph
The graph answers questions that a plain text search cannot handle:
Impact of a change: if I change this model, which routes are affected, and through which call chain?
Paths: how does a route reach a given table?
Audit: write routes without authentication, duplicated or never-mounted routes, unused schemas, unreferenced models, circular dependencies.
Consistency: field mismatches between an API schema and the database model it mirrors.
Wide diagram: scroll it to the right.
Technical choices
Static analysis only: no execution, no database connection, no side effect on the analyzed project.
Deterministic: no AI model in building the graph; the assistant reasons, the tool provides verifiable facts.
Real projects: the graph covers well-split projects as well as apps kept in a single file with hand-written SQL.
Documented limits: what static analysis cannot see is written down plainly, and the authentication audit can be guided by the user.
Tested on a sample project that covers routers, dependencies, schemas and models, for every tool.