A Model Context Protocol (MCP) server that provides access to Javadocs and KDocs from Maven Central. This server allows AI agents to search, download, and query Java and Kotlin library documentation efficiently.
- π Search Maven Central - Find any Java or Kotlin library available on Maven Central
- π¦ Smart Caching - Downloads javadocs to local
.m2repository, only fetches if not cached - π― Granular Access - Multiple tools for broad searches and specific documentation queries
- β‘ Fast & Async - Built with async/await for optimal performance
- π οΈ Comprehensive Toolset - 9 specialized tools for different documentation needs
- π¨ Kotlin/Dokka Support - Full support for Kotlin documentation in Dokka format
- π Transparent Format Handling - Works seamlessly with both traditional Javadoc and Kotlin Dokka
- search_artifact - Search for Java libraries on Maven Central
- download_javadoc - Download and cache javadoc for a specific version
- list_packages - List all packages in a library
- list_classes - List all classes/interfaces in a package or library
- get_class_documentation - Get full documentation for a specific class
- get_method_documentation - Get documentation for a specific method
- get_package_summary - Get package-level documentation
- search_in_javadoc - Search for terms across all javadoc files
- More granular queries as needed
# Install uv if you haven't already
curl -LsSf https://astral.sh/uv/install.sh | sh
# Clone the repository
git clone <your-repo-url>
cd javadoc-mcp
# Install dependencies
uv pip install -e .
# For development
uv pip install -e ".[dev]"pip install -e .python main.pyOr make it executable:
chmod +x main.py
./main.pySearch for a library:
search_artifact(query="jackson-core", max_results=5)
# Or search for Kotlin libraries
search_artifact(query="ktor-client", max_results=5)Download javadoc:
# Java library
download_javadoc(
group_id="com.fasterxml.jackson.core",
artifact_id="jackson-core",
version="2.15.0"
)
# Kotlin library (automatically handles Dokka format)
download_javadoc(
group_id="io.ktor",
artifact_id="ktor-client-core",
version="3.3.1"
)List packages:
list_packages(
group_id="com.fasterxml.jackson.core",
artifact_id="jackson-core",
version="2.15.0"
)List classes in a package:
# Works with both Java and Kotlin libraries
list_classes(
group_id="io.ktor",
artifact_id="ktor-client-core",
version="3.3.1",
package="io.ktor.client"
)Get class documentation:
# Java class
get_class_documentation(
group_id="com.fasterxml.jackson.core",
artifact_id="jackson-core",
version="2.15.0",
class_name="com.fasterxml.jackson.core.JsonParser"
)
# Kotlin class (Dokka format handled automatically)
get_class_documentation(
group_id="io.ktor",
artifact_id="ktor-client-core",
version="3.3.1",
class_name="io.ktor.client.HttpClient"
)Search within javadoc:
search_in_javadoc(
group_id="com.fasterxml.jackson.core",
artifact_id="jackson-core",
version="2.15.0",
search_term="parse",
max_results=10
)The server uses the following directories:
- Maven Repository:
~/.m2/repository- Standard Maven local repository - Cache Directory:
~/.javadoc-mcp-cache- Additional cache for server metadata
These directories are created automatically on first run.
This server transparently handles both Java Javadoc and Kotlin Dokka documentation formats:
- Traditional Javadoc: Standard HTML format with nested directory structure (
com/example/Class.html) - Kotlin Dokka: Modern documentation format with:
- Module-based organization
- URL-encoded filenames (e.g.,
-http-client.htmlforHttpClient) - Package directories using literal dots (e.g.,
io.ktor.client/) - Rich HTML with enhanced navigation
The server automatically detects the format and extracts class names from HTML <title> tags, ensuring accurate results regardless of the documentation format.
- Check if extracted - If javadoc is already extracted, use cached version
- Check if JAR exists - If javadoc JAR exists but not extracted, extract it
- Download from Maven Central - Only download if not present locally
This ensures minimal network usage and fast response times for repeated queries.
Javadocs are stored following Maven's standard structure:
~/.m2/repository/
βββ {group.id.path}/
βββ {artifact-id}/
βββ {version}/
βββ {artifact-id}-{version}-javadoc.jar
βββ javadoc-extracted/
βββ [extracted javadoc HTML files]
pytest# Format code
black .
# Lint code
ruff check .
# Type checking
mypy .javadoc-mcp/
βββ main.py # Main MCP server implementation
βββ pyproject.toml # Project configuration and dependencies
βββ README.md # This file
βββ tests/ # Test suite (to be added)
- Python 3.10 or higher
- Internet connection (for downloading javadocs)
- ~100MB disk space per library (for cached javadocs)
- fastmcp >= 2.0.0 - MCP server framework
- httpx >= 0.27.0 - Async HTTP client
- beautifulsoup4 >= 4.12.0 - HTML parsing
- lxml >= 5.0.0 - XML/HTML parser
- aiofiles >= 23.0.0 - Async file operations
MIT License - See LICENSE file for details
Contributions are welcome! Please feel free to submit a Pull Request.
Some artifacts may not have javadoc JARs published. Try searching for a different version or artifact.
Check your internet connection and verify the artifact exists on Maven Central at https://search.maven.org/
Ensure you have write permissions to ~/.m2/repository directory.
Kotlin libraries use Dokka format which has a different structure than traditional Javadoc:
- Class names are extracted from HTML
<title>tags, not filenames - Filenames use URL encoding (e.g.,
-http-client.htmlforHttpClient) - Package directories use literal dots instead of slashes
- The server handles this automatically - no special configuration needed
If you encounter issues with Kotlin libraries, verify the artifact name and version on Maven Central, as some Kotlin libraries may publish documentation under different artifact IDs. Check your internet connection and verify the artifact exists on Maven Central at https://search.maven.org/
Ensure you have write permissions to ~/.m2/repository directory.