The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
test(e2e): cover alias MCP grant persisting verbatim on key generate
ryan-crabbe-berri7a761ccf5a22
diff --git a/tests/e2e/coverage_registry/mcp.yaml b/tests/e2e/coverage_registry/mcp.yamlindex ab644118a47..7ed2a7ab2ad 100644--- a/tests/e2e/coverage_registry/mcp.yaml+++ b/tests/e2e/coverage_registry/mcp.yaml@@ -15,6 +15,14 @@assertions: [access_group_scoped]source: "test_mcp_access_group_e2e.py"rationale: "A key granted an MCP access group sees the tagged server's tools; a key with a different group does not. Access-group-scoped tool selection at key creation"+- id: mcp.list_tools.api_key.alias_grant_persists+ module: mcp+ tier: P1+ operation: list_tools+ auth_family: api_key+ assertions: [alias_grant_persists]+ source: "object_permission_utils.py validate_key_mcp_servers_against_team"+ rationale: "A key granted an MCP server by alias keeps the alias verbatim in its stored object_permission (shared-DB multi-region instances each resolve it to their local server id at read time) and still lists the server's tools"- id: mcp.list_tools.api_key.denied_without_permissionmodule: mcptier: P0diff --git a/tests/e2e/mcp/test_mcp_key_access_e2e.py b/tests/e2e/mcp/test_mcp_key_access_e2e.pyindex 88ab5666084..7fe40795f1c 100644--- a/tests/e2e/mcp/test_mcp_key_access_e2e.py+++ b/tests/e2e/mcp/test_mcp_key_access_e2e.py@@ -30,6 +30,35 @@ def _key(client: McpClient, resources: ResourceManager, *, mcp_servers: list[strreturn key+class TestMcpKeyGrantByAlias:+ @pytest.mark.covers("mcp.list_tools.api_key.alias_grant_persists")+ def test_alias_grant_persists_verbatim_and_lists_tools(+ self,+ client: McpClient,+ resources: ResourceManager,+ ) -> None:+ """A key granted an MCP server by its alias must store the alias, not the+ resolved server_id: in a shared-DB multi-region deployment each instance+ derives a different id for the same config server, so only the alias+ grants access on every region. The same key must still see the server's+ tools, proving the alias grant is honored at request time."""+ server_id = register_datadog_mcp(client, resources)+ client.await_registered(server_id)+ alias = next(row.alias for row in client.registered_servers() if row.server_id == server_id)+ assert alias, f"registered server {server_id} has no alias to grant by"++ key = _key(client, resources, mcp_servers=[alias])++ stored = client.proxy.key_info(key).object_permission+ assert stored is not None and stored.mcp_servers == [alias], (+ f"alias grant was rewritten before persisting (expected [{alias!r}]): "+ f"{stored.mcp_servers if stored else None}. A stored server_id is region-local "+ f"and breaks the grant on every other instance sharing this database"+ )++ _ = client.await_tool(key, server_id, SEARCH_LOGS_TOOL)++class TestMcpKeyWithoutAccessIsDenied:@pytest.mark.covers("mcp.list_tools.api_key.denied_without_permission")def test_list_tools_denied_without_permission(diff --git a/tests/e2e/models.py b/tests/e2e/models.pyindex 6d9ccad9a24..967144dfb16 100644--- a/tests/e2e/models.py+++ b/tests/e2e/models.py@@ -114,6 +114,7 @@ class KeyInfo(BaseModel):budget_id: str | None = Nonelitellm_budget_table: LiteLLMBudgetTable | None = Nonebudget_limits: list[BudgetWindowState] | None = None+ object_permission: ObjectPermission | None = Noneclass KeyInfoResponse(BaseModel):