feat: MCP request_key tool and agent identity headers (Stories 2.2 + 2.4)#130
Merged
farovictor merged 1 commit intomainfrom Apr 5, 2026
Merged
feat: MCP request_key tool and agent identity headers (Stories 2.2 + 2.4)#130farovictor merged 1 commit intomainfrom
farovictor merged 1 commit intomainfrom
Conversation
…2.4) - Implement request_key MCP tool: accepts service_name, ttl_seconds (default 3600), rate_limit (default 60); issues a virtual key tagged source=mcp - Add Source field to VirtualKey model + migration 007 - Inject X-Bifrost-Key-ID on all proxied requests (server-side, unspoofable) - Inject X-Bifrost-Agent-ID on proxied requests when key source=mcp - Document injected headers and MCP tools in doc/api.md - Add 7 new tests: request_key happy path, defaults, service not found, missing service_name, key-id header, agent-id header for MCP, no agent-id for regular keys - Regenerate swagger spec Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
request_keyMCP tool: agents calltools/callwithservice_nameto get a short-lived virtual key;ttl_seconds(default 3600) andrate_limit(default 60) are optional. Issued keys are taggedsource: "mcp"and appear inGET /v1/keys.X-Bifrost-Key-ID— always present, identifies the virtual key usedX-Bifrost-Agent-ID— present only on MCP-issued keys, identifies the agent sessionsourcecolumn tovirtual_keystable (migration 007)doc/api.md+ regenerated swagger specTest plan
TestMCPRequestKey— happy path: key issued, stored, taggedsource=mcpTestMCPRequestKeyDefaults— default TTL=3600s, rate_limit=60TestMCPRequestKeyServiceNotFound— returns JSON-RPC errorTestMCPRequestKeyMissingServiceName— returns JSON-RPC errorTestProxyInjectsKeyIDHeader—X-Bifrost-Key-IDon all requestsTestProxyInjectsAgentIDForMCPKey—X-Bifrost-Agent-IDon MCP keysTestProxyNoAgentIDForRegularKey— header absent for regular keys🤖 Generated with Claude Code