| id | agents.docs.mcp.codex-vscode | ||
|---|---|---|---|
| title | Install MCP in VS Code Codex | ||
| doc_type | user-guide | ||
| layer | docs | ||
| status | active | ||
| publishable | true | ||
| local_only | false | ||
| tags |
|
||
| parent |
|
||
| related |
|
||
| depends_on |
← All MCPs · Install WebDev Agent Kit for VS Code Codex
This guide covers only MCP installation in the official Codex extension for VS Code on Windows. Server purposes, skill relationships, and common test prompts are in the general MCP guide.
Node.js, npm, and npx must work for Filesystem and Playwright:
node --version
npm --version
npx --version- Open the project in VS Code.
- Open the Codex panel.
- Select the gear icon and open Codex Settings.
- Select MCP servers.
- Select Add server.
- Fill in the fields for the required MCP and select Save.
- After changes, select Restart extension or restart VS Code completely.
The Codex CLI and extension use shared MCP configuration. User configuration is
stored in ~/.codex/config.toml; project .codex/config.toml works only in a
trusted project.
The resulting list looks approximately like this:
If you use an API key instead of OAuth:
- Open the Context7 dashboard.
- In the API Keys section, select Create API Key.
- Name the key
pc-vs-code-codex. - Create and immediately copy the key: it is not shown again.
- Do not store the key in Markdown, git, or
AGENTS.md.
On the next screen, name the key pc-vs-code-codex and select Create API Key:
In MCP servers → Add server, enter:
| Field | Value |
|---|---|
| Name | cntx7 |
| Type | Streamable HTTP |
| URL | https://context7.com/ |
| Bearer token env var | <YOUR_CONTEXT7_API_KEY> |
Select Save.
This option matches the screenshot. Current official Context7 documentation uses a different endpoint and header. If the server does not connect, apply the current configuration below.
Create a local Windows variable:
setx CONTEXT7_API_KEY "<YOUR_CONTEXT7_API_KEY>"Restart VS Code completely, then enter:
| Field | Value |
|---|---|
| Name | cntx7 |
| Type | Streamable HTTP |
| URL | https://mcp.context7.com/mcp |
| Headers from environment variables — Key | CONTEXT7_API_KEY |
| Headers from environment variables — Value | CONTEXT7_API_KEY |
The first value is the HTTP header name; the second is the name of the environment variable containing the secret.
Equivalent config.toml:
[mcp_servers.cntx7]
url = "https://mcp.context7.com/mcp"
env_http_headers = { "CONTEXT7_API_KEY" = "CONTEXT7_API_KEY" }Fallback CLI command:
codex mcp add cntx7 -- npx -y @upstash/context7-mcp --api-key "<YOUR_CONTEXT7_API_KEY>"The command containing the key may remain in terminal history, so an environment variable is preferred for permanent configuration.
Copy the absolute path to the required project. In Add server, enter:
| Field | Value |
|---|---|
| Name | filesystem |
| Type | STDIO |
| Command to launch | cmd |
Add the arguments on separate lines:
/c
npx
-y
@modelcontextprotocol/server-filesystem
<ABSOLUTE_PATH_TO_PROJECT>
You can leave Working directory empty. Allow only the required project directory, not the drive root or the entire user profile.
Fallback CLI command:
codex mcp add filesystem -- cmd /c npx -y @modelcontextprotocol/server-filesystem "<ABSOLUTE_PATH_TO_PROJECT>"Equivalent config.toml:
[mcp_servers.filesystem]
command = "cmd"
args = [
"/c",
"npx",
"-y",
"@modelcontextprotocol/server-filesystem",
"C:\\full\\path\\to\\project",
]In Add server, enter:
| Field | Value |
|---|---|
| Name | mdn-docs |
| Type | Streamable HTTP |
| URL | https://mcp.mdn.mozilla.net/ |
To opt out of first-party analytics, add under Headers:
| Key | Value |
|---|---|
X-Moz-1st-Party-Data-Opt-Out |
1 |
CLI without the opt-out header:
codex mcp add mdn-docs --url https://mcp.mdn.mozilla.net/Configuration with the header:
[mcp_servers.mdn-docs]
url = "https://mcp.mdn.mozilla.net/"
http_headers = { "X-Moz-1st-Party-Data-Opt-Out" = "1" }In Add server, enter:
| Field | Value |
|---|---|
| Name | openai-dev-docs |
| Type | Streamable HTTP |
| URL | https://developers.openai.com/mcp |
Leave the bearer token and headers empty. This server is for documentation only and does not require an OpenAI API key.
WebDev Agent Kit already directs current OpenAI/Codex questions to the official
Docs MCP, so no additions to AGENTS.md are required.
Fallback CLI command:
codex mcp add openai-dev-docs --url https://developers.openai.com/mcp[mcp_servers.openai-dev-docs]
url = "https://developers.openai.com/mcp"In Add server, enter:
| Field | Value |
|---|---|
| Name | playwright |
| Type | STDIO |
| Command to launch | npx.cmd |
Add the arguments on separate lines:
-y
@playwright/mcp@latest
You can leave Working directory empty.
Fallback CLI command:
codex mcp add playwright -- npx.cmd -y "@playwright/mcp@latest"[mcp_servers.playwright]
command = "npx.cmd"
args = ["-y", "@playwright/mcp@latest"]For the first safe browser_navigate call, choose Allow once if permanent
permission is not required.
After saving all servers:
-
Select Restart extension or restart VS Code.
-
Start a new Codex thread.
-
Check the enabled servers under Codex Settings → MCP servers.
-
If the CLI is available, run:
codex mcp list
-
Run the prompts from the general MCP verification section.
The screenshots below show the expected results specifically in the Codex UI.
For a one-time test, select Allow once.
A green toggle and codex mcp list confirm configuration but do not replace a
successful tool call in the current session.
Official client MCP configuration reference: Codex MCP.













