Skip to content

Add MCP server endpoint at /mcp#177

Merged
zer0stars merged 3 commits into
mainfrom
feat/mcp-server
Apr 20, 2026
Merged

Add MCP server endpoint at /mcp#177
zer0stars merged 3 commits into
mainfrom
feat/mcp-server

Conversation

@zer0stars

@zer0stars zer0stars commented Mar 25, 2026

Copy link
Copy Markdown
Member

Summary

Expose an MCP (Model Context Protocol) Streamable HTTP endpoint at /mcp so LLM agents can query identity-api's GraphQL surface via the standard MCP transport. Unauthenticated to match the public /query endpoint.

History rewritten on 2026-04-20 — surgical rebase on top of current main replacing the prior branch that had stripped schema docstrings and accumulated ~13 unrelated conflicts.

Why draft

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

  • drop the replace github.com/DIMO-Network/server-garage => /Users/zer0stars/workspace/server-garage 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: mcpTool / mcpExample marked skip_runtime
  • cmd/identity-api/main.go: build MCP handler on the same ExecutableSchema as /query, mount at /mcp, inject zerolog 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
  • After SG v0.1.0 pin: go mod tidy clean; 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

@zer0stars
zer0stars requested a review from elffjs as a code owner March 25, 2026 15:58
@zer0stars
zer0stars force-pushed the feat/mcp-server branch 4 times, most recently from 1a53a2a to 14bd4f7 Compare March 28, 2026 04:15
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)
…ndensed schema trim

- Drop context.Background() arg from New() call
- Regen condensed schema via updated mcpgen (stronger self-evident filter, legend-fold)
- Remove redundant @mcpExample on vehicles(owner:...)
@zer0stars
zer0stars merged commit 2d76c7b into main Apr 20, 2026
2 checks passed
@zer0stars
zer0stars deleted the feat/mcp-server branch April 20, 2026 17:42
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