Sponsored by Deepsite.site

Javadoc Mcp

Created By
loong954 days ago
让 AI 助手能够通过 Maven 坐标浏览 JavaDoc 文档
Overview

javadoc-mcp

一个 MCP (Model Context Protocol) 服务器,让 AI 助手能够通过 Maven 坐标浏览 JavaDoc 文档。

功能

提供 5 个 MCP tools,支持逐层浏览 JavaDoc:

Tool说明
list_packages列出库中所有包
list_classes列出包中所有类、接口、枚举、注解
get_class获取类概览文档(签名、描述、成员摘要)
get_member获取方法/字段的完整文档(参数、返回值、异常等)
search按关键词搜索类型、成员或包

运行要求

  • Node.js 18+
  • Maven (mvn 需要在 PATH 中可用)

服务会优先读取本地 Maven 仓库中的 JavaDoc JAR;如果缺失,则通过 mvn dependency:get 拉取对应的 -javadoc.jar

安装

方式一:直接通过 npx 使用

npx -y javadoc-mcp

方式二:全局安装

npm install -g javadoc-mcp

安装完成后,可直接运行:

javadoc-mcp

配置 MCP 客户端

Claude Code

推荐直接通过 npx 启动,这样不需要手动管理安装路径:

编辑 ~/.claude/settings.json

{
  "mcpServers": {
    "javadoc": {
      "command": "npx",
      "args": ["-y", "javadoc-mcp"]
    }
  }
}

如果你已经全局安装,也可以写成:

{
  "mcpServers": {
    "javadoc": {
      "command": "javadoc-mcp",
      "args": []
    }
  }
}

Claude Desktop

编辑 claude_desktop_config.json

{
  "mcpServers": {
    "javadoc": {
      "command": "npx",
      "args": ["-y", "javadoc-mcp"]
    }
  }
}

从源码开发

npm install
npm run build

构建产物输出到 dist/ 目录。

调试

使用 MCP Inspector 进行交互式测试:

npx @modelcontextprotocol/inspector node dist/index.js

使用示例

典型的浏览流程:

1. list_packages(groupId="org.apache.commons", artifactId="commons-lang3", version="3.14.0")
   → 获取所有包名

2. list_classes(..., packageName="org.apache.commons.lang3")
   → 查看包中的类列表

3. get_class(..., className="org.apache.commons.lang3.StringUtils")
   → 查看 StringUtils 类的概览和方法摘要

4. get_member(..., className="org.apache.commons.lang3.StringUtils", memberName="join")
   → 查看 join 方法的完整文档

5. search(..., query="String", category="type")
   → 搜索名称含 "String" 的类型

本地仓库

JavaDoc JAR 直接使用 Maven 本地仓库中的文件,默认路径为 ~/.m2/repository。如果 ~/.m2/settings.xml 中配置了 <localRepository>,则使用该路径。

如需重新拉取某个文档,可删除对应坐标下的 *-javadoc.jar 后再次调用工具。

技术栈

  • TypeScript (ES Modules)
  • @modelcontextprotocol/sdk — MCP 协议实现
  • cheerio — HTML 解析
  • adm-zip — 直接从 JAR 读取文件,不解压到磁盘
  • zod — 参数校验

Server Config

{
  "mcpServers": {
    "javadoc": {
      "command": "npx",
      "args": [
        "-y",
        "javadoc-mcp"
      ]
    }
  }
}
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
RedisA Model Context Protocol server that provides access to Redis databases. This server enables LLMs to interact with Redis key-value stores through a set of standardized tools.
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Amap Maps高德地图官方 MCP Server
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
ChatWiseThe second fastest AI chatbot™
WindsurfThe new purpose-built IDE to harness magic
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
DeepChatYour AI Partner on Desktop
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Tavily Mcp
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Y GuiA web-based graphical interface for AI chat interactions with support for multiple AI models and MCP (Model Context Protocol) servers.
CursorThe AI Code Editor
Playwright McpPlaywright MCP server
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
Serper MCP ServerA Serper MCP Server