MCP website experiment · Part 3 of 3
We built the politi.ai public MCP endpoint as a separate Node service alongside WordPress. It exposes three read-only tools and obtains its information from published posts and pages. This walkthrough explains the choices behind that implementation, including the firewall and client checks that shaped the result.
This is a server-administration project. The accompanying source includes tests, an example systemd service, and nginx snippets. Adapt the domain, operating-system paths, network assumptions, and content rules before using it elsewhere. Take a backup of existing configuration and keep a rollback route available.
1. Decide exactly what may be returned
Start with a written content boundary. Our allowlist contains WordPress post and page objects that are published, not password-protected, and have canonical HTTPS URLs on the politi.ai origin. Our portfolio examples are pages and were already available in anonymous REST responses. We did not change WordPress permissions to expose them.
The tools are search_public_content, read_public_page, and get_inquiry_instructions. Each description says what it returns and when to use it. Each response is public source text with source URLs and freshness metadata. None of the tools sends a message or changes content.
2. Inspect the route to your server
Check the intended path before claiming it. Our /mcp path had no existing file or WordPress page and did not overlap the private OneMCP REST route. Review firewall rules, bot protections, challenges, and country restrictions before testing an automated POST request.
Our Cloudflare preflight found an active US-only block rule. Bot Fight Mode and Browser Integrity Check were off; the visible AI bot policies allowed access. Baseline managed protections remained active. A test POST reached the origin without a browser challenge. We made no Cloudflare changes, and non-US requests remain blocked. This records the configuration we checked, not a guarantee about every future request.
3. Use the current SDK deliberately
The implementation targets MCP 2026-07-28 using the official TypeScript SDK’s v2 packages. Requests are stateless, with no session storage or initialization handshake on this protocol path. We pinned package versions in the lockfile and tested them together rather than combining examples from different protocol generations.
The checked versions are server 2.4.0, Node adapter 2.1.2, client 2.4.0, Zod 4.6.7, and html-to-text 9.0.5. The code requires Node 22 or newer. Download the source, review it, then run npm ci, npm test, and npm audit in its directory. Review updates before deploying them; a clean dependency audit is one check, not proof of security.
4. Read WordPress locally without credentials
The upstream loader connects to loopback while retaining the public HTTPS hostname and normal certificate validation. This avoids sending server-to-server content fetches out through Cloudflare. It requests only anonymous published posts and pages. It does not read the database, WordPress credentials, or private files.
The loader bounds response size, time, and pagination. A successful refresh replaces the snapshot atomically. Failed refreshes retain the last successful snapshot, clearly marked stale after five minutes and usable for at most 24 hours. Restart the service to discard a snapshot immediately; if an urgent removal matters, do that after unpublishing the source. An external assistant may already hold a copy of previously public text.
5. Make search understandable
Search uses normalized text rather than embeddings or another model. Matched query tokens score five points in a title, two in an excerpt, and one in the body. Ties use modification time and then URL. An empty query is accepted only with a post or page filter and returns recently modified items. Results are capped at ten.
The reading tool accepts only canonical URLs already present in the snapshot. It does not fetch a URL supplied by the caller. That boundary prevents the tool from becoming a general URL-fetching proxy. Returned HTML is converted to plain source text, with source links and dates kept alongside it.
6. Run it with limited privileges
Create a dedicated service account and install the source in a separate directory. Our systemd unit restricts filesystem access, capabilities, memory, and tasks. The process listens only on 127.0.0.1:8791. Review the supplied unit against your installation before enabling it.
The service allows 120 requests per minute per client IP, with a burst capacity of 30; the global limit is 600 per minute, with a burst capacity of 60. It allows at most 20 concurrent requests and a 64 KiB request body. These limits are for one process. Multiple workers would need shared accounting. Hosted clients may share an outgoing IP, so monitor legitimate failures before tuning the limits.
7. Add an exact nginx proxy location
Include the supplied client-IP map in the nginx HTTP context and the exact /mcp location inside the existing HTTPS server. The proxy overwrites its dedicated client-IP header and trusts Cloudflare’s connecting-IP header only from published Cloudflare network ranges. Revisit that logic if your nginx configuration already rewrites client addresses.
Forward Mcp-Method, Mcp-Name, and MCP-Protocol-Version. The example strips cookies and authorization headers because this endpoint needs neither. Four exact OAuth discovery paths return JSON 404 responses; other well-known paths retain their existing behavior. Run nginx -t successfully before reloading nginx.
8. Verify a real connection
Our official SDK test listed all three tools and completed one call of each through the public Cloudflare URL. We then added the URL to Claude as a custom connector with no sign-in, listed the same tools, and successfully searched for “grant,” read a returned page, and retrieved inquiry instructions. The response included canonical source URLs and a last-successful-fetch timestamp.
The service remained in modern-protocol-only mode throughout that hosted test. We observed a request carrying a 2025-11-25 version header during connector setup, but the connector subsequently worked without enabling legacy support. That observation is not a successful legacy-client test. Our decision for this release is to support 2026-07-28 only and defer 2025-11-25 compatibility until a required client demonstrates the need.
What the hosted test caught
The hosted test also found three presentation issues: search did not explain body-only matches, HTML tables lost their cell boundaries, and email-share actions left query-string fragments in the text. We added matched fields and a matching excerpt to search results, explicit separators and row breaks to tables, and filtering for email-share links. Ordinary contact addresses remain. Search still uses simple token matching; it does not claim semantic relevance.
9. Document the operating limits
The source README records installation, testing, rollback, and cache behavior. Service logs omit tool arguments and page text and have a dedicated journal bounded to seven days and 10 MiB. Cloudflare and the rest of the website have their own logging and privacy behavior. Review those separately.
A browser GET to the endpoint returns 405 because it expects protocol POST requests. That is not the acceptance test. Use npm run smoke -- https://your-domain.example/mcp after adapting the source to your domain, and repeat the workflow from the hosted client people will actually use.
Download the source and deployment notes. Begin with the plain-language introduction and the decision guide if you are still choosing a use case. The endpoint is an experiment with a documented boundary; adding more tools should begin with another explicit decision about what they may access and change.
Keep the idea close
Save this portrait guide on your phone or share it with your team. Open the image to view it at full size.

Infographic text
The politi.ai WordPress experiment: three read-only tools, tested end to end.
1. Set the content boundary. Allow only published, unprotected posts and pages. Exclude private records and publishing credentials.
2. Check the route first. Inspect firewall rules and path collisions. Test an automated POST before assuming clients can connect.
3. Separate the service. Use a restricted account and loopback listener. Fetch public WordPress content with verified local HTTPS.
4. Bound every request. Limit traffic, payloads, and concurrency. Mark stale results and stop serving a snapshot after 24 hours.
5. Test and document. List and call every tool with an SDK and a hosted client. Record versions, failures, and rollback steps.
Takeaway: Our endpoint supports MCP 2026-07-28. Claude passed all three tool calls; the existing US-only rule remains.