{"_id":"@0x663/read_class","_rev":"6-15c7bb9c34ed774175974f7d88bac085","name":"@0x663/read_class","dist-tags":{"latest":"1.1.5"},"versions":{"1.1.0":{"name":"@0x663/read_class","version":"1.1.0","keywords":["mcp","java","class","analysis","ai"],"author":{"name":"0x663"},"license":"MIT","_id":"@0x663/read_class@1.1.0","maintainers":[{"name":"0x663","email":"liushaokang98@gmail.com"}],"bin":{"read_class":"bin/read_class.js"},"dist":{"shasum":"66ef271f942c5f96c82e26be6e9089558862f5ce","tarball":"https://registry.npmjs.org/@0x663/read_class/-/read_class-1.1.0.tgz","fileCount":23,"integrity":"sha512-9ToFXkHWTTmOAjJMiOJSau5+u0KomqddsF2c8HkhkxVduIs/o6L41vVSc1iAYYfy8rktBusvS3PPJjj0sCHtRQ==","signatures":[{"sig":"MEUCIQC9gPNHY+kIjS7j+7Th+8GJUOk7dvBHuWUCAHN0Ff9EogIgDZX/oZkdJgb/bwiBMvT084zGvfP17J15KqfGlxn2cPo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":4242586},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"./scripts/build-npm-package.sh","start":"node bin/read_class.js"},"_npmUser":{"name":"0x663","email":"liushaokang98@gmail.com"},"_npmVersion":"11.4.2","description":"A Model Context Protocol (MCP) service that reads and analyzes Java class files to provide code context for AI models and tools.","directories":{},"_nodeVersion":"24.4.0","dependencies":{"java":"^0.9.1"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/read_class_1.1.0_1753928852616_0.25769154828432983","host":"s3://npm-registry-packages-npm-production"}},"1.1.1":{"name":"@0x663/read_class","version":"1.1.1","keywords":["mcp","java","class","analysis","ai"],"author":{"name":"0x663"},"license":"MIT","_id":"@0x663/read_class@1.1.1","maintainers":[{"name":"0x663","email":"liushaokang98@gmail.com"}],"bin":{"read_class":"bin/read_class.js"},"dist":{"shasum":"44826bc8148ac098af9e49f706b3ecf960ac283e","tarball":"https://registry.npmjs.org/@0x663/read_class/-/read_class-1.1.1.tgz","fileCount":23,"integrity":"sha512-YxcpyLl0j+OvM2xDOwqv7A5m+aelX+QKor1xvpgVupI8F6S4mEV+PLM64jMoOPa9PMi/7lcMYG3jN3E6xWJOVQ==","signatures":[{"sig":"MEYCIQD9qvBZHdl6i8Fry8jjpm04A1uhsX8UnxocsnWgjzRBcQIhAMjfkFRAMyp/5iS0Hqb5zZLxx4eqYf7EI86LvT+v5BDF","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":4242540},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"./scripts/build-npm-package.sh","start":"node bin/read_class.js"},"_npmUser":{"name":"0x663","email":"liushaokang98@gmail.com"},"_npmVersion":"11.4.2","description":"A Model Context Protocol (MCP) service that reads and analyzes Java class files to provide code context for AI models and tools.","directories":{},"_nodeVersion":"24.4.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/read_class_1.1.1_1753929306709_0.7407826747613164","host":"s3://npm-registry-packages-npm-production"}},"1.1.2":{"name":"@0x663/read_class","version":"1.1.2","keywords":["mcp","java","class","analysis","ai"],"author":{"name":"0x663"},"license":"MIT","_id":"@0x663/read_class@1.1.2","maintainers":[{"name":"0x663","email":"liushaokang98@gmail.com"}],"bin":{"read_class":"bin/read_class.js"},"dist":{"shasum":"87bc12ab81fca64b7114400d9e885b0f1cd984f3","tarball":"https://registry.npmjs.org/@0x663/read_class/-/read_class-1.1.2.tgz","fileCount":23,"integrity":"sha512-6IqI5bYTAxu5H02tvbPJoJYOpawCv/5w8XRkYQKGySdZZqW9BlErvhG7xNou3r1/bJwQXlrsMU5LxlXnJff+3w==","signatures":[{"sig":"MEQCIHnndoAUYNpPMnf65bdB1j6nDND8NrBuVjYSJN2YzwhQAiBv2rNV4u0xk9VjPffdw/80Pa+9CdkF72XXFwuxluJVyw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":4243359},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"./scripts/build-npm-package.sh","start":"node bin/read_class.js"},"_npmUser":{"name":"0x663","email":"liushaokang98@gmail.com"},"_npmVersion":"11.4.2","description":"A Model Context Protocol (MCP) service that reads and analyzes Java class files to provide code context for AI models and tools.","directories":{},"_nodeVersion":"24.4.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/read_class_1.1.2_1753931794099_0.19638248035714745","host":"s3://npm-registry-packages-npm-production"}},"1.1.3":{"name":"@0x663/read_class","version":"1.1.3","keywords":["mcp","java","class","analysis","ai"],"author":{"name":"0x663"},"license":"MIT","_id":"@0x663/read_class@1.1.3","maintainers":[{"name":"0x663","email":"liushaokang98@gmail.com"}],"bin":{"read_class":"bin/read_class.js"},"dist":{"shasum":"e8619fcca874e5922fb1a11c5342351a6771ae7c","tarball":"https://registry.npmjs.org/@0x663/read_class/-/read_class-1.1.3.tgz","fileCount":23,"integrity":"sha512-7x6DpR/DdbaNGH/1SWBRSTz0Vp9wu6fzEMpr5yO+sqjhZNcNxTLsdX7Lsq5MCsntGzPOsF5j9SPDx7ARjdsb5A==","signatures":[{"sig":"MEYCIQDGKhzsM+SWmK0qH2KZhizgJsvle8hBee9eWZWWtSJShQIhANDywQfptAQp3thoFCvj/OvOAZNeAFZTqK+l9B3ADu40","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":4242926},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"./scripts/build-npm-package.sh","start":"node bin/read_class.js"},"_npmUser":{"name":"0x663","email":"liushaokang98@gmail.com"},"_npmVersion":"11.4.2","description":"A Model Context Protocol (MCP) service that reads and analyzes Java class files to provide code context for AI models and tools.","directories":{},"_nodeVersion":"24.4.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/read_class_1.1.3_1753932496939_0.27101809311386793","host":"s3://npm-registry-packages-npm-production"}},"1.1.4":{"name":"@0x663/read_class","version":"1.1.4","keywords":["mcp","java","class","analysis","ai"],"author":{"name":"0x663"},"license":"MIT","_id":"@0x663/read_class@1.1.4","maintainers":[{"name":"0x663","email":"liushaokang98@gmail.com"}],"bin":{"read_class":"bin/read_class.js"},"dist":{"shasum":"64c34e4a717c0848b36e7eeeee8a31d9247595b8","tarball":"https://registry.npmjs.org/@0x663/read_class/-/read_class-1.1.4.tgz","fileCount":23,"integrity":"sha512-JrJ7OtPTk5+n/kwIxMFgL8fAfexOAmAij0OL5qhk2M5pgUEzwWWyoWRNULBln3wR1Cr3L2KblzAydQtVnKTLBg==","signatures":[{"sig":"MEYCIQDPzG0rrQsVDcv7bhKepAZLRpujNPc0p/D+P/STxhKckgIhALm78bOSGpTw+KfGSG4kftIET+CzDuv3vlyG2oRODog3","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":4242863},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"./scripts/build-npm-package.sh","start":"node bin/read_class.js"},"_npmUser":{"name":"0x663","email":"liushaokang98@gmail.com"},"_npmVersion":"11.4.2","description":"A Model Context Protocol (MCP) service that reads and analyzes Java class files to provide code context for AI models and tools.","directories":{},"_nodeVersion":"24.4.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/read_class_1.1.4_1753932711513_0.9871921692088423","host":"s3://npm-registry-packages-npm-production"}},"1.1.5":{"name":"@0x663/read_class","version":"1.1.5","description":"A Model Context Protocol (MCP) service that reads and analyzes Java class files to provide code context for AI models and tools.","main":"index.js","bin":{"read_class":"bin/read_class.js","mcp-class-reader":"bin/mcp-server.js"},"scripts":{"build":"./scripts/build-npm-package.sh","start":"node bin/read_class.js","test":"echo \"Error: no test specified\" && exit 1"},"keywords":["mcp","java","class","analysis","ai"],"author":{"name":"0x663"},"license":"MIT","_id":"@0x663/read_class@1.1.5","_nodeVersion":"24.4.0","_npmVersion":"11.4.2","dist":{"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=="}]},"_npmUser":{"name":"0x663","email":"liushaokang98@gmail.com"},"directories":{},"maintainers":[{"name":"0x663","email":"liushaokang98@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/read_class_1.1.5_1753933535661_0.4040588859817018"},"_hasShrinkwrap":false}},"time":{"created":"2025-07-31T02:27:32.521Z","modified":"2025-07-31T03:45:36.116Z","1.1.0":"2025-07-31T02:27:32.879Z","1.1.1":"2025-07-31T02:35:07.064Z","1.1.2":"2025-07-31T03:16:34.417Z","1.1.3":"2025-07-31T03:28:17.240Z","1.1.4":"2025-07-31T03:31:51.780Z","1.1.5":"2025-07-31T03:45:35.921Z"},"author":{"name":"0x663"},"license":"MIT","keywords":["mcp","java","class","analysis","ai"],"description":"A Model Context Protocol (MCP) service that reads and analyzes Java class files to provide code context for AI models and tools.","maintainers":[{"name":"0x663","email":"liushaokang98@gmail.com"}],"readme":"# MCP Class Reader Service\n\nA Model Context Protocol (MCP) service that reads and analyzes Java class files to provide code context for AI models and tools.\n\n## As an MCP Tool\n\nThis service can be used as an MCP tool by calling the `/mcp/analyze-class` endpoint with Base64-encoded class file content.\n\n**Endpoint**: `POST /mcp/analyze-class`\n**Content-Type**: `application/json`\n\n**Request Body**:\n```json\n{\n  \"fileContent\": \"Base64-encoded content of the .class file\"\n}\n```\n\n**Example Usage in MCP Configuration**:\n```json\n{\n  \"tools\": [\n    {\n      \"name\": \"analyze-java-class\",\n      \"description\": \"Analyzes Java class files and extracts structural information\",\n      \"inputSchema\": {\n        \"type\": \"object\",\n        \"properties\": {\n          \"fileContent\": {\n            \"type\": \"string\",\n            \"description\": \"Base64-encoded content of the .class file\"\n          }\n        },\n        \"required\": [\"fileContent\"]\n      }\n    }\n  ]\n}\n```\n\n## Features\n- Parse Java class files and extract detailed class information\n- Retrieve class metadata, fields, methods, and inheritance information\n- REST API endpoint for class file analysis\n- JSON-formatted responses for easy integration with AI systems\n\n## Project Structure\n```\n/src\n  /main\n    /java\n      /com/example/mcp\n        McpClassReaderApplication.java  # Main application with SparkJava server\n        ClassFileAnalyzer.java          # ASM-based class file parser\n        ClassInfo.java                  # Model for class metadata\n        FieldInfo.java                  # Model for field information\n        MethodInfo.java                 # Model for method information\n  /test\n/pom.xml                                # Maven dependencies and build configuration\n```\n\n## Dependencies\n- **ASM 9.5**: For Java class file parsing\n- **SparkJava 2.9.4**: Lightweight web framework for REST API\n- **Gson 2.10.1**: JSON serialization/deserialization\n- Java 11 or higher\n\n## Build and Run\n\n### Prerequisites\n- Java Development Kit (JDK) 11 or higher\n- Apache Maven 3.6+ or compatible build tool\n\n### Build the Project\n\n#### Option 1: Using Maven directly\n```bash\nmvn clean package\n```\n\n#### Option 2: Using npm build script (for npm package preparation)\n```bash\nnpm run build\n```\n\n### Run the Service\n```bash\njava -jar target/mcp-class-reader-1.0-SNAPSHOT.jar\n```\nThe service will start on port 4567 by default.\n\n### Run with NPX\nYou can also run the service directly with npx without manual building:\n```bash\nnpx @0x663/read_class\n```\n\n### 示例操作\n我们提供了一个示例脚本，展示如何使用npx配置方式：\n```bash\n./example-npx-usage.sh\n```\n\n该脚本将：\n1. 创建一个示例Java类文件\n2. 编译该类文件\n3. 展示如何使用Base64编码class文件内容\n4. 提供在AI Agent IDE中配置MCP工具的JSON示例\n\n## API Usage\n\n### Analyze Class File\n**Endpoint**: `POST /analyze-class`\n**Content-Type**: `multipart/form-data`\n\n**Request Parameters**:\n- `classFile`: The Java .class file to analyze (form-data)\n\n**Example Request (curl)**:\n```bash\ncurl -X POST http://localhost:4567/analyze-class \\\n  -F \"classFile=@/path/to/YourClass.class\"\n```\n\n**Example Response**:\n```json\n{\n  \"className\": \"com.example.YourClass\",\n  \"superClassName\": \"java.lang.Object\",\n  \"interfaces\": [],\n  \"modifiers\": [\"public\"],\n  \"fields\": [\n    {\n      \"name\": \"exampleField\",\n      \"type\": \"Ljava/lang/String;\",\n      \"modifiers\": [\"private\", \"final\"]\n    }\n  ],\n  \"methods\": [\n    {\n      \"name\": \"<init>\",\n      \"descriptor\": \"()V\",\n      \"modifiers\": [\"public\"],\n      \"exceptions\": []\n    },\n    {\n      \"name\": \"exampleMethod\",\n      \"descriptor\": \"(ILjava/lang/String;)Z\",\n      \"modifiers\": [\"public\"],\n      \"exceptions\": [\"java/io/IOException\"]\n    }\n  ]\n}\n```\n\n## Using as an MCP Tool\n\nTo use this service as an MCP tool:\n\n1. Build and run the service:\n   ```bash\n   mvn clean package\n   java -jar target/mcp-class-reader-1.0-SNAPSHOT.jar\n   ```\n\n2. Configure your MCP client to call `http://localhost:4567/mcp/analyze-class` with Base64-encoded class file content.\n\n3. The service will return structured information about the class, which can be used by AI agents for code analysis and understanding.\n\nFor detailed instructions on integrating this tool with an AI Agent IDE, please refer to the [MCP Tool Usage Guide](MCP_TOOL_USAGE.md).\n\n## Using with NPX\n\nThis tool can also be configured to run directly with npx. To use this configuration:\n\n1. Ensure Java 11+ is installed on your system (Maven is no longer required)\n2. Add the following configuration to your MCP client:\n\n```json\n{\n  \"ReadClass\": {\n    \"command\": \"npx\",\n    \"args\": [\n      \"-y\",\n      \"@0x663/read_class@latest\"\n    ],\n    \"env\": {}\n  }\n}\n```\n\n3. When called, the tool will automatically start the service and analyze the provided Java class file.\n\nNote: 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.\n\n### 在AI Agent IDE中使用\n\n要在支持MCP的AI Agent IDE中使用此工具，请按照以下步骤操作：\n\n1. 在IDE的MCP工具配置中添加上述JSON配置\n2. 确保您的项目中有Java class文件\n3. 右键点击任何.class文件并选择分析选项\n4. IDE将自动处理文件读取、Base64编码和结果展示\n\n我们提供了一个完整的IDE配置示例文件 `example-mcp-ide-config.json`，您可以参考其中的配置说明和使用步骤。\n\n## License\nMIT","readmeFilename":"README.md"}