Skip to content

Commit 57235de

Browse files
feat(mcp): add Codex client configuration (#7164)
* feat(mcp): add Codex client configuration * fix(mcp): keep Codex key creation action
1 parent 90ff5d0 commit 57235de

6 files changed

Lines changed: 55 additions & 16 deletions

File tree

apps/docs/content/docs/en/workflows/deployment/mcp.mdx

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ Sim generates a ready-to-paste configuration for every supported client. To get
112112

113113
1. Navigate to **Settings → MCP Servers**
114114
2. Click **Details** on your server
115-
3. Under **MCP Client**, select your client — **Cursor**, **Claude Code**, **Claude Desktop**, **VS Code**, or **Sim**
116-
4. Copy the configuration, replacing `$SIM_API_KEY` with your Sim API key
115+
3. Under **MCP Client**, select your client — **Cursor**, **Codex**, **Claude Code**, **Claude Desktop**, **VS Code**, or **Sim**
116+
4. Copy the configuration and follow the authentication note below it
117117

118118
<div className="flex justify-center">
119119
<Image
@@ -142,6 +142,18 @@ Cursor supports direct URL configuration. Add to your Cursor MCP settings (`.cur
142142

143143
Cursor also provides a one-click install button in the server detail view.
144144

145+
### Codex
146+
147+
Add this to your Codex configuration (`~/.codex/config.toml`):
148+
149+
```toml
150+
[mcp_servers."my-sim-workflows"]
151+
url = "YOUR_SERVER_URL"
152+
env_http_headers = { "X-API-Key" = "SIM_API_KEY" }
153+
```
154+
155+
Set the `SIM_API_KEY` environment variable before starting Codex. The ChatGPT desktop app, Codex CLI, and Codex IDE extension share this configuration.
156+
145157
### Claude Code
146158

147159
Run this command in your terminal:
@@ -185,7 +197,7 @@ For public servers, omit the `X-API-Key` header and `--header` arguments. Public
185197
</Callout>
186198

187199
<Callout type="warn">
188-
`$SIM_API_KEY` is a placeholder. For Claude Desktop and VS Code configs, replace it with your actual API key since these clients don't expand environment variables in JSON config files. Claude Code and Cursor handle variable expansion natively.
200+
`$SIM_API_KEY` is a placeholder. For Claude Desktop and VS Code configs, replace it with your actual API key since these clients don't expand environment variables in JSON config files. Codex reads `SIM_API_KEY` from the environment, while Claude Code and Cursor handle variable expansion natively.
189201
</Callout>
190202

191203
## Server Management
@@ -226,5 +238,3 @@ Workflows execute using the same deployment version as API calls, ensuring consi
226238
{ question: "What naming conventions should I follow for tool names?", answer: "Use lowercase letters, numbers, and underscores only. The name should be descriptive and follow MCP naming conventions, such as search_documents or send_email. This helps AI assistants understand and correctly invoke your tools." },
227239
{ question: "How are workflow inputs mapped to MCP tool parameters?", answer: "Your workflow's input format fields automatically become MCP tool parameters. Each parameter's description defaults to the description set on that input in the Start block, and you can override it per tool in the MCP configuration to help AI assistants understand what values to provide." },
228240
]} />
229-
230-

apps/sim/app/workspace/[workspaceId]/settings/components/workflow-mcp-servers/workflow-mcp-servers.tsx

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ interface ServerDetailViewProps {
7676
isDeleting: boolean
7777
}
7878

79-
type McpClientType = 'sim' | 'cursor' | 'claude-code' | 'claude-desktop' | 'vscode'
79+
type McpClientType = 'sim' | 'cursor' | 'codex' | 'claude-code' | 'claude-desktop' | 'vscode'
8080

8181
function ServerDetailView({
8282
canManage,
@@ -278,6 +278,14 @@ function ServerDetailView({
278278
return `claude mcp add "${safeName}" --url "${mcpServerUrl}" --header "X-API-Key:$SIM_API_KEY"`
279279
}
280280

281+
if (client === 'codex') {
282+
return [
283+
`[mcp_servers."${safeName}"]`,
284+
`url = "${mcpServerUrl}"`,
285+
...(isPublic ? [] : ['env_http_headers = { "X-API-Key" = "SIM_API_KEY" }']),
286+
].join('\n')
287+
}
288+
281289
if (client === 'cursor') {
282290
const cursorConfig = isPublic
283291
? { url: mcpServerUrl }
@@ -502,6 +510,7 @@ function ServerDetailView({
502510
onValueChange={(v) => setActiveConfigTab(v as McpClientType)}
503511
>
504512
<ButtonGroupItem value='cursor'>Cursor</ButtonGroupItem>
513+
<ButtonGroupItem value='codex'>Codex</ButtonGroupItem>
505514
<ButtonGroupItem value='claude-code'>Claude Code</ButtonGroupItem>
506515
<ButtonGroupItem value='claude-desktop'>Claude Desktop</ButtonGroupItem>
507516
<ButtonGroupItem value='vscode'>VS Code</ButtonGroupItem>
@@ -589,7 +598,13 @@ function ServerDetailView({
589598
<div className='relative'>
590599
<Code.Viewer
591600
code={getConfigSnippet(activeConfigTab, server.isPublic, server.name)}
592-
language={activeConfigTab === 'claude-code' ? 'javascript' : 'json'}
601+
language={
602+
activeConfigTab === 'claude-code'
603+
? 'bash'
604+
: activeConfigTab === 'codex'
605+
? 'toml'
606+
: 'json'
607+
}
593608
wrapText
594609
className='!min-h-0 rounded-sm border border-[var(--border-1)]'
595610
/>
@@ -606,9 +621,21 @@ function ServerDetailView({
606621
</a>
607622
)}
608623
</div>
624+
{activeConfigTab === 'codex' && server.isPublic && (
625+
<p className='mt-2 text-[var(--text-muted)] text-caption'>
626+
Add this to <span className='font-mono'>~/.codex/config.toml</span>.
627+
</p>
628+
)}
609629
{!server.isPublic && (
610630
<p className='mt-2 text-[var(--text-muted)] text-caption'>
611-
Replace $SIM_API_KEY with your API key
631+
{activeConfigTab === 'codex' ? (
632+
<>
633+
Add this to <span className='font-mono'>~/.codex/config.toml</span> and
634+
set the SIM_API_KEY environment variable with an existing API key
635+
</>
636+
) : (
637+
'Replace $SIM_API_KEY with your API key'
638+
)}
612639
{canManage && (
613640
<>
614641
, or{' '}
@@ -621,6 +648,7 @@ function ServerDetailView({
621648
</button>
622649
</>
623650
)}
651+
{activeConfigTab === 'codex' && '.'}
624652
</p>
625653
)}
626654
</div>

apps/sim/content/library/how-to-turn-a-workflow-into-a-reusable-mcp-tool/index.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ faq:
1919
- q: "Does Sim support MCP as both a client and server?"
2020
a: "Yes. Sim workflows can call tools on external MCP servers, and deployed Sim workflows can be published as MCP tools for other compatible clients."
2121
- q: "Can Claude or another assistant call a Sim workflow?"
22-
a: "Yes, when the assistant supports MCP connections. Sim provides connection configurations for Claude Desktop, Cursor, VS Code, and Claude Code, while other compatible clients can use the same server details."
22+
a: "Yes, when the assistant supports MCP connections. Sim provides connection configurations for Codex, Claude Desktop, Cursor, VS Code, and Claude Code, while other compatible clients can use the same server details."
2323
- q: "How is a published Sim MCP server authenticated?"
2424
a: "A Sim MCP server can use API Key access, where clients send an X-API-Key header containing a Sim API key, or Public access without authentication. Tool calls run the live deployment and consume workspace credits like other executions."
2525
- q: "Is MCP different from a REST API deployment?"
@@ -34,7 +34,7 @@ To turn a workflow into a reusable MCP tool, you build the workflow with clearly
3434
- Build the workflow and define its Start-block inputs and outputs.
3535
- Deploy a versioned snapshot of the workflow.
3636
- Create an MCP server and add the deployed workflow to it as a tool.
37-
- Connect the server to Claude Desktop, Cursor, VS Code, Claude Code, or another MCP-compatible client.
37+
- Connect the server to Codex, Claude Desktop, Cursor, VS Code, Claude Code, or another MCP-compatible client.
3838
- As of August 2026, [n8n](https://docs.n8n.io/advanced-ai/accessing-n8n-mcp-server/), [Gumloop](https://docs.gumloop.com/nodes/mcp), and [Zapier](https://zapier.com/mcp) all support MCP on both sides in some form. What differs is the publishing model: node or instance configuration, a platform control plane, and an action catalog respectively.
3939

4040
## What does it mean to turn a workflow into a reusable MCP tool?
@@ -54,7 +54,7 @@ Sim turns a deployed workflow into an MCP tool on an MCP server that external as
5454
1. **Build the workflow.** Create the capability in Sim. Wire the Start trigger, Agent blocks, integrations, data, code, and control logic needed to complete the task. Define clear Start-block inputs and outputs, because those become the tool's parameters and shape how an external assistant calls it.
5555
2. **Deploy a versioned snapshot.** Deploy when the behavior is ready for external callers. Sim freezes an immutable snapshot as a numbered version and marks one version live. Canvas edits stay in the draft until you publish an update, and promoting an earlier version rolls the live tool back. Every surface—API, chat, and MCP—runs that same live snapshot.
5656
3. **Create an MCP server and add the workflow as a tool.** In Settings, add an MCP server with a name and an access mode. Then open the deployed workflow, go to the MCP tab in the Deploy view, set the tool name and description, review the parameter descriptions derived from the Start inputs, select one or more MCP servers, and save the tool. One server can host many workflow tools, and a workflow must already be deployed before it can be added.
57-
4. **Connect an external MCP client.** From the server's details view, copy the ready-made configuration for Cursor, Claude Desktop, VS Code, Claude Code, or another host. Private servers expect an `X-API-Key` header carrying a Sim API key. When the assistant invokes the tool, Sim runs the live snapshot and returns the output over MCP.
57+
4. **Connect an external MCP client.** From the server's details view, copy the ready-made configuration for Codex, Cursor, Claude Desktop, VS Code, Claude Code, or another host. Private servers expect an `X-API-Key` header carrying a Sim API key. When the assistant invokes the tool, Sim runs the live snapshot and returns the output over MCP.
5858

5959
Sim also works in the opposite direction. A Sim workflow can [connect to external MCP servers](https://docs.sim.ai/mcp) and call their tools. Sim therefore acts as both an MCP client and an MCP server, which lets one workflow consume outside capabilities and publish its own capability for reuse.
6060

@@ -109,6 +109,6 @@ Current as of August 2026.
109109

110110
## Get started
111111

112-
Build a new workflow or open an existing one in [Sim](https://sim.ai). Once the workflow behaves as expected, deploy a versioned snapshot, then create an MCP server and add the workflow to it as a tool by following the [MCP deployment documentation](https://docs.sim.ai/workflows/deployment/mcp). You can then connect the server to Claude Desktop, Cursor, VS Code, Claude Code, or another MCP-compatible client.
112+
Build a new workflow or open an existing one in [Sim](https://sim.ai). Once the workflow behaves as expected, deploy a versioned snapshot, then create an MCP server and add the workflow to it as a tool by following the [MCP deployment documentation](https://docs.sim.ai/workflows/deployment/mcp). You can then connect the server to Codex, Claude Desktop, Cursor, VS Code, Claude Code, or another MCP-compatible client.
113113

114114
Sim suits developers who want one maintained workflow to provide the same callable capability across every MCP-compatible assistant they use.

apps/sim/lib/compare/data/sim.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ export const simProfile: CompetitorProfile = {
752752
},
753753
mcpPublishing: {
754754
value:
755-
'Yes: any deployed workflow can be published as a tool on an MCP server (private, API-key protected, or public/no-auth), with ready-to-paste client config generated for Cursor, Claude Code, Claude Desktop, and VS Code',
755+
'Yes: any deployed workflow can be published as a tool on an MCP server (private, API-key protected, or public/no-auth), with ready-to-paste client config generated for Codex, Cursor, Claude Code, Claude Desktop, and VS Code',
756756
shortValue: 'Deployed workflows publish as MCP server tools',
757757
confidence: 'verified',
758758
sources: [

packages/emcn/src/components/code/code.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ type PrismModule = typeof import('./prism')
2525
/**
2626
* Module-level singleton promise for the lazily-loaded Prism module.
2727
*
28-
* Prism (core + the side-effectful JS/Python/JSON/Bash grammar registrations) is kept
28+
* Prism (core + the side-effectful JS/Python/JSON/Bash/TOML grammar registrations) is kept
2929
* out of this module's static import graph so it never lands in bundles that only
3030
* pull `Code` through the shared `@sim/emcn` barrel. It is loaded once per
3131
* session on the first highlight and cached here for all subsequent viewers.
@@ -861,7 +861,7 @@ interface CodeViewerProps {
861861
/** Whether to show line numbers gutter */
862862
showGutter?: boolean
863863
/** Language for syntax highlighting (default: 'json') */
864-
language?: 'javascript' | 'json' | 'python' | 'bash'
864+
language?: 'javascript' | 'json' | 'python' | 'bash' | 'toml'
865865
/** Additional CSS classes for the container */
866866
className?: string
867867
/** Visual density for read-only code. */
@@ -951,7 +951,7 @@ type ViewerInnerProps = {
951951
/** Whether to show line numbers gutter */
952952
showGutter: boolean
953953
/** Language for syntax highlighting */
954-
language: 'javascript' | 'json' | 'python' | 'bash'
954+
language: 'javascript' | 'json' | 'python' | 'bash' | 'toml'
955955
/** Additional CSS classes for the container */
956956
className?: string
957957
/** Visual density for read-only code. */

packages/emcn/src/components/code/prism.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import 'prismjs/components/prism-javascript'
33
import 'prismjs/components/prism-python'
44
import 'prismjs/components/prism-json'
55
import 'prismjs/components/prism-bash'
6+
import 'prismjs/components/prism-toml'
67

78
/**
89
* Prism.js highlighting utilities isolated in a dedicated module.

0 commit comments

Comments
 (0)