=== Sokket – MCP Server: Connect Claude, ChatGPT, Cursor & Any AI Agent to WordPress ===
Contributors: beautifulplugins
Tags: mcp, mcp server, ai agent, claude, chatgpt
Requires at least: 6.4
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Self-hosted MCP server for WordPress. Connect Claude, ChatGPT, Cursor & any AI agent to your site — with the tools and permissions you control.

== Description ==

**Sokket turns your WordPress site into its own MCP server.**

MCP — the Model Context Protocol — is the standard AI clients use to work with outside systems. Install Sokket and your site becomes one: a single endpoint that **Claude, ChatGPT, Cursor, VS Code, Windsurf** and any other MCP-compatible AI agent can connect to and actually *use*.

Instead of copying error logs and post content into a chat window, the agent reads them itself. Instead of describing your site to an AI, you connect it — and every tool call runs through a permission model you control.

= Stop pasting your site into a chat window =

Ask your AI agent to do the work directly:

* *"Why is this site throwing a 500 error?"* — it reads the PHP error log, checks the environment, and lists which plugins updated recently.
* *"Which plugins have updates available, and what versions are we on?"* — it tells you, with the WordPress and PHP versions to match.
* *"Find every post mentioning the old pricing and fix it."* — it searches, reads, and updates the content.
* *"Draft a post from these notes and set a featured image."* — it creates the draft, uploads the image, and attaches it.
* *"Clear the comment moderation queue."* — it reads the pending queue, approves the real ones, and spams the rest.
* *"Tidy up our categories and tag these twelve posts properly."* — it lists terms, creates what's missing, and assigns them.

**This is not an AI content generator.** Sokket writes nothing by itself and calls no AI provider. It is the *connector* that lets the AI client you already pay for reach your site safely.

= Works with every MCP client =

The endpoint speaks Streamable HTTP with JSON-RPC 2.0, so any MCP-compatible client works. The built-in setup generator produces the exact command or config for yours, with your endpoint already filled in:

* **Claude Code** — one `claude mcp add` command
* **Claude Desktop** — a custom connector via OAuth, or a bearer token through `mcp-remote`
* **ChatGPT** — a developer-mode connector with bearer authentication
* **Cursor** — a ready-made `.cursor/mcp.json` block
* **VS Code** — a ready-made `.vscode/mcp.json` block
* **Windsurf** — a ready-made `mcp_config.json` block
* **Any other MCP client** — the raw endpoint, transport, and auth header

= No AI keys. No SaaS. No data leaving your site. =

This is the part most "AI for WordPress" plugins can't say:

* **100% self-hosted.** The MCP server runs inside your WordPress install. There is no SaaS component, no account to create, and no middleman marking up API calls.
* **No external service calls.** This plugin makes **no outbound requests to any AI provider or any other external service**. It never sends your data anywhere. It only *receives* inbound connections from the AI clients you configure, on an endpoint you can switch off at any time.
* **No AI API keys.** Sokket is provider-agnostic and stores no AI credentials. Your AI client authenticates to *your site* — not the other way around.

= Two ways to connect =

**Bearer tokens** — create a token in the admin, bind it to a WordPress user, and tick exactly which tools it may call. Tokens are stored as SHA-256 hashes and shown in plaintext exactly once. This is the option with the finest control, and it works with Claude Code, ChatGPT, Cursor, VS Code, and Windsurf.

**OAuth 2.1** — for connector interfaces that have no field for a token, such as Claude Desktop's custom connectors. Turn it on and clients configure themselves from the endpoint URL alone: RFC 9728 and RFC 8414 discovery, dynamic client registration, PKCE (S256) required, and refresh tokens. The person connecting signs in to WordPress, approves on a consent screen, and chooses read-only or full access. Every grant is listed in the admin and revocable in one click.

WordPress **Application Passwords** are accepted too, for quick local testing.

= Security model =

Sokket is built on the assumption that you should never have to simply trust the agent.

* The server is **disabled by default** after activation, and rejects every request until you switch it on.
* Every credential is **bound to a WordPress user** — a request can never do anything that user could not do in wp-admin.
* **Three independent gates** on every single tool call: the connection's tool allowlist, a **read-only ceiling**, and a real `current_user_can()` capability check. The token is never trusted on its own.
* **Every write tool is off by default** and must be enabled explicitly, one at a time.
* Rate limiting, origin validation (DNS-rebinding protection), timing-safe token comparison, and session handling per the MCP spec.
* A capped **audit log** of every tool call: user, tool, outcome, and the object id it acted on. Tool arguments are never stored.
* **Instant revocation** of any token or OAuth connection.
* Deliberately **no filesystem-write, database-query, or command-execution tools** — the free plugin's attack surface stays small on purpose.

= Included tools =

20 tools, grouped by area, each individually switchable per connection.

**Site & diagnostics**

* `get_site_info` — WordPress/PHP/DB versions, active theme, environment, debug flags
* `list_plugins` — installed plugins, versions, update availability
* `list_themes` — installed themes
* `get_php_error_log_tail` — last lines of the server-configured PHP error log (admins only)
* `get_site_settings` — general, writing, reading, discussion, and permalink settings from a fixed allowlist

**Content**

* `list_posts`, `get_post`, `search_content` — content inspection
* `create_post`, `update_post` — content writes (off by default, per token)

**Media**

* `list_media` — browse the media library
* `upload_media` — add an image from base64 data (off by default, per token)
* `set_featured_image` — set or clear a post's featured image (off by default, per token)

**Taxonomies & terms**

* `list_taxonomies`, `list_terms` — taxonomy inspection
* `create_term`, `assign_terms` — term writes (off by default, per token)

**Comments**

* `list_comments` — review the moderation queue
* `moderate_comment` — approve, unapprove, spam, unspam, trash, untrash (off by default, per token)
* `reply_to_comment` — reply as the connected user (off by default, per token)

= Who it's for =

* **Developers and agencies** debugging and maintaining sites with an AI coding assistant instead of a support ticket queue.
* **Site owners** who want an AI assistant that can actually see the site it's advising them about.
* **Content teams** letting an agent draft, update, illustrate, and categorise posts under editorial control.
* **Anyone** who wants AI help with WordPress without shipping their content to another SaaS platform.

= Built for developers =

Register your own tools with a single filter, `sokket_register_tools`. Anything you add inherits the whole permission model, the audit log, and the transport for free, and shows up in the admin allowlist automatically. Filters are also provided for rate limits, upload restrictions, audit retention, the settings-read allowlist, and OAuth authorization rights.

