How guided delegation bridges dependency analysis with up-to-date docs.
A while back I wrote about building a Maven Central MCP server so Claude / Copilot can answer the boring dependency questions straight from Maven Central.
It worked well for “what version should I be on?”
On major upgrades, updating the POM was only part of the work. Breaking changes could still leave me searching through documentation and fixing the resulting build failures. I wanted the assistant to have that documentation available while working through the upgrade.
The Gap: From “What to Upgrade” to “How to Upgrade”
My Maven tools can tell you things like:
- What the latest stable version is
- Whether an update is major/minor/patch
- Which dependencies are aging or stale
That gets you to a decision. It doesn’t get you through the upgrade.
For anything non-trivial you still end up hunting for the right migration guide or “breaking changes” doc. And if the assistant falls back to generic web search, you quickly get stale or out-of-context advice.
That's where Context7 fits in. It retrieves indexed library documentation, including version-specific documentation where it's available. The assistant still needs to check that the result covers the version being targeted. If it doesn't, it can look for the project's migration guide or release notes using its own web-search tools, if available.
So the real problem became: how do I combine “Maven intelligence” with “current docs” without jamming everything into one big server?
The Approach: Guided Delegation
I didn’t want to re-implement Context7 inside my project. I just wanted a clean workflow:
- Maven Tools does the analysis (versions, stability, update type)
- If it looks like a potentially painful upgrade, it returns an extra field with explicit orchestration instructions
- The assistant uses those instructions to call Context7 tools (or fall back to normal web search)
The Maven analysis returns hints for the next documentation lookup. The assistant decides whether to follow them. With Context7 enabled, Maven Tools also exposes its documentation tools through the same server, forwarding those calls to Context7. The analysis doesn't automatically run the documentation lookup. That's what I mean by guided delegation.
Implementation: Dual MCP Architecture with Spring AI
This ended up being mostly configuration.
1) Wire Context7 as an MCP client
In src/main/resources/application.yaml I enable the MCP client and tool callback, and point it at Context7:
spring:
ai:
mcp:
client:
enabled: true
type: ASYNC
request-timeout: 15s
toolcallback:
enabled: true
streamable-http:
connections:
context7:
url: https://mcp.context7.com/
context7:
enabled: true
With that, Spring AI connects to Context7 and exposes its tools alongside my Maven tools.
2) Add “guidance hints” to the response models
On the Maven side, I don’t call Context7 directly. I just include a context7_guidance field when Context7 is enabled.
Here’s the rough shape of the tool method (trimmed down, but with the real parameters):
@Tool(description = "Bulk upgrade check (versions REQUIRED in input).")
public ToolResponse compare_dependency_versions(
String currentDependencies,
@Nullable StabilityFilter stabilityFilter,
@Nullable Boolean includeSecurityScan) {
return executeToolOperation(() -> {
// ... compare versions, optionally scan with OSV
return new VersionComparison(Instant.now(), results, summary, securitySummary);
});
}
And the per-dependency comparison result can include a guidance block like this:
{
"comparison_date": "2026-01-06T12:00:00Z",
"dependencies": [
{
"dependency": "org.springframework.boot:spring-boot-starter",
"current_version": "2.7.0",
"latest_version": "3.2.0",
"update_type": "major",
"update_available": true,
"context7_guidance": {
"orchestration_instructions": "Use resolve-library-id tool with query='spring-boot-starter migration guide breaking changes' and libraryName='spring-boot-starter' to find the library ID. Then use query-docs tool with the returned libraryId and query='spring-boot-starter migration guide breaking changes' to get upgrade instructions. If Context7 doesn't provide sufficient information, perform a web search for 'spring-boot-starter major version upgrade guide'."
}
}
],
"update_summary": { "major_updates": 1, "minor_updates": 0, "patch_updates": 0, "no_updates": 0 }
}
That string looks a bit verbose on purpose: it’s meant to be copy-pasteable instructions for the model, not a nice message for humans.
Setup Notes
If you’re running the Docker image, you don’t need a separate Context7 server. The container will call out to https://mcp.context7.com/.
- If your network blocks it, the README documents a Context7-free image:
arvindand/maven-tools-mcp:latest-noc7 - There’s also a profile that disables the MCP client entirely (see src/main/resources/application-no-context7.yaml)
What Changed for Me
The practical difference is that a major upgrade conversation doesn’t stall out after “this is a major update”. The assistant can immediately pull the right docs and keep going.
Also: keeping this as “compose tools + add orchestration hints” felt a lot cleaner than turning Maven Tools into a documentation scraper.
If you try it, I’m curious about two things:
- Are the
context7_guidanceinstructions actually helpful in your upgrade scenarios? - Where do they fall short (too generic, too verbose, wrong query phrasing, etc.)?
Check out the repo if you haven't yet - github.com/arvindand/maven-tools-mcp.
About the Author: I'm a software architect at Rockwell Automation. I write about architecture, developer tooling, and the use of AI in software engineering. You can find me on GitHub or LinkedIn.
Updated September 2026 to clarify tool behaviour and limitations.
Top comments (0)