Configuring VS Code for MCP with AI Agents

Configuring VS Code for MCP with AI Agents

·

·

, ,

👁 5 views

Setting up the Model Context Protocol (MCP) in VS Code allows your editor to communicate directly with your WordPress site, unlocking a powerful suite of management tools right from your IDE. While the protocol itself is robust, the initial JSON configuration can be finicky to get right.

In my previous post, Testing and Updating WordPress MCP with Claude and VS Code, I shared the development workflow and how we use agents to test abilities. Today, let’s focus on the critical first step: configuring the server connection in VS Code.

The Role of AI Agents in Setup

Instead of writing the .vscode/mcp.json configuration file manually, you can leverage AI agents (like GitHub Copilot or Claude) to do the heavy lifting. By simply asking an agent to “Analyze this project and configure the MCP server,” you can generate the necessary boilerplate in seconds.

However, as we learned, “trust but verify” is the golden rule.

The Configuration Structure

For a local WordPress site using the @automattic/mcp-wordpress-remote adapter, your configuration needs to tell VS Code to run an npx command that acts as the bridge. Here is the correct structure:

{
    "mcpServers": {
        "wp-mcp-blueprint": {
            "command": "npx",
            "args": [
                "-y",
                "@automattic/mcp-wordpress-remote@latest"
            ],
            "env": {
                "WP_API_URL": "http://your-site.local/wp-json/mcp/mcp-adapter-default-server",
                "WP_API_USERNAME": "admin",
                "WP_API_PASSWORD": "your-application-password"
            }
        }
    }
}

Common Pitfalls: The “List” Command Error

During our recent setup, we encountered a specific issue where the agent generated a configuration using "command": "list". This is often a hallucinated placeholder or a remnant from a different toolchain.

When VS Code tried to launch the server, it failed with an ENOENT error because “list” is not a valid system executable. This highlights an important lesson: Agents are excellent at scaffolding, but they can sometimes use generic placeholders that break execution.

Always verify that the command property points to a real executable (like npx, node, or php) and that your environment variables (URL and Credentials) are accurate.

Conclusion

Using agents to configure your development environment saves time and reduces syntax errors, but it doesn’t replace the need for understanding the underlying config. By combining AI speed with human verification, you can get your MCP server up and running in no time.

Stay in the loop

Get WordPress + AI insights delivered to your inbox. No spam, unsubscribe anytime.

We respect your privacy. Read our privacy policy.


Recommended Posts