# Java-Mcp **Repository Path**: DragonLongShy/java-mcp ## Basic Information - **Project Name**: Java-Mcp - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-04-19 - **Last Updated**: 2026-04-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Code Executor Skill 一个通过MCP协议执行代码的Skill,允许AI编程工具(如小龙虾、Claude等)执行代码并获取执行结果。 ## 功能特性 - 执行简单的代码片段 - 处理代码编译错误 - 安全限制:检测并阻止恶意代码执行 - 超时机制:30秒执行超时 ## 安装 ### 方式一:自动安装(推荐) 直接告诉AI助手: ``` 帮我安装Code Executor Skill,仓库地址:https://gitee.com/DragonLongShy/java-mcp.git ``` ### 方式二:手动安装 将本仓库克隆到对应IDE的Skill目录: | IDE | Skill 目录 | |-----|------------| | Qoder | .qoder/skills/code-executor-skill/ | | Cursor | .cursor/skills/code-executor-skill/ | | Trae | .trae/skills/code-executor-skill/ | | Windsurf | .windsurf/skills/code-executor-skill/ | | Claude Code | .claude/skills/code-executor-skill/ | | 通用 | .agents/skills/code-executor-skill/ | 示例: ```bash git clone https://gitee.com/DragonLongShy/java-mcp.git .trae/skills/code-executor-skill ``` ## 使用方法 ### 1. 服务准备(仅首次使用) AI工具安装Skill后,需要准备代码执行服务: ```bash git clone https://gitee.com/DragonLongShy/java-mcp.git cd java-mcp mvn clean package java -jar target/mcp-java-skill-1.0-SNAPSHOT.jar ``` 服务将在 `http://localhost:8080` 上运行,后续使用时无需重复启动。 ### 2. 通过AI工具调用 #### 示例1:执行代码 ``` 帮我使用Code Executor Skill执行以下代码: System.out.println("Hello, MCP!"); ``` #### 示例2:执行计算 ``` 帮我使用Code Executor Skill计算5+3: int a = 5; int b = 3; System.out.println("5 + 3 = " + (a + b)); ``` #### 示例3:健康检查 ``` 帮我检查Code Executor Skill的健康状态 ``` ## API端点 | 端点 | 方法 | 说明 | |------|------|------| | /api/mcp/execute | POST | 执行代码 | | /api/mcp/health | POST | 健康检查 | | /api/mcp/info | POST | 获取Skill信息 | ## 安全限制 - 禁止执行 `System.exit()` - 禁止执行 `Runtime.getRuntime()` - 禁止执行 `ProcessBuilder` - 禁止文件写入操作 - 执行超时限制为30秒 ## 技术实现 - **Skill部分**:包含配置文件和文档,供AI工具识别和使用 - **服务部分**:基于Java和Spring Boot的微服务,提供代码执行能力 ## License MIT