diff --git a/apps/e2e/bin/deploy-fixtures.ts b/apps/e2e/bin/deploy-fixtures.ts index 12afcc8f..615510c2 100644 --- a/apps/e2e/bin/deploy-fixtures.ts +++ b/apps/e2e/bin/deploy-fixtures.ts @@ -16,7 +16,7 @@ const fixtures = [ // 'pricing-3-plans', // 'pricing-monthly-annual', // 'pricing-custom-0', - 'basic-openapi', + // 'basic-openapi', 'basic-mcp', 'everything-openapi' ] diff --git a/apps/e2e/src/http-e2e.test.ts b/apps/e2e/src/http-e2e.test.ts index 3814f3fe..65a2990e 100644 --- a/apps/e2e/src/http-e2e.test.ts +++ b/apps/e2e/src/http-e2e.test.ts @@ -94,6 +94,13 @@ for (const [i, fixtureSuite] of fixtureSuites.entries()) { body = await res.arrayBuffer() } + if (debugFixture) { + console.log(`${fixtureName} => ${res.status}`, { + body, + headers: Object.fromEntries(res.headers.entries()) + }) + } + if (expectedBody) { expect(body).toEqual(expectedBody) } @@ -119,13 +126,6 @@ for (const [i, fixtureSuite] of fixtureSuites.entries()) { expect(body).toEqual(fixtureResponseBody) } } - - if (debugFixture) { - console.log(`${fixtureName} => ${res.status}`, { - body, - headers: Object.fromEntries(res.headers.entries()) - }) - } } ) } diff --git a/apps/e2e/src/http-fixtures.ts b/apps/e2e/src/http-fixtures.ts index ef8011f1..1b571ddb 100644 --- a/apps/e2e/src/http-fixtures.ts +++ b/apps/e2e/src/http-fixtures.ts @@ -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' + ) + } + } + } + ] } ] diff --git a/apps/e2e/src/mcp-fixtures.ts b/apps/e2e/src/mcp-fixtures.ts index 9e4cdc91..266a56ec 100644 --- a/apps/e2e/src/mcp-fixtures.ts +++ b/apps/e2e/src/mcp-fixtures.ts @@ -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' + ) + } + } + } + ] } ] diff --git a/apps/gateway/src/lib/durable-mcp-client.ts b/apps/gateway/src/lib/durable-mcp-client.ts index 999b16a8..008fca44 100644 --- a/apps/gateway/src/lib/durable-mcp-client.ts +++ b/apps/gateway/src/lib/durable-mcp-client.ts @@ -26,14 +26,18 @@ export class DurableMcpClientBase extends DurableObject { const existingMcpClientInfo = await this.ctx.storage.get('mcp-client-info') - if (!existingMcpClientInfo) { - await this.ctx.storage.put('mcp-client-info', mcpClientInfo) - } else { - assert( - mcpClientInfo.url === existingMcpClientInfo.url, - 500, - `DurableMcpClientInfo url mismatch: "${mcpClientInfo.url}" vs "${existingMcpClientInfo.url}"` - ) + await this.ctx.storage.put('mcp-client-info', mcpClientInfo) + if (existingMcpClientInfo) { + if (mcpClientInfo.url !== existingMcpClientInfo.url) { + // eslint-disable-next-line no-console + console.warn( + `DurableMcpClientInfo url changed from "${existingMcpClientInfo.url}" to "${mcpClientInfo.url}"` + ) + } + + await this.client?.close() + this.clientConnectionP = undefined + this.client = undefined } return this.ensureClientConnection(mcpClientInfo) diff --git a/packages/fixtures/valid/basic-mcp/agentic.config.ts b/packages/fixtures/valid/basic-mcp/agentic.config.ts index 504329e5..beacd893 100644 --- a/packages/fixtures/valid/basic-mcp/agentic.config.ts +++ b/packages/fixtures/valid/basic-mcp/agentic.config.ts @@ -3,7 +3,7 @@ import { defineConfig } from '@agentic/platform' export default defineConfig({ name: 'test-basic-mcp', // originUrl: 'http://localhost:8080/stream', - originUrl: 'https://agentic-basic-mcp-test.onrender.com/stream', + originUrl: 'https://agentic-basic-mcp-test.onrender.com/mcp', originAdapter: { type: 'mcp' }