Spring MCP server: code graph for AI agents
TL;DR. Which @Service beans and JPA repositories are touched by a Spring Boot REST endpoint change? trace-mcp indexes your existing Spring Boot repository into a local static code graph. AI coding agents query @RequestMapping endpoints, @Autowired bean dependencies, and JPA entity relationships through MCP instead of searching through verbose class files.
What trace-mcp extracts in Spring
The spring plugin indexes Spring MVC and Spring Boot applications across Java and Kotlin:
- REST & MVC Routes:
@RestController,@Controller,@RequestMapping,@GetMapping,@PostMapping,@PutMapping,@DeleteMapping(spring_route). - Dependency Injection:
@Service,@Repository,@Component,@Configuration,@Autowired, and constructor injection (spring_injects). - JPA Entity Relationships:
@Entitydeclarations and relational mappings (@OneToMany,@ManyToOne,@ManyToMany,@OneToOne) (spring_entity_relation). - Configuration & Values:
@Valueproperty injection keys (spring_config_value). - Multi-Language Support: Route and entity parsing across Java and Kotlin codebases using Maven (
pom.xml) or Gradle (build.gradle), with Java-focused constructor DI analysis.
Installation & Quickstart
Install trace-mcp globally, run initialization, and connect your Spring repository:
npm i -g trace-mcp && trace init && trace add
Example question to your agent
“Trace which
@Servicecomponents and JPA repositories are invoked by theAccountControllertransfer endpoint.”
The AI agent calls trace-mcp tools to trace DI bean resolution and route mapping without needing full-text grep over verbose Java classes.
Without graph vs with trace-mcp
Measurements below reflect corpus-level benchmarks from our PR review context benchmark across 60 pull requests.
| Capability | Without graph | With trace-mcp |
|---|---|---|
| Median input tokens | ~13595 tokens | ~3291 tokens (-72.7%) |
| Dependency injection | Inspect injection sites and bean declarations | Direct spring_injects edges |
| Route mapping | Must search annotations across files | Fast URI endpoint index |
| JPA entity associations | Parses complex Java class files | Relational entity graph |
| Java & Kotlin mixing | Inspect symbols across separate Java and Kotlin trees | Unified multi-language graph |
| Tools exposed | None (reads full files) | 182 specialized MCP tools |
Frequently asked questions
Does trace-mcp support both Java and Kotlin Spring Boot applications?
Dependency injection extraction targets simple Java-style @Autowired fields and constructor signatures. Kotlin dependency injection is not reliably extracted.
How does trace-mcp resolve Spring dependency injection?
It indexes @Service, @Repository, @Component, and @Configuration beans, building spring_injects edges between injection targets (@Autowired, constructor injection) and bean declarations.
Does trace-mcp index JPA entity relationships in Spring?
Yes. It extracts @Entity definitions along with @ManyToOne, @OneToMany, @ManyToMany, and @OneToOne relations, generating spring_entity_relation graph edges.
Next steps
Explore the full Tools reference for available query tools, see the Language capability matrix for Java and Kotlin parser details, view Comparisons against other tools, or browse all Supported frameworks.
Catalogue: Articles / frameworks
Last updated: October 20, 2026