Repository navigation
feat(mcp): add the Orbit MCP server over streamable HTTP - #9
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (23)
📝 WalkthroughWalkthroughAdds a new Orbit MCP application with streamable HTTP transport, bearer API-key authentication, identity-scoped tools for issues, planning, administration, and discovery, realtime delta responses, lifecycle management, CLI key provisioning, and Postgres-backed integration tests. ChangesOrbit MCP server and API-key integration
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant MCPClient
participant MCPServer
participant APIKeyService
participant OrbitTools
participant OrbitDB
participant Redis
MCPClient->>MCPServer: POST /mcp with Bearer API key
MCPServer->>APIKeyService: verifyApiKey
APIKeyService-->>MCPServer: authenticated principal
MCPServer->>OrbitTools: execute requested tool
OrbitTools->>OrbitDB: read or write Orbit data
OrbitDB-->>OrbitTools: rows and sync actions
OrbitTools->>Redis: publish sync actions
OrbitTools-->>MCPServer: result and deltas
MCPServer-->>MCPClient: JSON-RPC response
✨ Finishing Touches📝 Generate docstrings
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Checkov (3.3.8)apps/mcp/package.jsonTraceback (most recent call last): apps/mcp/tsconfig.jsonTraceback (most recent call last): Comment |
Live session over HTTPServer started with Minting a keyHealth, unauthenticated rejection, initialize$ curl -s -i http://localhost:3200/health
HTTP/1.1 200 OK
content-type: application/json
content-length: 31
Date: Wed, 22 Jul 2026 19:25:43 GMT
Connection: keep-alive
Keep-Alive: timeout=5
$ curl -s -i -X POST http://localhost:3200/mcp -d '{...tools/list...}' # no bearer token
HTTP/1.1 401 Unauthorized
content-type: application/json
content-length: 104
Date: Wed, 22 Jul 2026 19:25:43 GMT
Connection: keep-alive
Keep-Alive: timeout=5
{"jsonrpc":"2.0","error":{"code":-32000,"message":"Send an Orbit API key as a bearer token."},"id":null}
$ curl -s -X POST http://localhost:3200/mcp -H 'Authorization: Bearer orb_***' -H 'Content-Type: application/json' -H 'Accept: application/json, text/event-stream' \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"curl","version":"1.0"}}}'
{
"result": {
"protocolVersion": "2025-06-18",
"capabilities": {
"tools": {
"listChanged": true
}
},
"serverInfo": {
"name": "orbit",
"version": "0.0.0"
},
"instructions": "Orbit is a work tracker. Issues live on teams and carry identifiers such as ENG-42. Call get_me first to learn the caller role and teams, then list_teams, list_states and list_labels before writing. Every tool acts as the user who owns the API key, so a request can fail with a forbidden error when their role does not allow it."
},
"jsonrpc": "2.0",
"id": 1
}Tools, identity, create, read, move, comment, search, branch name### tools/list (names only)
$ curl -s -X POST http://localhost:3200/mcp -H 'Authorization: Bearer orb_***' -d '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}' | jq -r '.result.tools[].name'
get_me
list_teams
list_users
list_states
list_labels
create_issue
update_issue
get_issue
search_issues
list_my_issues
move_issue
add_comment
set_relation
copy_branch_name
list_projects
create_project
project_progress
list_cycles
active_cycle
cycle_progress
move_to_cycle
list_members
invite_member
### get_me
$ curl -s -X POST http://localhost:3200/mcp -H 'Authorization: Bearer orb_***' \
-d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"get_me","arguments":{}}}'
{
"result": {
"structuredContent": {
"user": {
"id": "2774c4de-26d3-40bd-8526-0c85e140befd",
"name": "Pulkit Sharma",
"email": "[email protected]",
"handle": "pulkit"
},
"organization": {
"id": "org_noveum_demo",
"name": "Noveum",
"slug": "noveum"
},
"role": "admin",
"permissions": [ "issue:read", "issue:create", "... 27 permissions ...", "audit:read" ],
"teams": [
{
"id": "419057cd-cdc6-4706-8f49-dd9e5afc468e",
"key": "DES",
"name": "Design"
},
{
"id": "ed99f640-24e8-4e54-96c7-b2d2c5715a56",
"key": "ENG",
"name": "Engineering"
},
{
"id": "4f5906a5-873d-4a43-9f99-08d2758e75ce",
"key": "MKT",
"name": "Marketing"
}
]
}
},
"jsonrpc": "2.0",
"id": 3
}
### create_issue
$ curl -s -X POST http://localhost:3200/mcp -H 'Authorization: Bearer orb_***' \
-d '{"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"name":"create_issue","arguments":{"team":"ENG","title":"Wire the MCP server into the agent workflow","description":"Expose Orbit tools over streamable HTTP.","priority":"high","assignee":"me","labels":["Feature"]}}}'
{
"result": {
"structuredContent": {
"issue": {
"id": "d46111df-3997-4900-a03f-f8e1f145b90d",
"identifier": "ENG-20",
"title": "Wire the MCP server into the agent workflow",
"teamId": "ed99f640-24e8-4e54-96c7-b2d2c5715a56",
"state": "Todo",
"stateId": "561d9d76-51a0-4f04-88b7-633a451596e6",
"priority": "High",
"assignee": "Pulkit Sharma",
"assigneeId": "2774c4de-26d3-40bd-8526-0c85e140befd",
"projectId": null,
"cycleId": null,
"milestoneId": null,
"parentId": null,
"estimate": null,
"dueDate": null,
"archived": false,
"updatedAt": "2026-07-22T19:25:43.534Z"
},
"deltas": [
{
"model": "issue",
"action": "insert",
"id": "d46111df-3997-4900-a03f-f8e1f145b90d"
}
]
}
},
"jsonrpc": "2.0",
"id": 4
}
### get_issue by identifier
$ curl -s -X POST http://localhost:3200/mcp -H 'Authorization: Bearer orb_***' \
-d '{"jsonrpc":"2.0","id":5,"method":"tools/call","params":{"name":"get_issue","arguments":{"issue":"ENG-20"}}}'
{
"result": {
"structuredContent": {
"issue": {
"id": "d46111df-3997-4900-a03f-f8e1f145b90d",
"identifier": "ENG-20",
"title": "Wire the MCP server into the agent workflow",
"teamId": "ed99f640-24e8-4e54-96c7-b2d2c5715a56",
"state": "Todo",
"stateId": "561d9d76-51a0-4f04-88b7-633a451596e6",
"priority": "High",
"assignee": "Pulkit Sharma",
"assigneeId": "2774c4de-26d3-40bd-8526-0c85e140befd",
"projectId": null,
"cycleId": null,
"milestoneId": null,
"parentId": null,
"estimate": null,
"dueDate": null,
"archived": false,
"updatedAt": "2026-07-22T19:25:43.534Z",
"description": "Expose Orbit tools over streamable HTTP.",
"labels": [
"Feature"
],
"relations": []
}
}
},
"jsonrpc": "2.0",
"id": 5
}
### move_issue
$ curl -s -X POST http://localhost:3200/mcp -H 'Authorization: Bearer orb_***' \
-d '{"jsonrpc":"2.0","id":6,"method":"tools/call","params":{"name":"move_issue","arguments":{"issue":"ENG-20","state":"In Progress"}}}'
{
"result": {
"structuredContent": {
"issue": {
"id": "d46111df-3997-4900-a03f-f8e1f145b90d",
"identifier": "ENG-20",
"title": "Wire the MCP server into the agent workflow",
"teamId": "ed99f640-24e8-4e54-96c7-b2d2c5715a56",
"state": "In Progress",
"stateId": "3c386ab9-080c-45e1-a467-5327226c4548",
"priority": "High",
"assignee": "Pulkit Sharma",
"assigneeId": "2774c4de-26d3-40bd-8526-0c85e140befd",
"projectId": null,
"cycleId": null,
"milestoneId": null,
"parentId": null,
"estimate": null,
"dueDate": null,
"archived": false,
"updatedAt": "2026-07-22T19:25:43.716Z"
},
"rebalanced": 0,
"deltas": [
{
"model": "issue",
"action": "update",
"id": "d46111df-3997-4900-a03f-f8e1f145b90d"
}
]
}
},
"jsonrpc": "2.0",
"id": 6
}
### add_comment
$ curl -s -X POST http://localhost:3200/mcp -H 'Authorization: Bearer orb_***' \
-d '{"jsonrpc":"2.0","id":7,"method":"tools/call","params":{"name":"add_comment","arguments":{"issue":"ENG-20","body":"Picked this up from the MCP server."}}}'
{
"result": {
"structuredContent": {
"comment": {
"id": "4503e96e-d5de-4910-a90f-8c9f09a125c7",
"issue": "ENG-20",
"body": "Picked this up from the MCP server.",
"createdAt": "2026-07-22T19:25:43.761Z"
},
"deltas": [
{
"model": "comment",
"action": "insert",
"id": "4503e96e-d5de-4910-a90f-8c9f09a125c7"
}
]
}
},
"jsonrpc": "2.0",
"id": 7
}
### search_issues
$ curl -s -X POST http://localhost:3200/mcp -H 'Authorization: Bearer orb_***' \
-d '{"jsonrpc":"2.0","id":8,"method":"tools/call","params":{"name":"search_issues","arguments":{"query":"MCP","team":"ENG","limit":5}}}'
{
"result": {
"structuredContent": {
"issues": [
{
"id": "d46111df-3997-4900-a03f-f8e1f145b90d",
"identifier": "ENG-20",
"title": "Wire the MCP server into the agent workflow",
"teamId": "ed99f640-24e8-4e54-96c7-b2d2c5715a56",
"state": "In Progress",
"stateId": "3c386ab9-080c-45e1-a467-5327226c4548",
"priority": "High",
"assignee": "Pulkit Sharma",
"assigneeId": "2774c4de-26d3-40bd-8526-0c85e140befd",
"projectId": null,
"cycleId": null,
"milestoneId": null,
"parentId": null,
"estimate": null,
"dueDate": null,
"archived": false,
"updatedAt": "2026-07-22T19:25:43.716Z"
},
{
"id": "a9339f23-99f2-4248-a8c9-3e617df89864",
"identifier": "ENG-19",
"title": "Wire the MCP server into the agent workflow",
"teamId": "ed99f640-24e8-4e54-96c7-b2d2c5715a56",
"state": "In Progress",
"stateId": "3c386ab9-080c-45e1-a467-5327226c4548",
"priority": "High",
"assignee": "Pulkit Sharma",
"assigneeId": "2774c4de-26d3-40bd-8526-0c85e140befd",
"projectId": null,
"cycleId": null,
"milestoneId": null,
"parentId": null,
"estimate": null,
"dueDate": null,
"archived": false,
"updatedAt": "2026-07-22T19:23:32.378Z"
},
{
"id": "625ee14f-9622-45ca-9f14-c7a75f8c3bb4",
"identifier": "ENG-15",
"title": "Expose the MCP server over streamable HTTP",
"teamId": "ed99f640-24e8-4e54-96c7-b2d2c5715a56",
"state": "Backlog",
"stateId": "4f590467-1ad6-47cd-817d-42671edec728",
"priority": "High",
"assignee": null,
"assigneeId": null,
"projectId": null,
"cycleId": null,
"milestoneId": null,
"parentId": null,
"estimate": 8,
"dueDate": null,
"archived": false,
"updatedAt": "2026-07-12T18:57:33.009Z"
}
],
"nextCursor": null
}
},
"jsonrpc": "2.0",
"id": 8
}
### copy_branch_name
$ curl -s -X POST http://localhost:3200/mcp -H 'Authorization: Bearer orb_***' \
-d '{"jsonrpc":"2.0","id":9,"method":"tools/call","params":{"name":"copy_branch_name","arguments":{"issue":"ENG-20"}}}'
{
"result": {
"structuredContent": {
"issue": "ENG-20",
"branch": "pulkit/eng-20-wire-the-mcp-server-into-the-agent-workflow"
}
},
"jsonrpc": "2.0",
"id": 9
}Graceful shutdown$ kill -TERM <pid>
{"level":"info","message":"shutting down","at":"2026-07-22T19:23:54.517Z","service":"mcp","signal":"SIGTERM"}
$ curl -s -m 2 http://localhost:3200/health || echo "SERVER DOWN"
SERVER DOWNChecks
|
Adds an api_key helper that generates orb_ prefixed keys, stores only a SHA-256 hash, verifies with a constant time compare, touches lastUsedAt, and rejects revoked or expired keys before resolving the owner principal.
Adds the @orbit/mcp app: a stateless streamable HTTP endpoint on MCP_PORT that authenticates every request with an Orbit API key, builds a server bound to the caller principal, answers GET /health, logs structured JSON, and shuts down cleanly on SIGTERM and SIGINT.
Twenty three tools that validate input with Zod, resolve human identifiers such as ENG-42 or a team key, call the matching core service with the caller principal, publish the returned SyncActions, and return a compact structured result. Domain errors come back as MCP tool errors instead of stack traces.
Drives the real HTTP server with an MCP client against Postgres: valid, revoked, expired and tampered keys, unauthenticated requests, a guest that can read but not write, an issue round trip by identifier, search filters, the sync actions a move emits, comments, relations and planning.
A small CLI mints a key for a seeded user and prints it once, and the README covers running the server, minting a key, connecting a client and the full tool list.
A domain error still reports its code and message, but anything that maps to a 500 comes back as a generic sentence so an unexpected failure cannot leak internals through the transport or a tool result.
1f89c09 to
12a4703
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
Adds
apps/mcp, an API key authenticated MCP server that exposes 23 Orbit tools backed by the core service layer and the shared permission policy.