| 开发者 | clearcomet |
|---|---|
| 更新时间 | 2026年10月31日 01:45 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.1 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
mcp routes, the Abilities API, and MCP servers added by other plugins. Anyone on the internet can find them in your site's public route list and start knocking.
Cloak hides those doors, so you can hide REST API endpoints for MCP without breaking anything for yourself. Strangers get WordPress's own ordinary "not found" answer (rest_no_route, 404) and the doors disappear from the public /wp-json index. It works the moment you activate it. There are no keys to set up and nothing to configure. The people and tools you choose still get in:
X-Cloak-Key header.initialize handshakes POSTed to /mcp from 49 different IP addresses, on a server that runs no MCP at all. SANS Internet Storm Center, diary 33150/wp-json route list; it is fixed in 3.1.4. Wordfence/wp-json/mcp/v1/. Rapid7 Metasploit, Packet Storm via Vulners_ and -). Apps send it in the X-Cloak-Key header. Rotate keeps the old key working for 24 hours so you can update your apps; Turn off stops it. The key page has ready-made snippets for a desktop AI assistant, curl and n8n.
Cloak stores only a fingerprint of the key (a salted HMAC-SHA256), never the key itself, so a new key is shown once, right after it is made. Lost it? Make a new one. Keys are never exported and are compared in constant time.
Cloudflare
Cloak trusts the CF-Connecting-IP header only when the request really comes from one of Cloudflare's published ranges. X-Forwarded-For is never used. The plugin ships with Cloudflare's list (checked 2026-10-06); Refresh from Cloudflare on the Guest list page downloads the current official list from Cloudflare's public API over a checked HTTPS connection, and keeps the old list if anything looks wrong.
Advanced: wp-config.php overrides
These optional constants pin a setting in code. The matching field shows as locked on the settings screen. They apply once protection is on, except CLOAK_DISABLED, which always switches protection off.
define( 'CLOAK_KEY', 'your-long-random-key' ); (20+ characters; works alongside a key made on the screen)
define( 'CLOAK_GUESTS', array( '203.0.113.7', '198.51.100.0/24' ) );
define( 'CLOAK_MODES', array( '/acme/v1' => 'lights_out' ) ); (modes: open, unlisted, lights_out)
define( 'CLOAK_DISABLED', true ); (emergency off switch)
Advanced: filters for developers
cloak_presets: change or add guest presets (for example an address range an AI assistant or bot publishes). Each preset is id => array( 'label' => ..., 'cidr' => ... ).cloak_cf_ranges: change the Cloudflare ranges used to trust CF-Connecting-IP.cloak_client_ip: supply the visitor address yourself if your site sits behind another trusted proxy. It must return a valid IP.MCP (Model Context Protocol) is the open standard AI assistants and bots use to talk to other software. On WordPress, the MCP Adapter and the Abilities API add web addresses ("doors") that let an AI assistant read and change your site, if it has a valid login. Those doors are listed publicly by default, so anyone can see they exist and start trying them.
Exactly what they'd see if the door didn't exist: WordPress's standard rest_no_route "not found" (404) answer. The doors are also removed from the public /wp-json list and from per-namespace listings. Your pages, posts, wp-admin and the rest of the REST API are untouched.
Add the address range your AI assistant or bot publishes on Advanced > Guest list, or give it your secret key (Advanced > Secret key has ready-made snippets). An app running on your own computer can also use the key, or you can add your computer's address. It still needs its normal login (for example an application password) after the door.
"You, when logged in" is on by default, so your dashboard and the block editor keep working. If something still goes wrong, any one of these makes every door visible again:
define( 'CLOAK_DISABLED', true ); to wp-config.php. This kill switch works even if you can't reach wp-admin.No. There is no tracking, telemetry, account or license check. The only outside request is the optional, manual Cloudflare list refresh described under "External services". The activity log stays in your own database, never records headers or keys, and is deleted with the plugin.
That works out of the box. Cloak reads the visitor's real address from CF-Connecting-IP only when the request arrives from Cloudflare's own ranges, so nobody can fake it. If you use a different proxy or load balancer, use the secret key for your apps rather than address-based helpers.
Cloak stores only a salted fingerprint of a key made on the settings screen, so even someone who can read your database can't use it. That's why a key is shown once, right after it is made. If you lose it, make a new one (or Rotate under Advanced, which keeps the old key working for 24 hours).
CLOAK_KEY in wp-config.php is plain text in that file. Protect that file as you would your database password.Yes. Cloak hides the MCP Adapter's mcp routes and the Abilities API routes, plus MCP servers added by other plugins. The adapter itself keeps working for you and for the AI assistants and bots you allow.
Yes, if you let it in. You stay in when logged in. Other AI assistants and bots get in with your secret key in the X-Cloak-Key header, or by IP address or range on Advanced > Guest list. They still need their normal WordPress login after that.
Activate Cloak. Strangers asking for a hidden route get WordPress's normal rest_no_route 404, and the hidden routes are removed from the public /wp-json index. The rest of the REST API is untouched.
No. App passwords (or any other authentication) are still checked after the door. Cloak adds a lock; it never removes one.
clearcomet-cloak-for-mcp, settings under Settings > Cloak for MCP).api.cloudflare.com/client/v4/ips); same validation and fallback.Update URI header.