diff --git a/scripts/production-mcp-smoke.mjs b/scripts/production-mcp-smoke.mjs index f0e8170..1a504a5 100644 --- a/scripts/production-mcp-smoke.mjs +++ b/scripts/production-mcp-smoke.mjs @@ -27,16 +27,21 @@ let requestSequence = 0; async function mcp(method, params = {}) { requestSequence += 1; + const headers = { + Accept: 'application/json, text/event-stream', + Authorization: `Bearer ${accessToken}`, + 'Content-Type': 'application/json', + 'MCP-Protocol-Version': protocolVersion, + 'Mcp-Method': method, + }; + if (method === 'tools/call' && typeof params.name === 'string') { + headers['Mcp-Name'] = params.name; + } + const response = await fetch(endpoint, { method: 'POST', redirect: 'error', - headers: { - Accept: 'application/json, text/event-stream', - Authorization: `Bearer ${accessToken}`, - 'Content-Type': 'application/json', - 'MCP-Protocol-Version': protocolVersion, - 'Mcp-Method': method, - }, + headers, body: JSON.stringify({ jsonrpc: '2.0', id: `production-smoke-${requestSequence}`, diff --git a/scripts/production-oauth-smoke.mjs b/scripts/production-oauth-smoke.mjs index 41d6371..e00b1d9 100644 --- a/scripts/production-oauth-smoke.mjs +++ b/scripts/production-oauth-smoke.mjs @@ -175,23 +175,26 @@ async function assertMcpRead(token, label) { const callResponse = await mcpRequest(token, 'tools/call', { name: 'list_apps', arguments: {}, - }); + }, 'list_apps'); assert.equal(callResponse.status, 200, `${label} could not call list_apps`); const called = await callResponse.json(); assert.notEqual(called.result?.isError, true, `${label} list_apps returned a tool error`); } -function mcpRequest(token, method, params = {}) { +function mcpRequest(token, method, params = {}, toolName) { + const headers = { + Accept: 'application/json, text/event-stream', + Authorization: `Bearer ${token}`, + 'Content-Type': 'application/json', + 'MCP-Protocol-Version': '2026-07-28', + 'Mcp-Method': method, + }; + if (toolName) headers['Mcp-Name'] = toolName; + return fetch(resource, { method: 'POST', redirect: 'error', - headers: { - Accept: 'application/json, text/event-stream', - Authorization: `Bearer ${token}`, - 'Content-Type': 'application/json', - 'MCP-Protocol-Version': '2026-07-28', - 'Mcp-Method': method, - }, + headers, body: JSON.stringify({ jsonrpc: '2.0', id: `oauth-smoke-${method}`,