
Maven Decoder
io.github.salitaba由 GitHub 帳號 salitaba 發布v1.3.2更新於 Oct 25, 2026
Lets AI agents read the real source of any Maven dependency, decompiled from ~/.m2 or Central.
概覽
在本機執行的 MCP 伺服器,讓 AI 助理讀取、反編譯並比較本機 Maven 儲存庫或 Maven Central 中的相依 jar。
- 可以做什麼
- 列出、搜尋並檢查本機 Maven 儲存庫中的構件與類別,包括 jar 結構、中繼資料、類別簽章、欄位與方法,以及 .proto 等文字資源。擷取並反編譯 Java 原始碼,在沒有 sources jar 時改用 javap。分析相依關係:POM 相依、完整相依樹、被相依項目與版本衝突。比較兩個版本並列出公開 API 差異與破壞性變更,在編譯後的位元組碼中找出類別或方法的真實呼叫端。搜尋 Maven Central、列出已發佈版本,並把構件下載到獨立快取。
- 適用情境
- 適合 Java 與 JVM 開發情境:在升級相依套件前確認會破壞什麼、了解不熟悉的 API、尋找真實呼叫範例,或檢查沒有 sources jar 的內部構件,讓助理閱讀真實程式碼而不是憑記憶回答。
- 執行需求
- 透過 npx 或 uvx(或 Docker)以 stdio 在本機執行。反編譯需要 Java 8+,需要本機 Maven 儲存庫(預設 ~/.m2/repository),以及 Python 3.8+ 或 Node.js 14+。預設啟用網路;選用設定包括 MAVEN_REPOSITORY、MAVEN_OFFLINE、MAVEN_AUTO_DOWNLOAD、MAVEN_REMOTE_REPOS、MAVEN_REMOTE_USERNAME,以及私有鏡像用的 MAVEN_REMOTE_PASSWORD。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Maven Decoder,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
Maven Decoder MCP Server
Your agent guesses at library APIs it has never read. This makes it read them.
Lets AI agents read the actual source of any Maven dependency — decompiles jars from
~/.m2 or Maven Central, and diffs versions for breaking changes.
[Demo: comparing jsoup 1.17.2 with 1.23.2]
Ask an agent "I'm upgrading org.jsoup:jsoup from 1.17.2 to 1.23.2 — what breaks?" and
without a way to read the jars it will answer from memory. With this server,
compare_versions reads both jars and reports what actually changed:
Members are compared as declared, so one that moved to a supertype is reported as removed even though it may still be callable. The tool states this in its own output.
It works on artifacts that have no sources jar too: extract_class_info falls back
to javap and returns parsed fields, methods, and bytecode version — which is exactly
the case for the internal artifacts in a corporate Nexus.
Try it in one command
That installs the maven-code-search agent skill, which tells your agent when to reach
for these tools. For a raw MCP server setup instead, see Installation.
🚀 Features
Core Functionality
- Jar File Analysis: Deep inspection of jar files including metadata, manifests, and structure
- Dependency Resolution: Complete dependency tree analysis with transitive dependencies
- Source Code Extraction: Extract source code from source jars or decompile bytecode
- Class Information: Detailed class signatures, methods, fields, and annotations
- Search Capabilities: Find classes, methods, and dependencies across all artifacts
- Version Management: Compare versions, find dependents, and track version conflicts
Online Maven Support
- Maven Central Search: Find artifacts and classes that are not installed locally
- Remote Version Listing: See every published version, not just the ones you have
- On-Demand Download: Fetch any artifact (jar, sources, POM) into a local cache
- Transparent Fallback: Every analysis tool automatically downloads a missing artifact, so decompiling a dependency you never installed just works
- Mirror Friendly: Point it at a corporate Nexus/Artifactory, with optional credentials
- Offline Mode: A single env var restores fully local, network-free behavior
Advanced Features
- Decompilation Support: Integrated support for multiple Java decompilers (CFR, Fernflower, Procyon)
- Conflict Analysis: Detect and analyze dependency version conflicts
- Repository Navigation: Browse and explore the local Maven repository structure
- Metadata Parsing: Extract and parse Maven POM files and metadata
- Service Discovery: Find and analyze Java services and SPI implementations
- Response Management: Intelligent pagination and summarization for large responses
- Method Extraction: Extract specific methods from large Java classes
- Integrity Checking: Downloads are verified against the repository's SHA-1 checksums
📦 Installation
Prerequisites
- Java 8+ (for decompilation features)
- Maven local repository (
~/.m2/repository) - One of: Python 3.8+, Node.js 14+, or Docker
🚀 Quick Install
One-Line Install (Recommended)
📋 Installation Methods
Method 1: uvx (Recommended)
Method 2: Node.js/npm
Method 3: Docker
Method 4: From Source (Development)
Windows
For a source checkout, use Python 3.10 or newer and a JDK on PATH. From the
repository root, create and activate a virtual environment in PowerShell:
In Command Prompt (cmd.exe), activate with .venv\Scripts\activate.bat and set
the repository with set "MAVEN_REPOSITORY=F:\data\repository" instead. These
environment settings apply to programs launched from that terminal; set them in
your MCP client's environment when it launches the server separately.
Remote downloads use a separate cache, resolved in this order (empty values are skipped):
MAVEN_DECODER_CACHE_DIR: the complete cache directory; no subdirectory is appended.XDG_CACHE_HOME: appendmaven-decoder-mcp\repository.LOCALAPPDATA: appendmaven-decoder-mcp\repository.- Otherwise,
~/.cache/maven-decoder-mcp/repositoryunder your home directory.
On Windows, this usually means %LOCALAPPDATA%\maven-decoder-mcp\repository;
XDG_CACHE_HOME still takes precedence if set. The cache uses Maven's directory
layout but stays separate from the real local repository so downloads do not
interfere with Maven builds. Setting MAVEN_REPOSITORY does not change the cache
location.
🔧 Configuration
For Cursor IDE
Add to your ~/.cursor/mcp_servers.json:
For Other MCP Clients
The server runs as a standard MCP server and can be integrated with any MCP-compatible client.
🧠 AI Agent Skill
This repository includes a maven-code-search agent skill that tells AI coding agents when and how to use this MCP for searching installed Maven package code.
The skill is located at skills/maven-code-search and is ready for skills.sh indexing after the repository is pushed.
🛠️ Available Tools
Local Analysis
Online (Maven Central)
Tool parameters
* Required — the parameter appears in the tool's inputSchema required array. Parameters without a * are optional and may be omitted.
💡 Usage Examples
Finding Dependencies
Decompiling Classes
Analyzing Conflicts
Checking an Upgrade for Breaking Changes
compare_versions diffs the public and protected members of every class the
two versions share, and reports removals separately from additions. Removed
members and removed classes are counted as breaking changes. Members are
compared as declared, so one that moved to a supertype is reported as
removed even though it may still be callable.
Exploring APIs
Finding Real Callers
find_usage_examples scans compiled class constant pools, so it finds real callers
rather than simple name matches. Pass method_name (such as readValue) to narrow
the results to callers of a specific method. Test jars are included by default and
ranked first because they often contain the clearest examples; set search_tests to
false to exclude them. The scan stops after MCP_USAGE_SCAN_LIMIT classes (default:
200000) to stay responsive on large repositories.
Inspecting Compiled-Only Artifacts
When a dependency has no sources jar, extract_class_info uses javap internally and returns parsed fields, methods, bytecode version, and optional verbose bytecode output. Agents should use analyze_jar, extract_class_info, extract_source_code, and extract_jar_resource through this MCP instead of running jar or javap directly.
Working with Large Responses
Searching Maven Central (Online)
🌐 Online Maven Support
The server works against the local repository and remote repositories. Online access is enabled by default.
How it works
- Every tool first looks in your local repository (
~/.m2/repository). - On a miss, the artifact is downloaded from Maven Central into a cache
(
~/.cache/maven-decoder-mcp/repository) that uses the standard Maven layout. - All existing analysis (decompilation, class info, dependencies) then runs on the cached artifact exactly as it would on an installed one.
The cache is deliberately separate from ~/.m2 so downloads never interfere
with your Maven or Gradle builds. Responses include an origin field
(local-repository or remote-cache) so you always know where a result came from.
Going offline
Using a private mirror
A note on the search index
Artifact downloads use repo1.maven.org, which is fast and reliable.
Artifact search uses search.maven.org, the only public index that answers
class-level (c: / fc:) queries correctly. That index rate-limits bursts, so
requests are retried with backoff; a busy period can still surface as a timeout.
Downloads and version listing are unaffected, because they read
maven-metadata.xml directly from the repository.
🔄 Response Management
Pagination Support
The server automatically handles large responses through intelligent pagination:
- Automatic Detection: Responses exceeding 50KB are automatically paginated
- Configurable Page Size: Default 20 items per page, customizable per request
- Pagination Metadata: Each response includes pagination information
- Supported Tools:
list_artifacts,extract_class_info,search_classes,get_dependencies,find_dependents,get_version_info
Summarization Features
Large text content is automatically summarized to improve readability:
- Smart Summarization: Preserves important parts (package declarations, method signatures, closing braces)
- Configurable Limits: Default 10KB text limit, customizable
- Java-Specific: Optimized for Java source code structure
- Metadata Preservation: Original structure and metadata are maintained
Method Extraction
New tool for targeted access to specific methods:
- Pattern Matching: Use regex patterns to find specific methods
- Limited Results: Control the number of methods returned
- Full Context: Includes method signatures, bodies, and line numbers
- Efficient Processing: Only extracts requested methods, not entire classes
🏗️ Architecture
The server is built with a modular architecture:
MavenDecoderServer: Main MCP server implementationResponseManager: Handles pagination and summarizationJavaDecompiler: Handles multiple decompilation strategiesMavenDependencyAnalyzer: Analyzes Maven dependencies and metadataMavenCentralClient: Remote search, version listing, and artifact downloads- Decompilers: CFR, Procyon, Fernflower, and javap integration
🧪 Development
Running Tests
Building Package
Docker Development
📝 Configuration Options
Environment Variables
Local repository
MAVEN_REPOSITORY/MAVEN_REPO: direct path to local Maven repository (e.g.F:\data\repository). Highest precedence.MAVEN_HOME/M2_HOME: Maven install dir or repository dir. A nestedrepository/subdir wins when it exists;conf/settings.xml<localRepository>honored.~/.m2/settings.xml<localRepository>honored when no env var set. Fallback:~/.m2/repository.
Online access
MAVEN_OFFLINE: set totrueto disable all network access (default:false)MAVEN_AUTO_DOWNLOAD: auto-fetch artifacts missing locally (default:true)MAVEN_REMOTE_REPOS/MAVEN_REMOTE_REPO: comma/space separated repository base URLs (default:https://repo1.maven.org/maven2)MAVEN_SEARCH_URL: comma/space separated Solr search endpoints (default:https://search.maven.org/solrsearch/select)MAVEN_DECODER_CACHE_DIR: where downloaded artifacts are cached (default:~/.cache/maven-decoder-mcp/repository)MAVEN_REMOTE_USERNAME/MAVEN_REMOTE_PASSWORD: basic-auth credentials for a private mirrorMAVEN_HTTP_TIMEOUT: per-request timeout in seconds (default: 30)MAVEN_HTTP_RETRIES: retries for transient network failures (default: 3)MAVEN_MAX_DOWNLOAD_SIZE: maximum download size in bytes (default: 104857600)MAVEN_VERIFY_CHECKSUM: verify downloads against published SHA-1 (default:true)
Responses
MCP_LOG_LEVEL: Logging level (DEBUG, INFO, WARNING, ERROR)MCP_MAX_RESPONSE_SIZE: Maximum response size in bytes (default: 50000)MCP_MAX_ITEMS_PER_PAGE: Default items per page (default: 20)MCP_MAX_TEXT_LENGTH: Maximum text length before summarization (default: 10000)MCP_MAX_LINES: Maximum lines before summarization (default: 500)MCP_USAGE_SCAN_LIMIT: Max classes scanned byfind_usage_examples(default: 200000)MCP_API_DIFF_LIMIT: Max classes compared bycompare_versions(default: 2000)MAVEN_DECODER_DECOMPILER_DIR: Directory holdingcfr.jar/procyon-decompiler.jar
Advanced Configuration
The server automatically detects and configures:
- Maven repository location
- Available Java decompilers
- System capabilities
🔍 Troubleshooting
Common Issues
Server won't start
Decompilation fails
From a source checkout you can instead run ./setup_decompilers.sh, which downloads
CFR and Procyon into a decompilers/ directory beside the script, as
decompilers/cfr.jar and decompilers/procyon-decompiler.jar.
If maven-decoder-setup status reports no decompilers even though you have the jars,
they are somewhere the server does not look. It searches these roots in order, taking
the first match:
$MAVEN_DECODER_DECOMPILER_DIR, if setdecompilers/inside the installed packagedecompilers/beside the package — the source-checkout layout~/.cache/maven-decoder-mcp/decompilersdecompilers/in the current working directory- the current working directory itself
Your MCP client launches the server from an arbitrary working directory, so the last two are unreliable in practice. If your jars live anywhere else, point at them explicitly:
The directory must contain the jars under the exact names cfr.jar and
procyon-decompiler.jar. The value expands ~ and environment variables.
Without CFR or Procyon the server still works, falling back to javap from
the JDK for signatures, fields and methods.
No artifacts found
Maven Central search times out
The public search index rate-limits bursts of requests. Retries with backoff are built in, but during heavy throttling a search can still fail. Workarounds:
Downloads fail behind a proxy or firewall
🤝 Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- Model Context Protocol - The protocol that powers this server
- CFR - Java decompiler
- Procyon - Java decompiler
- Maven - Dependency management
📊 Stats
[GitHub Stars] [GitHub Forks] [PyPI Downloads] [npm Downloads] [Docker Pulls]
Made with ❤️ for the Java development community
來源:README.md,提交 931d5be
工具
0版本歷史
1- v1.3.2最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分