Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

Merge remote-tracking branch 'origin/dev' into fix/deeplink-dialog

Diego Zacariase0bd84dcfe60
diff --cc mcp-host/src/contextMapperClient.test.ts
index 5f1077044,ed0aae40f..e0e27a23f
--- a/mcp-host/src/contextMapperClient.test.ts
+++ b/mcp-host/src/contextMapperClient.test.ts
@@@ -273,6 -273,70 +273,66 @@@ describe('ContextMapperClient Host-scop
)
})
+ it('preserves a valid authKind from the v2 inventory (mini-spec 10 §3.3)', async () => {
+ vi.stubGlobal(
+ 'fetch',
- vi
- .fn()
- .mockResolvedValue(
- new Response(JSON.stringify(inventory([authorizedServer({ authKind: 'oauth-user' })])), {
- status: 200,
- })
- )
++ vi.fn().mockResolvedValue(
++ new Response(JSON.stringify(inventory([authorizedServer({ authKind: 'oauth-user' })])), {
++ status: 200,
++ })
++ )
+ )
+ const client = new ContextMapperClient('http://context-mapper.test', {
+ authentication: authentication(),
+ })
+
+ const result = await client.pollServers()
+ expect(result.servers[0].authKind).toBe('oauth-user')
+ })
+
+ it('rejects an authKind value outside the enum', async () => {
+ vi.stubGlobal(
+ 'fetch',
- vi
- .fn()
- .mockResolvedValue(
- new Response(JSON.stringify(inventory([authorizedServer({ authKind: 'oauth-admin' })])), {
- status: 200,
- })
- )
++ vi.fn().mockResolvedValue(
++ new Response(JSON.stringify(inventory([authorizedServer({ authKind: 'oauth-admin' })])), {
++ status: 200,
++ })
++ )
+ )
+ const client = new ContextMapperClient('http://context-mapper.test', {
+ authentication: authentication(),
+ })
+
+ await expect(client.pollServers()).rejects.toThrow(
+ 'HCC inventory response contains an invalid authKind'
+ )
+ })
+
+ it('still rejects forbidden metadata even when a valid authKind is present (guard intact, I1)', async () => {
+ vi.stubGlobal(
+ 'fetch',
+ vi
+ .fn()
+ .mockResolvedValue(
+ new Response(
+ JSON.stringify(
+ inventory([
+ authorizedServer({ authKind: 'oauth-context', contextRef: 'foreign-context' }),
+ ])
+ ),
+ { status: 200 }
+ )
+ )
+ )
+ const client = new ContextMapperClient('http://context-mapper.test', {
+ authentication: authentication(),
+ })
+
+ await expect(client.pollServers()).rejects.toThrow(
+ 'HCC inventory response contains forbidden authority metadata'
+ )
+ })
+
it('accepts an authenticated HTTP 200 empty inventory as authoritative', async () => {
vi.stubGlobal(
'fetch',