How guided delegation bridges dependency analysis with up-to-date docs
A couple weeks ago, I wrote about building a Maven Central MCP server that gives AI assistants instant access to dependency information. People found it useful for quick dependency lookups and version comparisons.
But I kept running into a gap when using it myself.
The Gap: From "What to Upgrade" to "How to Upgrade"
My original MCP server was great at answering questions like:
- "What's the latest Spring Boot version?"
- "Which of my dependencies need updates?"
- "Show me stable versions only for production"
But when it came to complex upgrades - especially major version bumps - users still had to leave their AI assistant and hunt down migration guides. The conversation would typically go:
AI: "Spring Boot 3.2.0 is available, it's a major update from your current 2.7.0"
Developer: "Great, but how do I actually upgrade? What breaks?"
AI: "Let me search..." [returns generic advice from 2019]
That's when I discovered Context7 - this MCP server by Upstash that pulls current, version-specific documentation directly into AI prompts. Instead of stale web search results, it fetches official docs and working code examples.
The question became: how do I combine my Maven intelligence with Context7's documentation power?
The Challenge: Two Great Tools, One Workflow
Both my Maven Tools MCP server and Context7 solve important but different problems:
Maven Tools MCP: "Here are your dependency versions, health scores, and upgrade recommendations"
Context7: "Here's up-to-date documentation for any library you specify"
The traditional approach would be to directly integrate Context7 functionality into my Maven tools. But that felt wrong - it would create tight coupling, duplicate functionality, and make my server more complex.
So, I went with something I call guided delegation, where instead of tightly coupling Maven analysis with documentation retrieval, we separate the two concerns while enabling intelligent orchestration:
- Maven Analysis: My tools analyse dependencies and detect upgrade scenarios
- Context7 Guidance Hints: When complex upgrades are identified, include explicit step-by-step orchestration instructions that tell the AI exactly which tools to call and in what order
- Tool calling: The AI assistant uses these hints to make targeted Context7 queries and/or web searches
- Dual MCP Architecture: My server acts as both MCP server (exposing Maven tools) and MCP client (exposing Context7 tools)
This creates a seamless user experience while keeping oth tools focused on what they do best.
Implementation: Dual MCP Architecture with Spring AI
The technical implementation is surprisingly simple, thanks to Spring AI's MCP client starter:
Spring AI Configuration Does Everything
The magic happens entirely in the application.yaml
configuration:
spring:
ai:
mcp:
client:
enabled: true # Enable MCP client
type: SYNC
request-timeout: 15s
toolcallback:
enabled: true # Automatically expose Context7 tools!
sse:
connections:
context7:
url: https://mcp.context7.com
sse-endpoint: /sse
# Context7 guidance hints - lightweight suggestions in response models
context7:
enabled: true # Set to false to disable Context7 features
That's it! Spring AI automatically:
- Connects to Context7 via Server-Sent Events (SSE)
-
Exposes Context7 tools (
resolve-library-id
,get-library-docs
) as if they were your own MCP tools, making them available alongside your Maven tools
Maven Tools with Guidance Hints
Your Maven analysis tools automatically include Context7 guidance hints in their JSON responses when enabled:
@Service
public class MavenDependencyTools {
private final Context7Properties context7Properties;
@Tool(description = "Compare current dependency versions with latest available and provide
upgrade recommendations with migration guidance.")
public ToolResponse compare_dependency_versions(
@ToolParam(description = "Comma or newline separated list of dependency coordinates WITH
versions in format 'groupId:artifactId:version'")
String currentDependencies,
@ToolParam(description = "When true, only suggests upgrades to stable versions for production
safety", required = false)
boolean onlyStableTargets) {
return executeToolOperation(() -> {
...
// Context7 guidance automatically included via model factory methods
VersionComparison.UpdateSummary summary = calculateUpdateSummary(results);
return new VersionComparison(Instant.now(), results, summary);
});
}
}
The guidance hints are embedded in your response model classes (like VersionComparisonResponse.DependencyComparisonResult.success()
) - no separate Context7 service needed!
This dual architecture means:
- Your AI assistant connects to ONE MCP server (Maven Tools)
- Gets 10 total tools: 8 Maven analysis tools + 2 Context7 documentation tools (via Spring AI toolcallback)
- Zero additional setup - Context7 integration is enabled by default
- Intelligent orchestration through guidance hints + direct tool access
How It Works in Practice
Let me show you what changed with some real examples:
Before (v1.1.0): Basic Upgrade Detection
User: "Compare my current Spring Boot version with the latest"
Maven Tools Response:
{
"dependency": "org.springframework.boot:spring-boot-starter:2.7.0",
"latest_version": "3.2.0",
"update_type": "major",
"update_available": true
}
After (v1.3.0): Smart Documentation Guidance + Direct Tools
User: "Compare my current Spring Boot version with the latest"
Maven Tools Response:
{
"dependency": "org.springframework.boot:spring-boot-starter:2.7.0",
"latest_version": "3.2.0",
"update_type": "major",
"update_available": true,
"context7_guidance": {
"orchestration_instructions": "Use resolve-library-id tool with
libraryName='spring-boot-starter' to find documentation ID. Then use get-library-docs tool with the
returned Context7 ID and topic='migration guide' to get upgrade instructions. If Context7 doesn't
provide sufficient information, perform a web search for 'spring-boot-starter major version upgrade
guide'."
}
}
Now the AI assistant has everything it needs:
- Maven analysis results from the dependency comparison
- Intelligent hints for effective Context7 usage
-
Direct access to Context7 tools (
resolve-library-id
,get-library-docs
)
The Magic: Contextual Documentation
The guidance hints adapt based on what the dependency analysis finds:
For dependencies that haven't been updated in months:
{
"context7_guidance": {
"orchestration_instructions": "Use resolve-library-id tool with libraryName='hibernate-core' to
find documentation ID. Then use get-library-docs tool with the returned Context7 ID and
topic='upgrade best practices' to get modernization guidance. If Context7 doesn't provide
sufficient information, perform a web search for 'hibernate-core latest version best practices'."
}
}
For major version jumps:
{
"context7_guidance": {
"orchestration_instructions": "Use resolve-library-id tool with libraryName='jackson-core' to
find documentation ID. Then use get-library-docs tool with the returned Context7 ID and
topic='migration breaking changes' to get upgrade instructions. If Context7 doesn't provide
sufficient information, perform a web search for 'jackson-core major version migration guide'."
}
}
Setup: Simpler Than Expected
The best part? Since v1.3.0 includes Context7 integration by default, you don't need separate Context7 setup.
For Claude Desktop
Just add this to your configuration:
{
"mcpServers": {
"maven-tools": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "SPRING_PROFILES_ACTIVE=docker",
"arvindand/maven-tools-mcp:latest"
]
}
}
}
Real-World Example: The Complete Workflow
Here's what a complete upgrade conversation looks like now:
Developer: "Should I upgrade Spring Boot from 2.7.0 to latest and how?"
AI Assistant (using Maven Tools automatically):
"Spring Boot 3.2.0 is available - that's a major upgrade from your 2.7.0.
This will involve breaking changes. Let me get the specific migration guide..."
AI Assistant (using Context7 tools automatically):
"Here's the official Spring Boot 3.2 migration guide with current examples:
Key changes you'll need to handle:
- Java 17+ requirement
- Jakarta EE namespace migration (javax.* → jakarta.*)
- Configuration property changes
- Security configuration updates
[Up-to-date code examples and step-by-step migration steps follow...]"
The developer gets both analytical intelligence and practical guidance in one seamless conversation.
Some Insights
1. Compose, Don't Integrate
Instead of building one server that does everything, build focused servers that work together through smart hints and intelligent orchestration.
2. AI Assistants Are Excellent Orchestrators
State-of-the-art models excel at understanding context and calling the right tools in sequence. Provide them with good hints and they'll manage complex workflows seamlessly.
3. Explicit Instructions Beat Hints
Generic hints like "search for docs" aren't reliable. Explicit orchestration instructions like "Use resolve-library-id tool with libraryName='spring-boot-starter'" combined with fallback strategies create much more consistent outcomes.
What's Next?
This guided delegation pattern feels applicable to other developer workflow scenarios:
- Security analysis: Maven vulnerability detection with smart hints for CVE databases and patch documentation
- Performance monitoring: Dependency analysis with suggestions for APM documentation based on detected issues
- Cloud migration: Framework analysis with intelligent hints for AWS/Azure migration guides
- Code quality: Static analysis with targeted suggestions for best practice documentation
Try It Out
If you're already using my Maven Tools MCP server, getting the Context7 features is automatic - just restart your MCP client (Claude Desktop/VSCode) and it should pull the latest v1.3.0 image. If not, delete the Docker image and restart to force a fresh pull.
The integrated experience has been genuinely helpful for my daily development work. Having both dependency intelligence and current documentation in one conversation eliminates a lot of context switching.
Let Me Know How It Works
I'm still refining this guided delegation approach. If you try the Context7 integration, I'd be curious to hear:
- How well the automatic guidance hints work for your scenarios?
- What other development workflows could benefit from similar orchestration?
You can reach me at github.com/arvindand/maven-tools-mcp with feedback or questions.
About the Author: I'm Arvind, a backend developer based in Karlsruhe, Germany, passionate about Spring Boot, AI integration, and developer productivity tools. You can find me on GitHub or LinkedIn.
Top comments (0)