Purpose
The MCP API enables Large Language Models (LLMs) to dynamically discover and execute tools registered in HandsAI. This API follows the JSON-RPC 2.0 protocol standard and serves as the bridge between MCP clients (like Claude Desktop, Cline, or custom agents) and external REST APIs.Protocol
HandsAI’s MCP implementation adheres to the JSON-RPC 2.0 specification:- All responses include
"jsonrpc": "2.0" - Successful responses contain a
resultfield - Error responses contain an
errorfield withcodeandmessage - Request IDs are echoed back in responses when provided
Base Path
All MCP endpoints are served under:Authentication
Currently, the MCP API endpoints are publicly accessible with CORS enabled (@CrossOrigin(origins = "*")).
Available Endpoints
| Endpoint | Method | Purpose |
|---|---|---|
/mcp/tools/list | GET | Discover all available tools |
/mcp/tools/call | POST | Execute a specific tool |
Error Codes
HandsAI uses standard JSON-RPC 2.0 error codes:| Code | Meaning | When it occurs |
|---|---|---|
-32602 | Invalid params | Missing required parameters or invalid argument types |
-32603 | Internal error | Server-side execution failure, database errors, or unexpected exceptions |
Error Response Format
All errors follow this structure:Implementation Details
Controller Location
The MCP API is implemented in:Core Services
- ToolDiscoveryService: Resolves available tools from the database and cache
- ToolExecutionService: Executes tool calls against registered REST APIs
JSON-RPC Request/Response Flow
- Tool Discovery: Client requests
/mcp/tools/listto get all available tools with their input schemas - Tool Execution: Client sends a JSON-RPC request to
/mcp/tools/callwith tool name and arguments - Response Handling: HandsAI executes the underlying REST API call and returns the result wrapped in JSON-RPC format
Next Steps
List Tools
Discover available tools
Execute Tools
Call a registered tool