Add MCP server endpoint at /mcp (clean rebase of #177)#180
Draft
Add MCP server endpoint at /mcp (clean rebase of #177)#180
Conversation
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fresh, clean rebase of the MCP server work from #177. Built surgically on top of current
maininstead 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
/mcpfor LLM agents. Unauthenticated, matching the public/queryendpoint.Why draft
Depends on server-garage v0.1.0 (DIMO-Network/server-garage#31). Before merging:
replace github.com/DIMO-Network/server-garage => /Users/zer0stars/workspace/server-garageline fromgo.modgithub.com/DIMO-Network/server-garage v0.1.0go mod tidyWhat's in this PR
graph/schema/directives.graphqls(new):@mcpTool/@mcpExample/@mcpHidegraph/schema/aftermarket.graphqls,graph/schema/vehicle.graphqls: annotateaftermarketDevice,vehicle,vehicleswith@mcpTool/@mcpExample(docstrings preserved)graph/mcp_tools_gen.go(new): generated bymcpgen; 3 tools —identity_get_aftermarket_device,identity_get_vehicle,identity_list_vehiclesgraph/resolver.go://go:generatenow runsmcpgenaftergqlgengqlgen.yml: markmcpTool/mcpExampleasskip_runtimecmd/identity-api/main.go: build MCP handler on the sameExecutableSchemaas/query, mount at/mcp, inject zerolog into request contextgo.mod: addserver-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-lintcleango generate ./graph/...produces stable outputgo mod tidy, confirm CI greenPOST /mcptools/listreturns 3 tools;tools/call identity_get_vehiclereturns vehicle datahttps://identity-api.dev.dimo.zone/mcpwithtools/listSupersedes
Supersedes #177. Leaving #177 open pending decision on whether to close it or rewrite its history.