Skip to content

feat(mcp): add named tools for the OpenAI plugin - #8817

Closed
waleedlatif1 wants to merge 1 commit into
stagingfrom
codex/openai-plugin-submission
Closed

waleedlatif1 wants to merge 1 commit into
stagingfrom
codex/openai-plugin-submission

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Add a public plugin MCP profile that advertises eleven individually named workspace, workflow, run, and table tools with contract-derived input schemas and explicit safety annotations.
  • Keep dispatch through existing authorized v2 operations, require an exact OAuth resource audience, and serve the public ownership challenge for directory verification.

Type of Change

  • New feature

Testing

  • Regression cases for public tool discovery, hidden executor rejection, write-scope challenges, host routing, and OAuth resource binding; verified failures before implementation.
  • Full repository lint, type-check, all 58 audits, docs-manifest check, block-registry check, and actionlint passed.
  • Script suite passed (386 tests) with one worker and a 30-second timeout. The default run timed out in unrelated release-script tests under host load.
  • All 20 workspace test tasks passed, including 36,756 app tests, with two workers and a 30-second default timeout.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Oct 9, 2026 12:40am UTC

Request Review

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 14 files

Confidence score: 3/5

  • A root-path SIM_MCP_URL makes the OpenAI endpoint and protected-resource metadata return 404 in host-routing.ts. Normalize the root pathname before building those routes.
  • The instructions in openai.ts can 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>

Turn on auto-fix | Re-trigger cubic

}
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

@cubic-dev-ai cubic-dev-ai Bot Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Fix with cubic

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.',

@cubic-dev-ai cubic-dev-ai Bot Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Fix with cubic

@greptile-apps

greptile-apps Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[High impact] Adds a new public MCP endpoint for OpenAI plugin integration.

Fix root-host routing before merging so supported self-hosted configurations can connect the plugin.

Findings

  1. P1 Plugin fails on root hosts ▶

Summary

Adds an OpenAI MCP profile with eleven named tools backed by existing v2 operations.

  • Publishes contract-derived inputs, safety hints, and profile-specific OAuth metadata.
  • Keeps exact OAuth audience checks and rejects hidden executors.
  • Adds a public ownership challenge and dedicated-host routing.
  • Root-host MCP configurations need a routing fix before merging.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Client[OpenAI client] --> Host[Plugin URL]
  Host --> Route["/api/mcp/openai"]
  Route --> Auth[Check credential and resource]
  Auth --> Scope[Check operation scope]
  Scope --> Tools[Resolve named tool]
  Tools --> Dispatch[Forward original credential]
  Dispatch --> V2[Existing authorized v2 route]
  V2 --> Result[Bounded JSON tool result]
  Result --> Client
Loading

Reviews (1) · Last reviewed commit: "feat(mcp): add named tools for the OpenA..." · Reviewed by Greptile

Comment on lines +50 to +52
if (pathname === `${mcp.pathname}/openai`) return openAiPath
if (pathname === `${PROTECTED_RESOURCE_METADATA}${mcp.pathname}/openai`) {
return openAiMetadataPath

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Plugin fails on root hosts

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

@waleedlatif1
waleedlatif1 deleted the codex/openai-plugin-submission branch October 9, 2026 01:01

This branch was previously deployed

1 inactive deployment
Preview — 5453ade2 Deployed Oct 9, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant