MCP server
WP-PFAgent includes an MCP server. MCP (Model Context Protocol) is how AI apps such as Claude, ChatGPT, Cursor, VS Code, Windsurf or Claude Code call tools that live somewhere else. Connected to this server, your AI app works on your site with the agent's own tools: it can design data models and applications, build and change workflows, and manage WordPress content — the same tools, and the same rules, as the agent's chat.
The server is for administrators. It acts with administrator power, so it is off until an administrator turns it on, and it only accepts tokens made for it.
Turn it on
Open WP-PFAgent (the PF Agent entry in the WordPress admin menu) and choose the MCP tab. Tick Allow AI apps to connect to this site through MCP. The tab shows the Server URL your app will use, for example https://example.com/wp-json/wp-pfagent/v1/mcp.
Create a token
In the same tab, under Create a token:
- Name — something you will recognise later, such as "Claude on my laptop".
- Access — Read only lets the app look but never change anything. Read and write lets it change the site; your app still asks you before each change.
- Expires in — 30 days by default, a year at most. Every token expires.
The token is shown once, together with configurations ready to paste. Copy it then: the site keeps only a fingerprint of it and cannot show it again. A token acts with your administrator rights — keep it like a password.
Connect your app
Claude Code — run in a terminal:
claude mcp add --transport http setyenv-agent "https://example.com/wp-json/wp-pfagent/v1/mcp" --header "Authorization: Bearer pfam_…"
Do not add --scope project: that writes the token into a file shared with your repository.
Claude Desktop, Cursor and Windsurf connect through mcp-remote, which needs Node.js. Add the server to the app's MCP configuration file — claude_desktop_config.json (Claude Desktop: Settings → Developer → Edit config), ~/.cursor/mcp.json (Cursor) or ~/.codeium/windsurf/mcp_config.json (Windsurf):
{
"mcpServers": {
"setyenv-agent": {
"command": "npx",
"args": ["-y", "mcp-remote", "https://example.com/wp-json/wp-pfagent/v1/mcp",
"--header", "Authorization:${SETYENV_AGENT_AUTH}", "--transport", "http-only"],
"env": { "SETYENV_AGENT_AUTH": "Bearer pfam_…" }
}
}
}
The header value comes from env on purpose: some apps split arguments that contain spaces. A site served over plain HTTP (other than localhost) also needs "--allow-http" in args — and then the token travels unencrypted, so use HTTPS outside a trusted network.
VS Code reads the same entry under "servers", with "type": "stdio". Put it in your user MCP configuration (command MCP: Open User Configuration), not in a workspace .vscode/mcp.json that may be committed with the token inside.
The MCP tab writes all of these for you with the new token already in place.
What the app gets
- The agent's tools. A read-only token lists only the tools that read.
- Instructions on how to behave on this site: show names as people read them in the product, take numbers from the tools, never delete and recreate something to get around a missing capability, and send bulk data loads to the CSV import in WP-PFManagement.
- Clear answers when something fails: what went wrong and what to do.
Revoke access
- One token: in the MCP tab, Your tokens → Revoke. It stops working at once.
- One person: removing someone's administrator role (or their account) stops all their tokens at once — every request checks the owner's current role.
- Everyone: untick Allow AI apps to connect. The server then refuses every connection, whatever token it is shown.
See Security model for exactly what is checked, and when.