Observed since 20 Oct, 22:38 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
@0x663/read_class
A Model Context Protocol (MCP) service that reads and analyzes Java class files to provide code context for AI models and tools.
A Model Context Protocol (MCP) service that reads and analyzes Java class files to provide code context for AI models and tools.
This service can be used as an MCP tool by calling the /mcp/analyze-class endpoint with Base64-encoded class file content.
Endpoint: POST /mcp/analyze-class
Content-Type: application/json
Request Body:
{
"fileContent": "Base64-encoded content of the .class file"
}
Example Usage in MCP Configuration:
{
"tools": [
{
"name": "analyze-java-class",
"description": "Analyzes Java class files and extracts structural information",
"inputSchema": {
"type": "object",
"properties": {
"fileContent": {
"type": "string",
"description": "Base64-encoded content of the .class file"
}
},
"required": ["fileContent"]
}
}
]
}
/src
/main
/java
/com/example/mcp
McpClassReaderApplication.java # Main application with SparkJava server
ClassFileAnalyzer.java # ASM-based class file parser
ClassInfo.java # Model for class metadata
FieldInfo.java # Model for field information
MethodInfo.java # Model for method information
/test
/pom.xml # Maven dependencies and build configuration
mvn clean package
npm run build
java -jar target/mcp-class-reader-1.0-SNAPSHOT.jar
The service will start on port 4567 by default.
You can also run the service directly with npx without manual building:
npx @0x663/read_class
我们提供了一个示例脚本,展示如何使用npx配置方式:
./example-npx-usage.sh
该脚本将:
Endpoint: POST /analyze-class
Content-Type: multipart/form-data
Request Parameters:
classFile: The Java .class file to analyze (form-data)Example Request (curl):
curl -X POST http://localhost:4567/analyze-class \
-F "classFile=@/path/to/YourClass.class"
Example Response:
{
"className": "com.example.YourClass",
"superClassName": "java.lang.Object",
"interfaces": [],
"modifiers": ["public"],
"fields": [
{
"name": "exampleField",
"type": "Ljava/lang/String;",
"modifiers": ["private", "final"]
}
],
"methods": [
{
"name": "<init>",
"descriptor": "()V",
"modifiers": ["public"],
"exceptions": []
},
{
"name": "exampleMethod",
"descriptor": "(ILjava/lang/String;)Z",
"modifiers": ["public"],
"exceptions": ["java/io/IOException"]
}
]
}
To use this service as an MCP tool:
Build and run the service:
mvn clean package
java -jar target/mcp-class-reader-1.0-SNAPSHOT.jar
Configure your MCP client to call http://localhost:4567/mcp/analyze-class with Base64-encoded class file content.
The service will return structured information about the class, which can be used by AI agents for code analysis and understanding.
For detailed instructions on integrating this tool with an AI Agent IDE, please refer to the MCP Tool Usage Guide.
This tool can also be configured to run directly with npx. To use this configuration:
{
"ReadClass": {
"command": "npx",
"args": [
"-y",
"@0x663/read_class@latest"
],
"env": {}
}
}
Note: The first time you run this tool, it will download the pre-built JAR file which includes all dependencies. Subsequent runs will be faster as the JAR file is cached.
要在支持MCP的AI Agent IDE中使用此工具,请按照以下步骤操作:
我们提供了一个完整的IDE配置示例文件 example-mcp-ide-config.json,您可以参考其中的配置说明和使用步骤。
MIT
Download counts and popularity will appear here as the collector receives them.
Declarations describe requirements; they are not a resolved dependency graph.
Source distribution
{
"integrity": "sha512-mVA0yCFXO+RSRjAct1nW86Cr9w4YI0dFhC7hVgkO6/vgUS1Ku7gJGamtFBiFc97XPShhBenpLs2LyVm6y/fT7A==",
"shasum": "2e8c8adf49ede68695e136026c1d2de689dddace",
"tarball": "https://registry.npmjs.org/@0x663/read_class/-/read_class-1.1.5.tgz",
"fileCount": 25,
"unpackedSize": 4259956,
"signatures": [
{
"keyid": "SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U",
"sig": "MEQCIAM9YQR/mb2HVe7rwt1IsYVY7Ep4Yk/qQxvJfg8usoY7AiAt4DmfYp41+CKwtvNc4CVBZAHiGjeJFx5zK6UApLn0Jw=="
}
]
}Observed since 20 Oct, 22:38 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package_version:bbfbe6a45b043bcd72431db572760bc77b313c13c9c57c33989da5a97cbf5b33