maven-decoder-mcp 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- maven_decoder_mcp-1.0.0/LICENSE +21 -0
- maven_decoder_mcp-1.0.0/MANIFEST.in +10 -0
- maven_decoder_mcp-1.0.0/PKG-INFO +307 -0
- maven_decoder_mcp-1.0.0/README.md +261 -0
- maven_decoder_mcp-1.0.0/maven_decoder_mcp/__init__.py +35 -0
- maven_decoder_mcp-1.0.0/maven_decoder_mcp/config.py +108 -0
- maven_decoder_mcp-1.0.0/maven_decoder_mcp/decompiler.py +329 -0
- maven_decoder_mcp-1.0.0/maven_decoder_mcp/decompiler_paths.py +11 -0
- maven_decoder_mcp-1.0.0/maven_decoder_mcp/maven_analyzer.py +437 -0
- maven_decoder_mcp-1.0.0/maven_decoder_mcp/maven_decoder_server.py +829 -0
- maven_decoder_mcp-1.0.0/maven_decoder_mcp.egg-info/PKG-INFO +307 -0
- maven_decoder_mcp-1.0.0/maven_decoder_mcp.egg-info/SOURCES.txt +20 -0
- maven_decoder_mcp-1.0.0/maven_decoder_mcp.egg-info/dependency_links.txt +1 -0
- maven_decoder_mcp-1.0.0/maven_decoder_mcp.egg-info/entry_points.txt +3 -0
- maven_decoder_mcp-1.0.0/maven_decoder_mcp.egg-info/requires.txt +16 -0
- maven_decoder_mcp-1.0.0/maven_decoder_mcp.egg-info/top_level.txt +5 -0
- maven_decoder_mcp-1.0.0/pyproject.toml +84 -0
- maven_decoder_mcp-1.0.0/requirements.txt +8 -0
- maven_decoder_mcp-1.0.0/scripts/release.py +283 -0
- maven_decoder_mcp-1.0.0/setup.cfg +4 -0
- maven_decoder_mcp-1.0.0/setup_decompilers.sh +67 -0
- maven_decoder_mcp-1.0.0/start_server.sh +18 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Maven Decoder MCP
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
include README.md
|
|
2
|
+
include LICENSE
|
|
3
|
+
include requirements.txt
|
|
4
|
+
include setup_decompilers.sh
|
|
5
|
+
include start_server.sh
|
|
6
|
+
recursive-include src/maven_decoder_mcp/decompilers *.jar
|
|
7
|
+
recursive-include src/maven_decoder_mcp *.py
|
|
8
|
+
exclude test_*.py
|
|
9
|
+
exclude diagnose_*.py
|
|
10
|
+
exclude *.log
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: maven-decoder-mcp
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: MCP server for reading and decompiling Maven .m2 jar files with comprehensive Java project analysis
|
|
5
|
+
Author-email: Ali Tabatabaei <ali79taba@gmail.com>
|
|
6
|
+
Maintainer-email: Ali Tabatabaei <ali79taba@gmail.com>
|
|
7
|
+
License: MIT
|
|
8
|
+
Project-URL: Homepage, https://github.com/salitaba/maven-decoder-mcp
|
|
9
|
+
Project-URL: Documentation, https://github.com/salitaba/maven-decoder-mcp#readme
|
|
10
|
+
Project-URL: Repository, https://github.com/salitaba/maven-decoder-mcp.git
|
|
11
|
+
Project-URL: Bug Tracker, https://github.com/salitaba/maven-decoder-mcp/issues
|
|
12
|
+
Keywords: mcp,maven,java,decompiler,jar,analysis,cursor,ide
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
25
|
+
Classifier: Topic :: Software Development :: Debuggers
|
|
26
|
+
Classifier: Topic :: Software Development :: Disassemblers
|
|
27
|
+
Requires-Python: >=3.10
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
License-File: LICENSE
|
|
30
|
+
Requires-Dist: mcp>=1.0.0
|
|
31
|
+
Requires-Dist: pydantic>=2.0.0
|
|
32
|
+
Requires-Dist: xmltodict>=0.13.0
|
|
33
|
+
Requires-Dist: javatools>=1.4.0
|
|
34
|
+
Requires-Dist: py4j>=0.10.9
|
|
35
|
+
Requires-Dist: aiofiles>=23.0.0
|
|
36
|
+
Requires-Dist: pathspec>=0.11.0
|
|
37
|
+
Requires-Dist: requests>=2.25.0
|
|
38
|
+
Provides-Extra: dev
|
|
39
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
40
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
41
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
42
|
+
Requires-Dist: isort>=5.12.0; extra == "dev"
|
|
43
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
44
|
+
Requires-Dist: flake8>=6.0.0; extra == "dev"
|
|
45
|
+
Dynamic: license-file
|
|
46
|
+
|
|
47
|
+
# Maven Decoder MCP Server
|
|
48
|
+
|
|
49
|
+
A comprehensive Model Context Protocol (MCP) server for analyzing Maven jar files in your local repository (`~/.m2`). This server provides powerful tools for agentic coding assistance in Java projects, enabling AI agents to understand dependencies, analyze bytecode, extract source code, and navigate the Maven ecosystem.
|
|
50
|
+
|
|
51
|
+
## ๐ Features
|
|
52
|
+
|
|
53
|
+
### Core Functionality
|
|
54
|
+
- **Jar File Analysis**: Deep inspection of jar files including metadata, manifests, and structure
|
|
55
|
+
- **Dependency Resolution**: Complete dependency tree analysis with transitive dependencies
|
|
56
|
+
- **Source Code Extraction**: Extract source code from source jars or decompile bytecode
|
|
57
|
+
- **Class Information**: Detailed class signatures, methods, fields, and annotations
|
|
58
|
+
- **Search Capabilities**: Find classes, methods, and dependencies across all artifacts
|
|
59
|
+
- **Version Management**: Compare versions, find dependents, and track version conflicts
|
|
60
|
+
|
|
61
|
+
### Advanced Features
|
|
62
|
+
- **Decompilation Support**: Integrated support for multiple Java decompilers (CFR, Fernflower, Procyon)
|
|
63
|
+
- **Conflict Analysis**: Detect and analyze dependency version conflicts
|
|
64
|
+
- **Repository Navigation**: Browse and explore the local Maven repository structure
|
|
65
|
+
- **Metadata Parsing**: Extract and parse Maven POM files and metadata
|
|
66
|
+
- **Service Discovery**: Find and analyze Java services and SPI implementations
|
|
67
|
+
|
|
68
|
+
## ๐ฆ Installation
|
|
69
|
+
|
|
70
|
+
### Prerequisites
|
|
71
|
+
- Java 8+ (for decompilation features)
|
|
72
|
+
- Maven local repository (`~/.m2/repository`)
|
|
73
|
+
- One of: **Python 3.8+**, **Node.js 14+**, or **Docker**
|
|
74
|
+
|
|
75
|
+
### ๐ Quick Install
|
|
76
|
+
|
|
77
|
+
#### One-Line Install (Recommended)
|
|
78
|
+
```bash
|
|
79
|
+
curl -fsSL https://raw.githubusercontent.com/salitaba/maven-decoder-mcp/main/install.sh | bash
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### ๐ Installation Methods
|
|
83
|
+
|
|
84
|
+
#### Method 1: Python/pip (Recommended)
|
|
85
|
+
```bash
|
|
86
|
+
# Install the package
|
|
87
|
+
pip install maven-decoder-mcp
|
|
88
|
+
|
|
89
|
+
# Install MCP SDK
|
|
90
|
+
pip install "git+https://github.com/modelcontextprotocol/python-sdk.git"
|
|
91
|
+
|
|
92
|
+
# Run the server
|
|
93
|
+
maven-decoder-mcp
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
#### Method 2: Node.js/npm
|
|
97
|
+
```bash
|
|
98
|
+
# Install globally
|
|
99
|
+
npm install -g maven-decoder-mcp
|
|
100
|
+
|
|
101
|
+
# Or install locally
|
|
102
|
+
npm install maven-decoder-mcp
|
|
103
|
+
|
|
104
|
+
# Run the server
|
|
105
|
+
maven-decoder-mcp
|
|
106
|
+
# or if installed locally: npx maven-decoder-mcp
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
#### Method 3: Docker
|
|
110
|
+
```bash
|
|
111
|
+
# Pull and run
|
|
112
|
+
docker run --rm -it \
|
|
113
|
+
-v ~/.m2:/home/mcpuser/.m2 \
|
|
114
|
+
-v $(pwd):/workspace \
|
|
115
|
+
maven-decoder/mcp-server:latest
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
#### Method 4: From Source (Development)
|
|
119
|
+
```bash
|
|
120
|
+
# Clone repository
|
|
121
|
+
git clone https://github.com/salitaba/maven-decoder-mcp.git
|
|
122
|
+
cd maven-decoder-mcp
|
|
123
|
+
|
|
124
|
+
# Option 4a: Using Virtual Environment
|
|
125
|
+
python3 -m venv .venv
|
|
126
|
+
source .venv/bin/activate # On Windows: .venv\Scripts\activate
|
|
127
|
+
pip install -r requirements.txt
|
|
128
|
+
pip install "git+https://github.com/modelcontextprotocol/python-sdk.git"
|
|
129
|
+
./setup_decompilers.sh
|
|
130
|
+
|
|
131
|
+
# Option 4b: System-wide Installation
|
|
132
|
+
pip3 install -r requirements.txt
|
|
133
|
+
pip3 install "git+https://github.com/modelcontextprotocol/python-sdk.git"
|
|
134
|
+
./setup_decompilers.sh
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## ๐ง Configuration
|
|
138
|
+
|
|
139
|
+
### For Cursor IDE
|
|
140
|
+
Add to your `~/.cursor/mcp_servers.json`:
|
|
141
|
+
|
|
142
|
+
```json
|
|
143
|
+
{
|
|
144
|
+
"maven-decoder": {
|
|
145
|
+
"command": "maven-decoder-mcp",
|
|
146
|
+
"args": []
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### For Other MCP Clients
|
|
152
|
+
The server runs as a standard MCP server and can be integrated with any MCP-compatible client.
|
|
153
|
+
|
|
154
|
+
## ๐ ๏ธ Available Tools
|
|
155
|
+
|
|
156
|
+
| Tool | Description |
|
|
157
|
+
|------|-------------|
|
|
158
|
+
| `list_artifacts` | List artifacts in Maven repository with filtering |
|
|
159
|
+
| `analyze_jar` | Analyze jar file structure and contents |
|
|
160
|
+
| `extract_class_info` | Get detailed information about Java classes |
|
|
161
|
+
| `get_dependencies` | Retrieve Maven dependencies from POM files |
|
|
162
|
+
| `search_classes` | Search for classes across all jars |
|
|
163
|
+
| `extract_source_code` | Decompile and extract Java source code |
|
|
164
|
+
| `compare_versions` | Compare different versions of artifacts |
|
|
165
|
+
| `find_usage_examples` | Find usage examples in test code |
|
|
166
|
+
| `get_dependency_tree` | Get complete dependency tree |
|
|
167
|
+
| `find_dependents` | Find artifacts that depend on a specific artifact |
|
|
168
|
+
| `get_version_info` | Get all available versions of an artifact |
|
|
169
|
+
| `analyze_jar_structure` | Analyze overall jar structure and metadata |
|
|
170
|
+
|
|
171
|
+
## ๐ก Usage Examples
|
|
172
|
+
|
|
173
|
+
### Finding Dependencies
|
|
174
|
+
```
|
|
175
|
+
"Show me all dependencies of org.springframework:spring-core:5.3.21"
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Decompiling Classes
|
|
179
|
+
```
|
|
180
|
+
"Decompile the class com.example.MyService from my Maven repository"
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Analyzing Conflicts
|
|
184
|
+
```
|
|
185
|
+
"Find all version conflicts in my Maven repository"
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Exploring APIs
|
|
189
|
+
```
|
|
190
|
+
"Show me all public methods in the Jackson ObjectMapper class"
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## ๐๏ธ Architecture
|
|
194
|
+
|
|
195
|
+
The server is built with a modular architecture:
|
|
196
|
+
|
|
197
|
+
- **`MavenDecoderServer`**: Main MCP server implementation
|
|
198
|
+
- **`JavaDecompiler`**: Handles multiple decompilation strategies
|
|
199
|
+
- **`MavenDependencyAnalyzer`**: Analyzes Maven dependencies and metadata
|
|
200
|
+
- **Decompilers**: CFR, Procyon, Fernflower, and javap integration
|
|
201
|
+
|
|
202
|
+
## ๐งช Development
|
|
203
|
+
|
|
204
|
+
### Running Tests
|
|
205
|
+
```bash
|
|
206
|
+
# Install development dependencies
|
|
207
|
+
pip install -e ".[dev]"
|
|
208
|
+
|
|
209
|
+
# Run tests
|
|
210
|
+
pytest
|
|
211
|
+
|
|
212
|
+
# Run specific test
|
|
213
|
+
python test_startup.py
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Building Package
|
|
217
|
+
```bash
|
|
218
|
+
# Build distribution
|
|
219
|
+
python setup.py sdist bdist_wheel
|
|
220
|
+
|
|
221
|
+
# Install locally
|
|
222
|
+
pip install dist/maven_decoder_mcp-*.whl
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Docker Development
|
|
226
|
+
```bash
|
|
227
|
+
# Build Docker image
|
|
228
|
+
docker build -t maven-decoder-mcp .
|
|
229
|
+
|
|
230
|
+
# Run container
|
|
231
|
+
docker run --rm -it maven-decoder-mcp
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
## ๐ Configuration Options
|
|
235
|
+
|
|
236
|
+
### Environment Variables
|
|
237
|
+
- `MAVEN_HOME`: Custom Maven repository location (default: `~/.m2/repository`)
|
|
238
|
+
- `MCP_LOG_LEVEL`: Logging level (DEBUG, INFO, WARNING, ERROR)
|
|
239
|
+
|
|
240
|
+
### Advanced Configuration
|
|
241
|
+
The server automatically detects and configures:
|
|
242
|
+
- Maven repository location
|
|
243
|
+
- Available Java decompilers
|
|
244
|
+
- System capabilities
|
|
245
|
+
|
|
246
|
+
## ๐ Troubleshooting
|
|
247
|
+
|
|
248
|
+
### Common Issues
|
|
249
|
+
|
|
250
|
+
**Server won't start**
|
|
251
|
+
```bash
|
|
252
|
+
# Check Python installation
|
|
253
|
+
python --version
|
|
254
|
+
|
|
255
|
+
# Check Maven repository
|
|
256
|
+
ls ~/.m2/repository
|
|
257
|
+
|
|
258
|
+
# Check logs
|
|
259
|
+
maven-decoder-mcp --debug
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
**Decompilation fails**
|
|
263
|
+
```bash
|
|
264
|
+
# Check Java installation
|
|
265
|
+
java -version
|
|
266
|
+
|
|
267
|
+
# Setup decompilers manually
|
|
268
|
+
maven-decoder-setup decompilers
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
**No artifacts found**
|
|
272
|
+
```bash
|
|
273
|
+
# Verify Maven repository location
|
|
274
|
+
ls ~/.m2/repository
|
|
275
|
+
|
|
276
|
+
# Run a Maven build to populate repository
|
|
277
|
+
mvn dependency:resolve
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
## ๐ค Contributing
|
|
281
|
+
|
|
282
|
+
1. Fork the repository
|
|
283
|
+
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
|
284
|
+
3. Commit your changes (`git commit -m 'Add amazing feature'`)
|
|
285
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
286
|
+
5. Open a Pull Request
|
|
287
|
+
|
|
288
|
+
## ๐ License
|
|
289
|
+
|
|
290
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
291
|
+
|
|
292
|
+
## ๐ Acknowledgments
|
|
293
|
+
|
|
294
|
+
- [Model Context Protocol](https://github.com/modelcontextprotocol) - The protocol that powers this server
|
|
295
|
+
- [CFR](https://github.com/leibnitz27/cfr) - Java decompiler
|
|
296
|
+
- [Procyon](https://github.com/mstrobel/procyon) - Java decompiler
|
|
297
|
+
- [Maven](https://maven.apache.org/) - Dependency management
|
|
298
|
+
|
|
299
|
+
## ๐ Stats
|
|
300
|
+
|
|
301
|
+

|
|
302
|
+

|
|
303
|
+

|
|
304
|
+
|
|
305
|
+
---
|
|
306
|
+
|
|
307
|
+
**Made with โค๏ธ for the Java development community**
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
# Maven Decoder MCP Server
|
|
2
|
+
|
|
3
|
+
A comprehensive Model Context Protocol (MCP) server for analyzing Maven jar files in your local repository (`~/.m2`). This server provides powerful tools for agentic coding assistance in Java projects, enabling AI agents to understand dependencies, analyze bytecode, extract source code, and navigate the Maven ecosystem.
|
|
4
|
+
|
|
5
|
+
## ๐ Features
|
|
6
|
+
|
|
7
|
+
### Core Functionality
|
|
8
|
+
- **Jar File Analysis**: Deep inspection of jar files including metadata, manifests, and structure
|
|
9
|
+
- **Dependency Resolution**: Complete dependency tree analysis with transitive dependencies
|
|
10
|
+
- **Source Code Extraction**: Extract source code from source jars or decompile bytecode
|
|
11
|
+
- **Class Information**: Detailed class signatures, methods, fields, and annotations
|
|
12
|
+
- **Search Capabilities**: Find classes, methods, and dependencies across all artifacts
|
|
13
|
+
- **Version Management**: Compare versions, find dependents, and track version conflicts
|
|
14
|
+
|
|
15
|
+
### Advanced Features
|
|
16
|
+
- **Decompilation Support**: Integrated support for multiple Java decompilers (CFR, Fernflower, Procyon)
|
|
17
|
+
- **Conflict Analysis**: Detect and analyze dependency version conflicts
|
|
18
|
+
- **Repository Navigation**: Browse and explore the local Maven repository structure
|
|
19
|
+
- **Metadata Parsing**: Extract and parse Maven POM files and metadata
|
|
20
|
+
- **Service Discovery**: Find and analyze Java services and SPI implementations
|
|
21
|
+
|
|
22
|
+
## ๐ฆ Installation
|
|
23
|
+
|
|
24
|
+
### Prerequisites
|
|
25
|
+
- Java 8+ (for decompilation features)
|
|
26
|
+
- Maven local repository (`~/.m2/repository`)
|
|
27
|
+
- One of: **Python 3.8+**, **Node.js 14+**, or **Docker**
|
|
28
|
+
|
|
29
|
+
### ๐ Quick Install
|
|
30
|
+
|
|
31
|
+
#### One-Line Install (Recommended)
|
|
32
|
+
```bash
|
|
33
|
+
curl -fsSL https://raw.githubusercontent.com/salitaba/maven-decoder-mcp/main/install.sh | bash
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### ๐ Installation Methods
|
|
37
|
+
|
|
38
|
+
#### Method 1: Python/pip (Recommended)
|
|
39
|
+
```bash
|
|
40
|
+
# Install the package
|
|
41
|
+
pip install maven-decoder-mcp
|
|
42
|
+
|
|
43
|
+
# Install MCP SDK
|
|
44
|
+
pip install "git+https://github.com/modelcontextprotocol/python-sdk.git"
|
|
45
|
+
|
|
46
|
+
# Run the server
|
|
47
|
+
maven-decoder-mcp
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
#### Method 2: Node.js/npm
|
|
51
|
+
```bash
|
|
52
|
+
# Install globally
|
|
53
|
+
npm install -g maven-decoder-mcp
|
|
54
|
+
|
|
55
|
+
# Or install locally
|
|
56
|
+
npm install maven-decoder-mcp
|
|
57
|
+
|
|
58
|
+
# Run the server
|
|
59
|
+
maven-decoder-mcp
|
|
60
|
+
# or if installed locally: npx maven-decoder-mcp
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
#### Method 3: Docker
|
|
64
|
+
```bash
|
|
65
|
+
# Pull and run
|
|
66
|
+
docker run --rm -it \
|
|
67
|
+
-v ~/.m2:/home/mcpuser/.m2 \
|
|
68
|
+
-v $(pwd):/workspace \
|
|
69
|
+
maven-decoder/mcp-server:latest
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
#### Method 4: From Source (Development)
|
|
73
|
+
```bash
|
|
74
|
+
# Clone repository
|
|
75
|
+
git clone https://github.com/salitaba/maven-decoder-mcp.git
|
|
76
|
+
cd maven-decoder-mcp
|
|
77
|
+
|
|
78
|
+
# Option 4a: Using Virtual Environment
|
|
79
|
+
python3 -m venv .venv
|
|
80
|
+
source .venv/bin/activate # On Windows: .venv\Scripts\activate
|
|
81
|
+
pip install -r requirements.txt
|
|
82
|
+
pip install "git+https://github.com/modelcontextprotocol/python-sdk.git"
|
|
83
|
+
./setup_decompilers.sh
|
|
84
|
+
|
|
85
|
+
# Option 4b: System-wide Installation
|
|
86
|
+
pip3 install -r requirements.txt
|
|
87
|
+
pip3 install "git+https://github.com/modelcontextprotocol/python-sdk.git"
|
|
88
|
+
./setup_decompilers.sh
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## ๐ง Configuration
|
|
92
|
+
|
|
93
|
+
### For Cursor IDE
|
|
94
|
+
Add to your `~/.cursor/mcp_servers.json`:
|
|
95
|
+
|
|
96
|
+
```json
|
|
97
|
+
{
|
|
98
|
+
"maven-decoder": {
|
|
99
|
+
"command": "maven-decoder-mcp",
|
|
100
|
+
"args": []
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### For Other MCP Clients
|
|
106
|
+
The server runs as a standard MCP server and can be integrated with any MCP-compatible client.
|
|
107
|
+
|
|
108
|
+
## ๐ ๏ธ Available Tools
|
|
109
|
+
|
|
110
|
+
| Tool | Description |
|
|
111
|
+
|------|-------------|
|
|
112
|
+
| `list_artifacts` | List artifacts in Maven repository with filtering |
|
|
113
|
+
| `analyze_jar` | Analyze jar file structure and contents |
|
|
114
|
+
| `extract_class_info` | Get detailed information about Java classes |
|
|
115
|
+
| `get_dependencies` | Retrieve Maven dependencies from POM files |
|
|
116
|
+
| `search_classes` | Search for classes across all jars |
|
|
117
|
+
| `extract_source_code` | Decompile and extract Java source code |
|
|
118
|
+
| `compare_versions` | Compare different versions of artifacts |
|
|
119
|
+
| `find_usage_examples` | Find usage examples in test code |
|
|
120
|
+
| `get_dependency_tree` | Get complete dependency tree |
|
|
121
|
+
| `find_dependents` | Find artifacts that depend on a specific artifact |
|
|
122
|
+
| `get_version_info` | Get all available versions of an artifact |
|
|
123
|
+
| `analyze_jar_structure` | Analyze overall jar structure and metadata |
|
|
124
|
+
|
|
125
|
+
## ๐ก Usage Examples
|
|
126
|
+
|
|
127
|
+
### Finding Dependencies
|
|
128
|
+
```
|
|
129
|
+
"Show me all dependencies of org.springframework:spring-core:5.3.21"
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Decompiling Classes
|
|
133
|
+
```
|
|
134
|
+
"Decompile the class com.example.MyService from my Maven repository"
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Analyzing Conflicts
|
|
138
|
+
```
|
|
139
|
+
"Find all version conflicts in my Maven repository"
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Exploring APIs
|
|
143
|
+
```
|
|
144
|
+
"Show me all public methods in the Jackson ObjectMapper class"
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## ๐๏ธ Architecture
|
|
148
|
+
|
|
149
|
+
The server is built with a modular architecture:
|
|
150
|
+
|
|
151
|
+
- **`MavenDecoderServer`**: Main MCP server implementation
|
|
152
|
+
- **`JavaDecompiler`**: Handles multiple decompilation strategies
|
|
153
|
+
- **`MavenDependencyAnalyzer`**: Analyzes Maven dependencies and metadata
|
|
154
|
+
- **Decompilers**: CFR, Procyon, Fernflower, and javap integration
|
|
155
|
+
|
|
156
|
+
## ๐งช Development
|
|
157
|
+
|
|
158
|
+
### Running Tests
|
|
159
|
+
```bash
|
|
160
|
+
# Install development dependencies
|
|
161
|
+
pip install -e ".[dev]"
|
|
162
|
+
|
|
163
|
+
# Run tests
|
|
164
|
+
pytest
|
|
165
|
+
|
|
166
|
+
# Run specific test
|
|
167
|
+
python test_startup.py
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Building Package
|
|
171
|
+
```bash
|
|
172
|
+
# Build distribution
|
|
173
|
+
python setup.py sdist bdist_wheel
|
|
174
|
+
|
|
175
|
+
# Install locally
|
|
176
|
+
pip install dist/maven_decoder_mcp-*.whl
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Docker Development
|
|
180
|
+
```bash
|
|
181
|
+
# Build Docker image
|
|
182
|
+
docker build -t maven-decoder-mcp .
|
|
183
|
+
|
|
184
|
+
# Run container
|
|
185
|
+
docker run --rm -it maven-decoder-mcp
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## ๐ Configuration Options
|
|
189
|
+
|
|
190
|
+
### Environment Variables
|
|
191
|
+
- `MAVEN_HOME`: Custom Maven repository location (default: `~/.m2/repository`)
|
|
192
|
+
- `MCP_LOG_LEVEL`: Logging level (DEBUG, INFO, WARNING, ERROR)
|
|
193
|
+
|
|
194
|
+
### Advanced Configuration
|
|
195
|
+
The server automatically detects and configures:
|
|
196
|
+
- Maven repository location
|
|
197
|
+
- Available Java decompilers
|
|
198
|
+
- System capabilities
|
|
199
|
+
|
|
200
|
+
## ๐ Troubleshooting
|
|
201
|
+
|
|
202
|
+
### Common Issues
|
|
203
|
+
|
|
204
|
+
**Server won't start**
|
|
205
|
+
```bash
|
|
206
|
+
# Check Python installation
|
|
207
|
+
python --version
|
|
208
|
+
|
|
209
|
+
# Check Maven repository
|
|
210
|
+
ls ~/.m2/repository
|
|
211
|
+
|
|
212
|
+
# Check logs
|
|
213
|
+
maven-decoder-mcp --debug
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
**Decompilation fails**
|
|
217
|
+
```bash
|
|
218
|
+
# Check Java installation
|
|
219
|
+
java -version
|
|
220
|
+
|
|
221
|
+
# Setup decompilers manually
|
|
222
|
+
maven-decoder-setup decompilers
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
**No artifacts found**
|
|
226
|
+
```bash
|
|
227
|
+
# Verify Maven repository location
|
|
228
|
+
ls ~/.m2/repository
|
|
229
|
+
|
|
230
|
+
# Run a Maven build to populate repository
|
|
231
|
+
mvn dependency:resolve
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
## ๐ค Contributing
|
|
235
|
+
|
|
236
|
+
1. Fork the repository
|
|
237
|
+
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
|
238
|
+
3. Commit your changes (`git commit -m 'Add amazing feature'`)
|
|
239
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
240
|
+
5. Open a Pull Request
|
|
241
|
+
|
|
242
|
+
## ๐ License
|
|
243
|
+
|
|
244
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
245
|
+
|
|
246
|
+
## ๐ Acknowledgments
|
|
247
|
+
|
|
248
|
+
- [Model Context Protocol](https://github.com/modelcontextprotocol) - The protocol that powers this server
|
|
249
|
+
- [CFR](https://github.com/leibnitz27/cfr) - Java decompiler
|
|
250
|
+
- [Procyon](https://github.com/mstrobel/procyon) - Java decompiler
|
|
251
|
+
- [Maven](https://maven.apache.org/) - Dependency management
|
|
252
|
+
|
|
253
|
+
## ๐ Stats
|
|
254
|
+
|
|
255
|
+

|
|
256
|
+

|
|
257
|
+

|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
**Made with โค๏ธ for the Java development community**
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Maven Decoder MCP Server
|
|
3
|
+
|
|
4
|
+
An MCP (Model Context Protocol) server for reading and decompiling Maven .m2 jar files.
|
|
5
|
+
Provides comprehensive Java project analysis including:
|
|
6
|
+
- Jar file exploration and analysis
|
|
7
|
+
- Java class decompilation (CFR, Procyon, javap)
|
|
8
|
+
- Maven dependency resolution
|
|
9
|
+
- Source code extraction
|
|
10
|
+
- Class structure analysis
|
|
11
|
+
|
|
12
|
+
Usage:
|
|
13
|
+
from maven_decoder_mcp import MavenDecoderServer
|
|
14
|
+
|
|
15
|
+
# Create and run server
|
|
16
|
+
server = MavenDecoderServer()
|
|
17
|
+
server.run()
|
|
18
|
+
|
|
19
|
+
Command line:
|
|
20
|
+
maven-decoder-mcp
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
__version__ = "1.0.0"
|
|
24
|
+
__author__ = "Your Name"
|
|
25
|
+
__email__ = "your-email@example.com"
|
|
26
|
+
|
|
27
|
+
from .maven_decoder_server import MavenDecoderServer
|
|
28
|
+
from .decompiler import JavaDecompiler
|
|
29
|
+
from .maven_analyzer import MavenDependencyAnalyzer
|
|
30
|
+
|
|
31
|
+
__all__ = [
|
|
32
|
+
"MavenDecoderServer",
|
|
33
|
+
"JavaDecompiler",
|
|
34
|
+
"MavenDependencyAnalyzer",
|
|
35
|
+
]
|