Open
Conversation
7fde7be to
34c5b10
Compare
34c5b10 to
f5baa66
Compare
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
Adds an MCP (Model Context Protocol) endpoint at
/mcpso LLM-based agents can discover and query the telemetry API via the standard MCP Streamable HTTP transport, with full JWT authentication.What's new
/mcpendpoint — Serves MCP tools backed by the existing GraphQL API. Executes queries internally (no network hop)./query:PanicRecovery → Logger → RequestTimeout → CheckJWT → AddClaimHandler. JWT claims flow through to gqlgen directives (@requiresVehicleToken,@requiresAllOfPrivileges) via context propagation.@mcpTooldirective — Annotates commonly used queries for typed shortcut tools.Security model
The
@requiresVehicleTokenand@requiresAllOfPrivilegesdirectives enforce access control identically to the/queryendpoint.MCP tools exposed
telemetry_get_schematelemetry_querytelemetry_get_latest_signalstelemetry_get_available_signalstelemetry_get_daily_activityDependencies
pkg/mcpserver+cmd/mcpgen)go mod replacefor local development — will be updated to a tagged version after server-garage is mergedFiles changed
schema/mcp.graphqls—@mcpTooldirective definitionschema/base.graphqls—@mcpToolonsignalsLatestandavailableSignalsschema/segments.graphqls—@mcpToolondailyActivityinternal/graph/mcp_tools_gen.go— Generated tool definitions (viamcpgen)internal/graph/resolver.go— Added//go:generate mcpgendirectivegqlgen.yml—mcpTool: skip_runtime: trueinternal/app/app.go— Create MCP handler with auth middleware, addMCPHandlertoAppstructcmd/telemetry-api/main.go— Mount MCP handler at/mcpTest plan
/mcpendpoint with valid JWTtelemetry_get_latest_signalsreturns signal data for authorized vehicle