Connect VS Code (GitHub Copilot)

Add your WordPress site to VS Code with the Add to VS Code button, a pasted message or mcp.json, and use its tools from GitHub Copilot's agent mode.

Use your site's tools from GitHub Copilot's agent mode in VS Code. It suits you if you already work on your theme or plugins in VS Code.

Before you start#

Create a connection for VS Code. Open PowerWP AI › Connections, choose Create connection, pick VS Code, name it and choose what it may do. Choose Create key and show steps: the window shows the steps below with your address and key already in them. The key is shown once. Here it appears as <your key>. You need VS Code with GitHub Copilot.

Option 1: one click#

  1. In the setup window, click Add to VS Code.
  2. VS Code opens and asks you to install your site's server. Confirm it.
  3. If VS Code asks whether to trust or start the server, allow it.
  4. Open Copilot Chat in Agent mode and ask your first question.

The button saves your key in your VS Code user profile.

Option 2: let VS Code connect itself#

Copy the message under Let VS Code connect itself and paste it into a chat in VS Code. It adds your site under servers in your user mcp.json and tells you the next step. The message contains your key, so paste it only into your own account. The file is here:

SystemPath
Windows%APPDATA%\Code\User\mcp.json
macOS~/Library/Application Support/Code/User/mcp.json
Linux~/.config/Code/User/mcp.json

Option 3: add it by hand#

This version asks for the key once and keeps it in VS Code's secure storage instead of the file.

{
  "inputs": [
    {
      "id": "powerwp-your-store",
      "type": "promptString",
      "description": "PowerWP AI key for your-store",
      "password": true
    }
  ],
  "servers": {
    "your-store": {
      "type": "http",
      "url": "https://your-store.com/wp-json/wpai/v1/mcp",
      "headers": { "X-WPAI-Token": "${input:powerwp-your-store}" }
    }
  }
}
  1. Open the Command Palette (Ctrl+Shift+P, on a Mac Cmd+Shift+P) and run MCP: Open User Configuration.
  2. Paste the JSON above and save. If the file already lists servers, add these entries to its inputs and servers.
  3. Start the server when VS Code offers to. Paste your key when VS Code asks for it. It asks once.
  4. Open Copilot Chat in Agent mode and ask your first question.

Check it works#

Give me an overview of my site.

Copilot calls site_overview and answers with your WordPress version, theme and plugins.

Troubleshooting#

  • Copilot does not use your site's tools. Switch Copilot Chat to Agent mode and check that the server is allowed to start.
  • A JSON error in mcp.json. A missing comma or bracket stops the file from loading. When the file lists other servers, add the entries to the existing inputs and servers instead of pasting a second copy.
  • 401 "Authentication required". The key was copied incompletely. Keys cannot be shown twice: revoke the connection and create a new one.
  • 403 or 429. 403 means your IP address is not on the connection's allow-list, or a firewall blocks /wp-json/wpai/v1/. 429 means too many requests: wait a few minutes.
↑↓ moveEnter open