Add MCP support.
Would it be possible to have MCP servers support in codex?
i'd defo love to see that. me and many others.
Tbh, It's kinda weird that it was launched without MCP support, it's kind of a standard.
we need MCP support. Without MCP, this is not much useful
Codex is great, but a huge step backwards vs Cursor agent mode or Claude Code, which both have MCP support.
I will hold off testing Codex until MCP support is added.
I can't really test this without MCP support, it would be a step back
Hey folks, following up on the discussion about potentially integrating MCP here.
Just wanted to put a library I've been working on onto the radar, in case it might help accelerate things if we go down the MCP route. It's called omcph (https://github.com/lefrog-dont-code/omcph) and it's basically a ready-made TypeScript client host for managing connections to MCP servers.
The idea is to handle some of the boilerplate involved in being an MCP Host, like:
- Connecting to multiple servers (stdio, streamable-http, websockets, etc.)
- Aggregating capabilities (tools, resources, prompts) from all of them.
- Handling the
sampling/createMessagedelegation flow securely (so Codex keeps control of the main LLM calls). - Built on top of the official
@modelcontextprotocol/sdk.
Obviously, adding any dependency is a consideration, but thought it might be useful as a potential building block if the project decides to implement MCP host capabilities.
Let me know if this looks potentially helpful or if a different approach (like building directly on the base SDK) seems more appropriate for Codex!
I have a PR coming for MCP support -- have added commands based on claude code to add, remove and support local and global MCP servers; have got client invoking working and just testing -- should be PR today for this.
I stopped using it as soon as I realised I cannot call perplexity-search mcp it with. it's really fine if there is no support for MCP yet, but no web search? that's a bummer
Running final tests etc.
Bit rough, not happy with it but was a pig to get in there, so needs some more love I think but it works -- it's very fragile with MCP servers that don't behave well but I'm starting to test it now with a load.
Incoming shortly
PR in
I've created what I believe is a more minimal implementation of MCP support. You can find it here:
https://github.com/wtesler/codex-mcp/commit/1136135e692e560262f48f42f7e910179ee91f24
In my approach, you add the MCP config to ~/.codex/config.json like:
{
"model": "o4-mini",
"mcpServers": {
"playwright": { "url": "http://localhost:8931/sse" },
}
}
Then you can run the MCP server locally like:
npx @playwright/mcp@latest --port 8931
If you want to try it out, download my fork, cd into codex-cli, npm install, npm run build, and then you can run codex like bin/codex.
Then you can make an MCP call like "Call the playwright tool browser_tab_new with url https://example.com"
Try it out and let me know what you think.
Yes, I would love to check what I can squeeze from 4.1 with a 1 million context window and https://github.com/modelcontextprotocol/servers/tree/main/src/sequentialthinking.
Claude Code, with his appetite, will make me bankrupt :D
nice! when it would be out?
@gaiar FYI: https://x.com/alexalbert__/status/1918017889548026263
Max plan subscribers now get Claude Code included as part of their plan.
FYI this is the latest take on adding MCP support to ts version of codex
It's been over a month and this still hasn't landed, unless I'm missing something. MCP is kind of table stakes these days...
Great to see efforts to deliver MCP :D
Just one small question, do we know if the stdio based commands will be sandboxed without network access as codex is? I'd love to add some MCPs for documentation search specifically and that would be a deal breaker
I absolutely do not want the same limitations as the cloud codex -- it's unsuable as-is with it's no internet access so if it's added, it need to be configurable please
Why was the PR abandoned?
surprised of absence of MCP for so long