Skip to content

Conversation

@bolinfest
Copy link
Collaborator

@bolinfest bolinfest commented Jan 14, 2026

This favors threadId instead of conversationId so we use the same terms as https://developers.openai.com/codex/sdk/.

To test the local build:

cd codex-rs
cargo build --bin codex
npx -y @modelcontextprotocol/inspector ./target/debug/codex mcp-server

I sent:

{
  "method": "tools/call",
  "params": {
    "name": "codex",
    "arguments": {
      "prompt": "favorite ls option?"
    },
    "_meta": {
      "progressToken": 0
    }
  }
}

and got:

{
  "content": [
    {
      "type": "text",
      "text": "`ls -lah` (or `ls -alh`) — long listing, includes dotfiles, human-readable sizes."
    }
  ],
  "structuredContent": {
    "threadId": "019bbb20-bff6-7130-83aa-bf45ab33250e"
  }
}

and successfully used the threadId in the follow-up with the codex-reply tool call:

{
  "method": "tools/call",
  "params": {
    "name": "codex-reply",
    "arguments": {
      "prompt": "what is the long versoin",
      "threadId": "019bbb20-bff6-7130-83aa-bf45ab33250e"
    },
    "_meta": {
      "progressToken": 1
    }
  }
}

whose response also has the threadId:

{
  "content": [
    {
      "type": "text",
      "text": "Long listing is `ls -l` (adds permissions, owner/group, size, timestamp)."
    }
  ],
  "structuredContent": {
    "threadId": "019bbb20-bff6-7130-83aa-bf45ab33250e"
  }
}

Fixes #3712.

@bolinfest bolinfest force-pushed the pr9192 branch 2 times, most recently from 697e3a5 to 80aabc4 Compare January 14, 2026 05:19
Copy link
Collaborator

@etraut-openai etraut-openai left a comment

Choose a reason for hiding this comment

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

Thanks for doing this. I've seen a lot of requests for this from users.

@@ -0,0 +1,67 @@
## Using Codex as an MCP Server
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please don't add documentation back to the OSS repo. It doesn't work to have it in two places. Update these docs instead. I can take care of it after this PR lands if you'd like.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sorry, yes, I know, I just asked Codex to write this up when I had it create the PR in the first place. I put this in my personal ~/Documents for now...

@bolinfest bolinfest force-pushed the pr9192 branch 2 times, most recently from 0682e78 to 0499d0c Compare January 14, 2026 05:58
@bolinfest bolinfest changed the title feat: add conversationId to MCP server messages feat: add threadId to MCP server messages Jan 14, 2026
@bolinfest bolinfest merged commit 0c09dc3 into main Jan 14, 2026
32 checks passed
@bolinfest bolinfest deleted the pr9192 branch January 14, 2026 06:14
@github-actions github-actions bot locked and limited conversation to collaborators Jan 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing conversationId of Codex MCP Server

3 participants