Skip to content

feat: MCP server endpoint with list_services tool (Stories 2.1 + 2.3)#129

Merged
farovictor merged 3 commits intomainfrom
feat/mcp-server
Apr 5, 2026
Merged

feat: MCP server endpoint with list_services tool (Stories 2.1 + 2.3)#129
farovictor merged 3 commits intomainfrom
feat/mcp-server

Conversation

@farovictor
Copy link
Copy Markdown
Owner

Summary

  • Adds POST /mcp — a JSON-RPC 2.0 MCP server endpoint behind X-API-Key auth
  • Supports initialize, tools/list, and tools/call methods
  • Implements list_services MCP tool: returns service name + base URL, credentials never included
  • Stubs request_key in the tools list (implemented in Story 2.2)
  • Wires /mcp in main.go and setupRouter in tests

MCP protocol

POST /mcp
X-API-Key: <key>
Content-Type: application/json

{"jsonrpc":"2.0","id":1,"method":"initialize"}
{"jsonrpc":"2.0","id":2,"method":"tools/list"}
{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"list_services","arguments":{}}}

Test plan

  • 8 new tests pass: auth, initialize, tools/list, list_services (empty + with data + no credential leak), unknown method/tool, invalid jsonrpc version
  • go test ./... green
  • Manual: curl -X POST http://localhost:3333/mcp -H "X-API-Key: secret" -d '{"jsonrpc":"2.0","id":1,"method":"initialize"}'

🤖 Generated with Claude Code

farovictor and others added 2 commits April 5, 2026 18:18
- Add POST /mcp — JSON-RPC 2.0 MCP server endpoint
  - initialize: returns protocol version, server name/version, capabilities
  - tools/list: returns available tools with input schemas
  - tools/call: dispatches to tool handlers
- Implement list_services MCP tool: returns service name + base_url,
  never includes real credentials
- Require X-API-Key auth on /mcp — unauthenticated requests return 401
- Wire /mcp in main.go and test setupRouter
- Add 8 tests covering auth, initialize, tools/list, list_services
  (empty + with data + no credential leak), unknown method/tool, invalid version

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Empty id allowed keys to be created with no name, making them
unreferenceable and impossible to delete via the UI or API.
Empty target bypassed service validation entirely.

Both now return 400 "id and target are required".

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@farovictor farovictor self-assigned this Apr 5, 2026
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@farovictor farovictor merged commit 14dcf64 into main Apr 5, 2026
8 checks passed
@farovictor farovictor deleted the feat/mcp-server branch April 5, 2026 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant