
索引本地 Maven 和 Gradle 缓存的 MCP 服务器,使 AI 代理能够从内部/私有 Java 依赖中搜索类、实现、方法签名和源代码。
概览
一个MCP服务器和CLI可以索引你的本地Maven仓库(~/.m2/repository)和Gradle缓存(~/.gradle/caches/modules-2/files-2.1),为AI代理提供工具,搜索Java类、方法签名和源代码——甚至包括公司内部包和不知名的公共库。 将以下配置添加到你的MCP客户端中: 它会自动下载并运行服务器的最新版本。它会自动检测你的 Maven 仓库位置(通常是 ~/.m2/repository)和 Gradle 缓存。 升级后,使用旧名称的客服会显示“工具未找到”,直到你重新选择加入: 或者列出你想要的:MAVEN_INDEXER_MCP_TOOLS=搜索,get_class,呼叫者。 其他内容保持不变——发布的包名仍然是 maven-indexer-mcp(仓库已改名为 maven-index),CLI 通过 maven-indexer-cli 二进制执行。 全局安装以直接终端使用: 然后使用 maven-indexer-cli explore ...
概述(AI 翻译)
一个MCP服务器和用于索引你本地Maven仓库(~/.m2/repository)和Gradle缓存的CLI
(~/.gradle/caches/modules-2/files-2.1)为人工智能代理提供搜索Java类、方法签名的工具,
以及源代码——即使是公司内部的软件包和不知名的公共库。
快速安装
将以下配置添加到你的MCP客户端中:
它会自动下载并运行最新版本的服务器。它会自动检测你的Maven仓库
位置(通常为~/.m2/repository)和Gradle缓存。
从maven-indexer-mcp 1.0.x升级
**破坏性变更:工具名称更改,且默认注册仅
explore。
升级后,使用旧名称的客服会显示“工具未找到”,直到你重新选择加入:
| 1.0.x 工具 | 现在 |
|---|---|
get_class_details |
get_class |
search_classes |
search |
search_artifacts |
search_artifacts |
search_implementations |
implementations |
refresh_index |
移除(索引自动同步;使用 maven-indexer-cli refresh-index]) |
| 其他所有 | 同名,但未默认注册 |
要恢复完整表面,设置:
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
Maven Index
An MCP server and CLI that indexes your local Maven repository (~/.m2/repository) and Gradle cache
(~/.gradle/caches/modules-2/files-2.1) to provide AI agents with tools to search for Java classes, method signatures,
and source code — even for internal company packages and non-well-known public libraries.
Quick Install
There are two ways to give an agent access to the index. Pick one, or use both:
- CLI + Agent Skill: for terminal coding agents (Claude Code, Codex, Gemini CLI, OpenCode, Cursor).
The agent runs
maven-indexer-clicommands, guided by themaven-indexerskill. No tool schemas sit in the context window, so it uses fewer tokens. - MCP server: for IDE-integrated agents (Cursor, Kiro, Windsurf, JetBrains, …). See MCP server.
CLI + Agent Skill
Install script (recommended)
One command installs maven-indexer-cli from npm and the maven-indexer skill for every coding
agent it detects:
curl -fsSL https://raw.githubusercontent.com/tangcent/maven-indexer-mcp/main/install.sh | bash
Requires Node.js 18+ and npm. Pass options after bash -s --:
curl -fsSL https://raw.githubusercontent.com/tangcent/maven-indexer-mcp/main/install.sh | bash -s -- --target claude,agents --index
| Option | Meaning |
|---|---|
--target |
Which agents get the skill: auto (detected agents, default), all, or a csv of claude, agents, cursor (see the skill directories). |
--location |
global (home directory, default) or local (current project). |
--dir |
Install the skill into this skills directory instead. |
--version |
maven-indexer-cli version to install (default latest). |
--skip-cli / --skip-skills |
Install only the skill / only the CLI. |
--index |
Build the index right after installing. |
Re-running the script upgrades both the CLI and the skill. Restart your agent (or start a new session) afterwards so it loads the skill.
Manual install: maven-indexer-cli
npm install -g maven-indexer-cli
maven-indexer-cli refresh-index # build the index once; later runs use `maven-indexer-cli sync`
Or run it without installing: npx -y maven-indexer-cli .
Install the skill with maven-indexer-cli
Once the CLI is installed, it can install the skill it ships with:
maven-indexer-cli skills install # every detected agent, global
安装
npx -y maven-indexer-mcp@latest配置
{
"mcpServers": {
"maven-indexer": {
"command": "npx",
"args": [
"-y",
"maven-indexer-mcp@latest"
]
}
}
}