Yanick-Salzmann/mvn-repository-mcp-server
If you are the rightful owner of mvn-repository-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
A Model Context Protocol (MCP) server for interacting with Maven artifacts from mvnrepository.com and Maven Central.
Maven Repository MCP Server
A Model Context Protocol (MCP) server that provides comprehensive functionality to search and interact with Maven artifacts from mvnrepository.com and Maven Central.
š Features
- Search Maven Artifacts: Find Maven artifacts by keyword with detailed results
- Version Management: Retrieve all available versions for any artifact
- Dependency Management: Get ready-to-use dependency snippets for Maven, Gradle, and SBT
- POM Access: Fetch complete POM.xml files directly from Maven Central
- Multiple Transports: Support for both stdio and SSE (Server-Sent Events) protocols
- Rate Limiting: Built-in intelligent rate limiting to respect mvnrepository.com
š Prerequisites
- Node.js 18+
- npm or yarn package manager
š ļø Installation & Setup
-
Clone and install dependencies:
git clone <repository-url> cd mvn-repository-mcp-server npm install
-
Build the project:
npm run build
-
Run the server:
npm start
š Usage
Transport Protocols
The server supports two communication protocols:
stdio Transport (Default)
Perfect for local development and MCP client integration:
# Using npm scripts
npm run start:stdio
npm run dev:stdio
# Direct execution
node dist/index.js stdio
node dist/index.js # stdio is default
SSE Transport
Ideal for web-based clients and HTTP integration:
# Using npm scripts (port 3000)
npm run start:sse
npm run dev:sse
# Direct execution
node dist/index.js sse
node dist/index.js sse --port 8080 # custom port
SSE Endpoints:
- SSE stream:
http://localhost:<port>/sse
- Message posting:
http://localhost:<port>/message
Available Tools
1. search_maven_artifacts
Search for Maven artifacts using keywords.
Parameters:
query
(string, required): Search term for Maven artifactsmaxResults
(number, optional): Maximum results to return (default: 10)
Example:
{
"name": "search_maven_artifacts",
"arguments": {
"query": "spring-boot-starter",
"maxResults": 5
}
}
2. get_artifact_versions
Retrieve all available versions for a specific artifact.
Parameters:
groupId
(string, required): Maven group ID (e.g., 'org.springframework.boot')artifactId
(string, required): Maven artifact ID (e.g., 'spring-boot-starter')
Example:
{
"name": "get_artifact_versions",
"arguments": {
"groupId": "junit",
"artifactId": "junit"
}
}
3. get_pom_xml
Fetch the complete POM.xml file for a specific artifact version.
Parameters:
groupId
(string, required): Maven group IDartifactId
(string, required): Maven artifact IDversion
(string, required): Specific version
Example:
{
"name": "get_pom_xml",
"arguments": {
"groupId": "org.apache.commons",
"artifactId": "commons-lang3",
"version": "3.12.0"
}
}
4. get_dependency_snippets
Generate dependency declarations for Maven, Gradle, and SBT.
Parameters:
groupId
(string, required): Maven group IDartifactId
(string, required): Maven artifact IDversion
(string, required): Specific version
Example:
{
"name": "get_dependency_snippets",
"arguments": {
"groupId": "com.fasterxml.jackson.core",
"artifactId": "jackson-core",
"version": "2.15.2"
}
}
š§ Development
Available Scripts
npm run build
- Compile TypeScript to JavaScriptnpm run build:watch
- Watch mode compilationnpm run start
- Run compiled server (stdio transport)npm run start:stdio
- Explicitly use stdio transportnpm run start:sse
- Use SSE transport (port 3000)npm run dev:stdio
- Build and run with stdionpm run dev:sse
- Build and run with SSEnpm run clean
- Remove compiled files
Project Structure
mvn-repository-mcp-server/
āāā src/
ā āāā index.ts # Main server entry point & CLI
ā āāā types.ts # TypeScript interfaces
ā āāā searcher.ts # Core search & retrieval logic
āāā dist/ # Compiled JavaScript output
āāā package.json # Project configuration
āāā tsconfig.json # TypeScript configuration
āāā README.md # This file
šÆ Use Cases
For AI Assistants
- Dependency Discovery: Help users find appropriate Maven dependencies
- Version Management: Assist with dependency version selection and updates
- Build File Generation: Generate dependency blocks for different build tools
- Security Analysis: Identify artifacts with known vulnerabilities
For Developers
- Quick Search: Rapidly find Maven artifacts without opening a browser
- Dependency Analysis: Examine POM files and dependency structures
- Multi-Build Support: Get snippets for Maven, Gradle, and SBT simultaneously
- Version Comparison: Compare different versions of the same artifact
Integration Examples
With AI Coding Assistants:
User: "Find me the latest Spring Boot starter for web development"
Assistant: Uses search_maven_artifacts ā "spring-boot-starter-web"
Assistant: Uses get_dependency_snippets ā Provides Maven/Gradle configs
For Dependency Updates:
User: "Check if there are newer versions of JUnit available"
Assistant: Uses get_artifact_versions ā Lists all JUnit versions with dates
Assistant: Highlights latest stable version and any security considerations
āļø Configuration
Rate Limiting
The server includes intelligent rate limiting to respect mvnrepository.com:
- Minimum 3 seconds between requests
- Additional random delay of 2-6 seconds
- Automatic retry with exponential backoff on 403 errors
Timeout Settings
- Default request timeout: 30 seconds
- Maven Central POM requests: 15 seconds
- Maximum of 3 retry attempts for failed requests
š Troubleshooting
Common Issues
403 Access Denied Errors:
- The server implements rate limiting to prevent this
- If encountered, the server will automatically retry with backoff
- Consider reducing request frequency if issues persist
Network Timeouts:
- Check internet connectivity
- Verify mvnrepository.com accessibility
- Consider firewall or proxy settings
SSE Connection Issues:
- Ensure the specified port is available
- Check firewall settings for the chosen port
- Verify no other services are using the same port
Debug Mode
Set environment variable for verbose logging:
DEBUG=mvn-repository-mcp-server npm start
š¤ Contributing
Contributions are welcome! Please feel free to submit issues, feature requests, or pull requests.
Development Setup
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
š License
This project is licensed under the MIT License - see the LICENSE file for details.