Skip to content

docs(examples): add codex_with_skill_and_mcp example#642

Merged
yaozheng-fang merged 1 commit into
mainfrom
examples/codex-skill-and-mcp
Jul 7, 2026
Merged

docs(examples): add codex_with_skill_and_mcp example#642
yaozheng-fang merged 1 commit into
mainfrom
examples/codex-skill-and-mcp

Conversation

@yaozheng-fang

Copy link
Copy Markdown
Collaborator

What

A runnable example (examples/codex_with_skill_and_mcp/) of a runtime="codex" agent that uses both a local skill and an MCP tool on a chat backend (Ark) — tying together #640 (skill passthrough) and #641 (MCP/function tool passthrough).

codex_with_skill_and_mcp/
├── main.py                     # the agent + a sample run
├── mcp_server.py               # a tiny stdio MCP server (get_weather)
├── skills/weather-style/SKILL.md
└── README.md / README.zh.md

The agent wires them the ordinary way — SkillToolset(skills=[load_skill_from_dir(...)]) + MCPToolset(StdioServerParameters(...)) — and the codex runtime routes each: the skill is materialized into $CODEX_HOME/skills/, the MCP tool is executed by the Responses shim.

Small code change

tools_bridge now skips skill toolsets (SkillToolset / SkillsToolset) so their internal tools (list_skills / load_skill / …) aren't also shim-executed — skills are handled by the materialization path (#640). Without this, an agent with both a skill and an MCP tool would double-expose the skill machinery.

Validation

Ran end to end on the bundled Codex binary + Ark (deepseek):

skills.py: materialized 1 skill(s) into .../skills
tools_bridge: bridging 1 agent tool(s): ['get_weather']   # guard: only the MCP tool, not the skill toolset's tools
Agent: Beijing is currently sunny and 28°C ☀️              # MCP tool data flowed into the answer

Skill materialized + discovered, MCP tool bridged + executed + used, and the two coexist.

🤖 Generated with Claude Code

A runtime=codex agent that uses both a local skill (SkillToolset) and an MCP
tool (MCPToolset, stdio) on a chat backend. Shows how the codex runtime routes
each: skills are materialized into Codex's skill dir, MCP tools are executed by
the Responses shim.

Also skip skill toolsets in tools_bridge, so their internal tools
(list_skills/load_skill/...) aren't shim-executed — skills go through the
materialization path instead.
@yaozheng-fang
yaozheng-fang merged commit 98bea28 into main Jul 7, 2026
16 checks passed
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.

2 participants