pull/715/head
Travis Fischer 2025-06-12 06:44:44 +07:00
rodzic 0a7fa93f6b
commit 259f988f52
6 zmienionych plików z 57 dodań i 17 usunięć

Wyświetl plik

@ -16,7 +16,7 @@ const fixtures = [
// 'pricing-3-plans', // 'pricing-3-plans',
// 'pricing-monthly-annual', // 'pricing-monthly-annual',
// 'pricing-custom-0', // 'pricing-custom-0',
'basic-openapi', // 'basic-openapi',
'basic-mcp', 'basic-mcp',
'everything-openapi' 'everything-openapi'
] ]

Wyświetl plik

@ -94,6 +94,13 @@ for (const [i, fixtureSuite] of fixtureSuites.entries()) {
body = await res.arrayBuffer() body = await res.arrayBuffer()
} }
if (debugFixture) {
console.log(`${fixtureName} => ${res.status}`, {
body,
headers: Object.fromEntries(res.headers.entries())
})
}
if (expectedBody) { if (expectedBody) {
expect(body).toEqual(expectedBody) expect(body).toEqual(expectedBody)
} }
@ -119,13 +126,6 @@ for (const [i, fixtureSuite] of fixtureSuites.entries()) {
expect(body).toEqual(fixtureResponseBody) expect(body).toEqual(fixtureResponseBody)
} }
} }
if (debugFixture) {
console.log(`${fixtureName} => ${res.status}`, {
body,
headers: Object.fromEntries(res.headers.entries())
})
}
} }
) )
} }

Wyświetl plik

@ -626,5 +626,21 @@ export const fixtureSuites: E2ETestFixtureSuite[] = [
} }
} }
] ]
},
{
title: 'HTTP => OpenAPI origin everything "echo_headers" tool',
snapshot: false,
fixtures: [
{
path: '@dev/test-everything-openapi/echo_headers',
response: {
validate: (body) => {
expect(body['x-agentic-proxy-secret']).toEqual(
'f279280a67a15df6e0245511bdeb11854fc8f6f702c49d028431bb1dbc03bfdc'
)
}
}
}
]
} }
] ]

Wyświetl plik

@ -557,5 +557,25 @@ export const fixtureSuites: MCPE2ETestFixtureSuite[] = [
} }
} }
] ]
},
{
title: 'MCP => OpenAPI origin everything "echo_headers" tool',
path: '@dev/test-everything-openapi/mcp',
stableSnapshot: false,
fixtures: [
{
request: {
name: 'echo_headers',
args: {}
},
response: {
validate: (result) => {
expect(result.structuredContent['x-agentic-proxy-secret']).toEqual(
'f279280a67a15df6e0245511bdeb11854fc8f6f702c49d028431bb1dbc03bfdc'
)
}
}
}
]
} }
] ]

Wyświetl plik

@ -26,14 +26,18 @@ export class DurableMcpClientBase extends DurableObject<RawEnv> {
const existingMcpClientInfo = const existingMcpClientInfo =
await this.ctx.storage.get<DurableMcpClientInfo>('mcp-client-info') await this.ctx.storage.get<DurableMcpClientInfo>('mcp-client-info')
if (!existingMcpClientInfo) { await this.ctx.storage.put('mcp-client-info', mcpClientInfo)
await this.ctx.storage.put('mcp-client-info', mcpClientInfo) if (existingMcpClientInfo) {
} else { if (mcpClientInfo.url !== existingMcpClientInfo.url) {
assert( // eslint-disable-next-line no-console
mcpClientInfo.url === existingMcpClientInfo.url, console.warn(
500, `DurableMcpClientInfo url changed from "${existingMcpClientInfo.url}" to "${mcpClientInfo.url}"`
`DurableMcpClientInfo url mismatch: "${mcpClientInfo.url}" vs "${existingMcpClientInfo.url}"` )
) }
await this.client?.close()
this.clientConnectionP = undefined
this.client = undefined
} }
return this.ensureClientConnection(mcpClientInfo) return this.ensureClientConnection(mcpClientInfo)

Wyświetl plik

@ -3,7 +3,7 @@ import { defineConfig } from '@agentic/platform'
export default defineConfig({ export default defineConfig({
name: 'test-basic-mcp', name: 'test-basic-mcp',
// originUrl: 'http://localhost:8080/stream', // originUrl: 'http://localhost:8080/stream',
originUrl: 'https://agentic-basic-mcp-test.onrender.com/stream', originUrl: 'https://agentic-basic-mcp-test.onrender.com/mcp',
originAdapter: { originAdapter: {
type: 'mcp' type: 'mcp'
} }