Repository navigation
feat(mcp): add named tools for the OpenAI plugin - #8817
waleedlatif1 wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
There was a problem hiding this comment.
2 issues found across 14 files
Confidence score: 3/5
- A root-path
SIM_MCP_URLmakes the OpenAI endpoint and protected-resource metadata return 404 inhost-routing.ts. Normalize the root pathname before building those routes. - The instructions in
openai.tscan make manual draft runs fail because the tool rejects streaming. Keep manual runs synchronous and reserve async execution for run-ID polling.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/sim/lib/api/mcp/host-routing.ts">
<violation number="1" location="apps/sim/lib/api/mcp/host-routing.ts:50">
P2: A root-path `SIM_MCP_URL` makes the OpenAI endpoint and its protected-resource metadata return 404: `mcp.pathname` is `/`, so these checks expect `//openai` rather than `/openai`. Normalize the root pathname before appending `/openai` in both checks.</violation>
</file>
<file name="apps/sim/lib/api/mcp/openai.ts">
<violation number="1" location="apps/sim/lib/api/mcp/openai.ts:70">
P2: This instruction makes manual draft runs fail: the contract permits them only synchronously or streamed, and this MCP tool rejects streaming. Direct manual runs synchronously; reserve async execution and run-ID polling for deployed runs.</violation>
</file>
| } | ||
| if (pathname === mcp.pathname) return SIM_MCP_ROUTE_PATH | ||
| if (pathname === `${PROTECTED_RESOURCE_METADATA}${mcp.pathname}`) return internalMetadataPath | ||
| if (pathname === `${mcp.pathname}/openai`) return openAiPath |
There was a problem hiding this comment.
P2: A root-path SIM_MCP_URL makes the OpenAI endpoint and its protected-resource metadata return 404: mcp.pathname is /, so these checks expect //openai rather than /openai. Normalize the root pathname before appending /openai in both checks.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At apps/sim/lib/api/mcp/host-routing.ts, line 50:
<comment>A root-path `SIM_MCP_URL` makes the OpenAI endpoint and its protected-resource metadata return 404: `mcp.pathname` is `/`, so these checks expect `//openai` rather than `/openai`. Normalize the root pathname before appending `/openai` in both checks.</comment>
<file context>
@@ -37,15 +37,25 @@ export function resolveSimMcpHostPath(
}
if (pathname === mcp.pathname) return SIM_MCP_ROUTE_PATH
if (pathname === `${PROTECTED_RESOURCE_METADATA}${mcp.pathname}`) return internalMetadataPath
+ if (pathname === `${mcp.pathname}/openai`) return openAiPath
+ if (pathname === `${PROTECTED_RESOURCE_METADATA}${mcp.pathname}/openai`) {
+ return openAiMetadataPath
</file context>
| operation: 'executeWorkflow', | ||
| title: 'Run workflow', | ||
| description: | ||
| 'Run the Sim workflow the user selected with the supplied input. Its configured steps can change or delete data, send messages, contact external services, and consume usage. Inspect the workflow and obtain authorization for those effects before running. Streaming is unsupported; use async execution and read the returned run ID to check completion. Never automatically start another run after an uncertain result.', |
There was a problem hiding this comment.
P2: This instruction makes manual draft runs fail: the contract permits them only synchronously or streamed, and this MCP tool rejects streaming. Direct manual runs synchronously; reserve async execution and run-ID polling for deployed runs.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At apps/sim/lib/api/mcp/openai.ts, line 70:
<comment>This instruction makes manual draft runs fail: the contract permits them only synchronously or streamed, and this MCP tool rejects streaming. Direct manual runs synchronously; reserve async execution and run-ID polling for deployed runs.</comment>
<file context>
@@ -0,0 +1,187 @@
+ operation: 'executeWorkflow',
+ title: 'Run workflow',
+ description:
+ 'Run the Sim workflow the user selected with the supplied input. Its configured steps can change or delete data, send messages, contact external services, and consume usage. Inspect the workflow and obtain authorization for those effects before running. Streaming is unsupported; use async execution and read the returned run ID to check completion. Never automatically start another run after an uncertain result.',
+ readOnly: false,
+ destructive: true,
</file context>
|
| if (pathname === `${mcp.pathname}/openai`) return openAiPath | ||
| if (pathname === `${PROTECTED_RESOURCE_METADATA}${mcp.pathname}/openai`) { | ||
| return openAiMetadataPath |
There was a problem hiding this comment.
With SIM_MCP_URL=https://mcp.example, getSimMcpUrl('openai') advertises /openai, but these checks expect //openai because mcp.pathname is /. The advertised endpoint and its OAuth metadata therefore return 404 on the dedicated host.
Build both checks from new URL(getSimMcpUrl('openai')).pathname so root-host configurations work too.
Knowledge Base Used: MCP server and tool access
Summary
Type of Change
Testing
Checklist
test-auditauthoring gate)