
This guide covers connecting a WordPress site to VS Code, what changes about the workflow, and the specific tricks that make editor-based site work better than a browser tab.
VS Code reads MCP server definitions from a JSON file. Per project is usually right, because it keeps the site connection next to the theme or plugin code it belongs with:
// .vscode/mcp.json
{
"servers": {
"nibwp": {
"type": "http",
"url": "https://yoursite.com/wp-json/mcp/nibwp",
"headers": { "Authorization": "Basic <your-credential>" }
}
}
}
Or let the CLI write it, which avoids endpoint typos and stores the credential the same way every time:
nibwp auth login https://yoursite.com --scope read,write
nibwp agent add vscode --project
Reload the window, open Copilot Chat, switch to agent mode, and check that the tools are listed. Then verify with a prompt that needs real data:
Using the WordPress tools, list the five most recently modified pages with slugs.
Three things you get in VS Code that a browser chat cannot give you:
Not everything belongs here; these do:
Connection errors and their fixes: WordPress MCP not working. Comparing editors and other clients: which AI clients work with WordPress MCP.
The clearest demonstration of why the editor is the right place for some site work is a change that spans both halves of the stack. Adding a field is a site operation; rendering it is a code operation; doing them separately is where mistakes live.
Add an ACF field group "Case study metrics" to the case-study post type:
- client_name (text)
- metric_label (text, repeatable with metric_value)
- published_result (textarea)
Then update the case-study template in this repo to render the metrics
as a definition list, using our existing .cs-metrics classes.
Show me the field group plan first; make the template change as a diff.
The agent creates the field group through the ACF integration — so it appears correctly in wp-admin rather than as raw post meta — and edits the template file in your working tree, where git is watching. You review both halves in one place.
For anything bulk, ask for the proposal as a file rather than as chat output. It is the single habit that makes editor-based site work better than a browser tab:
Find every post with a missing or over-length meta description.
Write your proposals to ./meta-review.md as a table:
slug | current | proposed | reason
Don't touch the site yet.
The one genuine risk in this setup is committing a client's write credential to their repository. Three ways to avoid it, in order of preference:
Whichever you pick, check your first commit before pushing. It is the cheapest audit you will ever run.
Yes — with Copilot Chat in agent mode and your site connected as an MCP server, VS Code can call typed WordPress tools to read and write content, fields and settings alongside your code.
In .vscode/mcp.json for a project-scoped connection, or your user settings for a global one. Project scope is usually right so each client repo connects to its own site.
You need an MCP-capable chat agent in the editor; Copilot Chat's agent mode is the standard one. Other MCP-capable extensions work the same way once configured.
Only if that file is not committed. Use secret/input references or keep the file git-ignored. Committing a write credential to a client repo is the main risk to avoid here.
Three usual causes: you are not in agent mode, the window needs reloading after a config change, or the endpoint/credential is wrong. Check them in that order.
Technically yes, but it invites mistakes — the agent may target the wrong site. One project per client site, with its own config, is the safer pattern.