Full documentation: [beautifulplugins.com/docs/sokket-site-connector-for-mcp/](https://beautifulplugins.com/docs/sokket-site-connector-for-mcp/)

== Installation ==

= Install the plugin =

1. Go to **Plugins → Add New**, search for **"Sokket"**, click **Install Now**, then **Activate**. (Or upload the ZIP under **Plugins → Add New → Upload Plugin**.)
2. Nothing is exposed yet — the MCP server is disabled by default.

= Turn on the server =

1. Go to **Sokket → Settings → General**.
2. Tick **Enable MCP server** and save.
3. Copy the **Endpoint URL**, and click **Test connection** to confirm the endpoint is reachable and enforcing authentication.

= Create a credential =

1. Go to **Sokket → Settings → Access**.
2. Give the token a label, pick the WordPress user it runs as, leave **Read-only** ticked to start with, and choose which tools it may call.
3. Copy the token — it is shown exactly once.

Prefer sign-in based connections? Tick **Enable OAuth 2.1** on the General tab instead, and clients configure themselves from the endpoint URL.

= Connect your AI client =

1. Go to **Sokket → Connections → Connect your AI client**.
2. Choose your client and copy the generated command or config.

For Claude Code, that is a single command:

`claude mcp add --transport http sokket-site-connector-for-mcp https://example.com/wp-json/sokket/v1/mcp --header "Authorization: Bearer YOUR_TOKEN"`

Then ask your agent what versions the site is running — and watch the call appear in the audit log.

== Frequently Asked Questions ==

= What is MCP? =

The Model Context Protocol is the standard way for an AI client to work with an external system. The system exposes *tools* — named operations with typed arguments — and the AI decides which to call. Sokket makes your WordPress site one of those systems, so an AI agent can read and manage it directly instead of being told about it second-hand.

= Does this plugin send my content to an AI company? =

No. The plugin makes no outbound requests to AI providers or any other external service. AI clients that *you* configure connect *to your site*, authenticate with a credential you created, and can only use the tools that credential allows.

= Do I need an OpenAI or Anthropic API key? =

No. Sokket is provider-agnostic and stores no AI credentials at all. Your AI client brings its own subscription and authenticates to your site with a token or an OAuth connection you approve.

= Which AI clients work with it? =

Any MCP-compatible client that supports remote servers over Streamable HTTP, including Claude Code, Claude Desktop, ChatGPT, Cursor, VS Code, and Windsurf. The "Connect your AI client" tab generates the exact command or configuration for your site.

= How do I connect Claude Desktop? =

Claude Desktop's custom connectors have no field for a bearer token, so enable **OAuth 2.1** under Settings → General, then add your endpoint URL as a custom connector and leave Client ID and Client Secret blank — the connector registers itself and asks you to sign in and approve. If you would rather not enable OAuth, the plugin also generates an `mcp-remote` configuration that uses a bearer token instead.

= Is it free? =

Yes. This plugin is the complete MCP server: all 20 tools, OAuth 2.1, bearer tokens, per-connection permissions, and the audit log. There is no usage limit and no account to create.

= Is it safe to install on a production site? =

The server is disabled by default and rejects every request until you enable it. When enabled, access requires a credential bound to a WordPress user, and each tool call is checked against that user's capabilities plus the connection's own allowlist. Every write tool is off until you enable it, and you can revoke any credential instantly.

= Can I control exactly which tools the AI can use? =

Yes — that is the core of the plugin. Each bearer token has its own tool allowlist and an optional read-only ceiling that blocks every write tool regardless of what else is ticked. OAuth connections are scope-based instead: read-only or full access, still bounded by the WordPress user's capabilities.

= Can the AI modify files or run database queries? =

No. The plugin deliberately ships no filesystem write, database query, or command execution tools. Every write tool is off by default and has to be enabled per connection. `get_php_error_log_tail` reads only the path the server itself configures in `error_log`, capped at the last 100 lines, and requires an administrator.

= Can the AI upload images to my media library? =

Only if you enable `upload_media` on a connection bound to a user who can already upload files, and even then the tool is deliberately narrow:

* **Images only** — JPEG, PNG, GIF, WebP, and AVIF. SVG is refused outright, because SVG is XML that can carry script; this holds even on sites that have enabled SVG uploads elsewhere.
* **The file type comes from the bytes, not the file name.** A payload named `photo.jpg` that is not really an image is rejected, and the stored extension is always rewritten to match the real image data.
* **The image arrives inside the request.** Bytes are sent base64-encoded over the connection your client already opened. The plugin does not fetch URLs, so enabling uploads still results in zero outbound requests from your site.
* **Rate limited.** Uploads are capped per user per hour (20 files / 25 MB by default, filterable) so an agent stuck in a loop cannot fill your uploads directory.
* **Logged.** The audit log records the resulting attachment id alongside the tool call.

= Does the AI client see personal data? =

It sees whatever the WordPress user it is bound to can see through the tools you enabled. Notably, `list_comments` includes commenter email addresses, and `get_site_settings` includes the site's admin email — the same data that user sees in wp-admin. Leave those tools off if you would rather not share them.

= What does the audit log record? =

The time, the user, the tool, the outcome, and the id of the post, attachment, term, or comment the call acted on. Tool arguments are never stored, so the log tells you what happened without becoming a second copy of your content.

= Can I add my own tools? =

Yes. Register them through the `sokket_register_tools` filter and they appear in the admin allowlist automatically, passing exactly the same permission gates as the built-in tools. See the developer documentation.

= Does it work with WordPress Multisite? =

Yes. Sokket runs per site — each site in a network has its own settings, credentials, endpoint, and audit log, and is enabled independently. Connect your AI client to each site separately.

= Does it work with the WordPress REST API disabled? =

No. The MCP endpoint is a REST route (`/wp-json/sokket/v1/mcp`), so the REST API must be reachable. A security plugin that blocks REST requests or strips the `Authorization` header will also block Sokket.

= What happens if I delete the plugin? =

The plugin cleans up after itself: the token, audit log, and OAuth tables are dropped, the options are deleted, and the plugin's transients are cleared. Every credential stops working immediately.

== Screenshots ==

1. Dashboard — server status, endpoint URL, active connections, and recent AI tool calls at a glance.
2. Settings → General — enable the MCP server, switch on OAuth 2.1, copy the endpoint, and test the connection.
3. Settings → Access — create bearer tokens bound to a WordPress user, with a per-token tool allowlist and read-only ceiling.
4. Connections → OAuth — approved AI connections and registered clients, each revocable in one click.
5. Connections → Connect your AI client — ready-made setup commands and configs for Claude, ChatGPT, Cursor, VS Code, and Windsurf.

== Changelog ==

= 1.1.0 =
* New media tools: `list_media`, `upload_media` (base64 images only), and `set_featured_image`.
* New taxonomy tools: `list_taxonomies`, `list_terms`, `create_term`, and `assign_terms`.
* New comment moderation tools: `list_comments`, `moderate_comment`, and `reply_to_comment`.
* New `get_site_settings` tool reading a fixed allowlist of WordPress options.
* Uploads are restricted to JPEG, PNG, GIF, WebP, and AVIF, typed from the file contents rather than the file name, and rate limited per user per hour.
* The audit log now records the post, attachment, term, or comment id a call acted on. Tool arguments are still never stored.
* The token screen groups the tool allowlist by area.
* All new write tools are off by default; existing tokens keep exactly the tools they were granted.
* Updated the plugin banner and icon.

= 1.0.0 =
* Initial release.

== Upgrade Notice ==

= 1.1.0 =
Adds media, taxonomy, comment moderation, and settings-read tools. All new write tools are off by default and existing tokens are unchanged; enable what you need per token.

= 1.0.0 =
Initial release.
