generated from personal-projects/leo-claude-mktplace
feat: implement MCP Streamable HTTP protocol endpoints
- Add POST /mcp endpoint using StreamableHTTPServerTransport - Add HEAD /mcp endpoint returning protocol version header - Remove old custom REST endpoints (/tools/list, /tools/call) - Integrate marketplace tools via MCP Server decorators - Add comprehensive MCP endpoint tests - Update README with correct MCP protocol usage The implementation properly handles: - JSON-RPC 2.0 message format - SSE (Server-Sent Events) responses - Protocol version negotiation - Tool filtering integration - Authentication middleware Tests verify: - HEAD /mcp returns correct headers - POST /mcp handles initialize requests - Proper error handling for missing headers Closes #24 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
61
README.md
61
README.md
@@ -159,30 +159,55 @@ GET /ping
|
||||
Response: {"status": "healthy"}
|
||||
```
|
||||
|
||||
#### List Tools
|
||||
```bash
|
||||
POST /tools/list
|
||||
#### MCP Protocol Endpoint
|
||||
|
||||
Response: {
|
||||
"tools": [
|
||||
{"name": "list_issues", "description": "...", "inputSchema": {...}},
|
||||
...
|
||||
]
|
||||
}
|
||||
```
|
||||
The server implements the MCP Streamable HTTP protocol:
|
||||
|
||||
#### Call Tool
|
||||
```bash
|
||||
POST /tools/call
|
||||
# Check protocol version
|
||||
HEAD /mcp
|
||||
|
||||
# Send MCP JSON-RPC requests
|
||||
POST /mcp
|
||||
Content-Type: application/json
|
||||
Accept: application/json, text/event-stream
|
||||
Authorization: Bearer YOUR_TOKEN # If auth enabled
|
||||
|
||||
# Example: Initialize
|
||||
{
|
||||
"name": "list_issues",
|
||||
"arguments": {
|
||||
"owner": "myorg",
|
||||
"repo": "myrepo",
|
||||
"state": "open"
|
||||
"jsonrpc": "2.0",
|
||||
"id": 1,
|
||||
"method": "initialize",
|
||||
"params": {
|
||||
"protocolVersion": "2024-11-05",
|
||||
"capabilities": {},
|
||||
"clientInfo": {
|
||||
"name": "my-client",
|
||||
"version": "1.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Example: List tools
|
||||
{
|
||||
"jsonrpc": "2.0",
|
||||
"id": 2,
|
||||
"method": "tools/list",
|
||||
"params": {}
|
||||
}
|
||||
|
||||
# Example: Call tool
|
||||
{
|
||||
"jsonrpc": "2.0",
|
||||
"id": 3,
|
||||
"method": "tools/call",
|
||||
"params": {
|
||||
"name": "list_issues",
|
||||
"arguments": {
|
||||
"owner": "myorg",
|
||||
"repo": "myrepo",
|
||||
"state": "open"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -330,7 +355,7 @@ If tool filtering is not applied:
|
||||
1. Check `.env` file syntax (no spaces around `=`)
|
||||
2. Verify comma-separated list format
|
||||
3. Check server logs for filter configuration
|
||||
4. Query `POST /tools/list` to see filtered tools
|
||||
4. Send `tools/list` MCP request to see filtered tools
|
||||
|
||||
## Security Considerations
|
||||
|
||||
|
||||
Reference in New Issue
Block a user