Skip to content

Add MCP server endpoint at /mcp (clean rebase of #177)#180

Draft
zer0stars wants to merge 1 commit intomainfrom
feat/mcp-server-v2
Draft

Add MCP server endpoint at /mcp (clean rebase of #177)#180
zer0stars wants to merge 1 commit intomainfrom
feat/mcp-server-v2

Conversation

@zer0stars
Copy link
Copy Markdown
Member

Summary

Fresh, clean rebase of the MCP server work from #177. Built surgically on top of current main instead of rebasing the old branch — the old branch stripped docstrings across every schema file and accumulated ~13 unrelated conflicts.

Exposes an MCP (Model Context Protocol) Streamable HTTP endpoint at /mcp for LLM agents. Unauthenticated, matching the public /query endpoint.

Why draft

Depends on server-garage v0.1.0 (DIMO-Network/server-garage#31). Before merging:

  • drop the replace github.com/DIMO-Network/server-garage => /Users/zer0stars/workspace/server-garage line from go.mod
  • pin github.com/DIMO-Network/server-garage v0.1.0
  • go mod tidy

What's in this PR

  • graph/schema/directives.graphqls (new): @mcpTool / @mcpExample / @mcpHide
  • graph/schema/aftermarket.graphqls, graph/schema/vehicle.graphqls: annotate aftermarketDevice, vehicle, vehicles with @mcpTool / @mcpExample (docstrings preserved)
  • graph/mcp_tools_gen.go (new): generated by mcpgen; 3 tools — identity_get_aftermarket_device, identity_get_vehicle, identity_list_vehicles
  • graph/resolver.go: //go:generate now runs mcpgen after gqlgen
  • gqlgen.yml: mark mcpTool / mcpExample as skip_runtime
  • cmd/identity-api/main.go: build MCP handler on the same ExecutableSchema as /query, mount at /mcp, inject zerolog into request context
  • go.mod: add server-garage + modelcontextprotocol/go-sdk v1.4.1 (bumps gqlgen to v0.17.89 → one-line no-op version-header churn across resolver files)

Test plan

  • go build ./...
  • go test ./... (full suite incl. testcontainers integration tests)
  • golangci-lint clean
  • go generate ./graph/... produces stable output
  • Post-SG-v0.1.0: pin version, go mod tidy, confirm CI green
  • Local smoke: POST /mcp tools/list returns 3 tools; tools/call identity_get_vehicle returns vehicle data
  • Post-deploy: hit https://identity-api.dev.dimo.zone/mcp with tools/list

Supersedes

Supersedes #177. Leaving #177 open pending decision on whether to close it or rewrite its history.

Expose an MCP (Model Context Protocol) Streamable HTTP endpoint that
lets LLM agents query identity-api's GraphQL surface via the standard
MCP transport. Unauthenticated to match /query (public read API).

- schema/directives.graphqls: new @mcptool / @mcpExample / @mcpHide
  directives
- schema/aftermarket.graphqls, schema/vehicle.graphqls: annotate
  aftermarketDevice, vehicle, and vehicles with @mcptool / @mcpExample
- graph/mcp_tools_gen.go: generated via server-garage mcpgen; 3 tools
  (identity_get_aftermarket_device, identity_get_vehicle,
  identity_list_vehicles)
- graph/resolver.go: //go:generate runs mcpgen after gqlgen
- cmd/identity-api/main.go: build the MCP handler on the same
  ExecutableSchema as /query, mount at /mcp with zerolog context
  injection
- gqlgen.yml: mark mcpTool / mcpExample skip_runtime
- go.mod: add server-garage + modelcontextprotocol/go-sdk (bumps
  gqlgen to v0.17.89 hence the no-op resolver header churn)
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