MCP Logs

تفصیل

AI agents talk to WordPress sites directly now. Claude, ChatGPT, Cursor, and a growing list of MCP clients can connect to your site, read content, place orders, edit posts, or call any custom tool you expose. The Model Context Protocol (MCP) is the open standard that makes this possible.

The problem is that by default you cannot see any of it. Requests arrive, things change, and there is no record of what an agent did, when it did it, or which user it acted as.

MCP Logs writes a row for every MCP request the moment it hits your site. You get the route, the ability that was called, the user it acted as, the request body, the response, and whether it succeeded. All of it is browsable in a React admin page built with @wordpress/components, so it looks and behaves like the rest of WordPress.

Version 1.1.0 adds the other half: detection rules that watch the traffic as it arrives, email alerts when one trips, and a kill switch that stops all MCP access in one click.

A log you can actually search

Filter by date range, ability name, and user. Sort any column, set page size between 10 and 500, and run full-text search across stored request and response bodies. Click a row to open the request and response in collapsible panels, copy either to your clipboard, or trace a single agent session end to end. Export the current view to CSV when you need to hand findings to someone else.

Detection rules that run on every request

Three rules evaluate after each logged request:

  • Request velocity per session. Catches an agent stuck in a loop.
  • Destructive tool use. Watches a list of abilities you nominate. It can populate that list for you by scanning previously seen tool names for delete, remove, and drop.
  • Error storms. Catches an integration that has started failing.

Each rule has its own enable toggle, threshold, time window, severity, and auto-disable setting. Detected events land in a Security Events tab with filters, stat cards, CSV export, and a per-event "mark as reviewed” so your queue reflects what you have already handled. Open any event and Session Replay steps through the full request timeline for that MCP session.

Alerts arrive as HTML email stating whether the offending request ran or was blocked, with a one-click, nonce-protected link to disable MCP access. A 15-minute cooldown per rule and per session stops an alert storm. There is an optional daily digest, separate recipient lists for alerts and digests, and a test button so you can confirm delivery before you rely on it.

A kill switch that keeps the record

Turn off all MCP access from the admin screen, or let a detection rule trip it for you. Blocked requests are still logged before they are rejected, so the audit trail stays complete while access is off. Callers get a 503 explaining why access was disabled and when. A site-wide admin notice stays up until you turn it back on.

Works with whichever MCP server you run

MCP Logs is not an MCP server for your site and does not expose your content to agents. It detects requests by the Mcp-Session-Id header, which is part of the MCP transport spec, so traffic from any compliant server lands in the same table. If your site runs more than one, you get one log instead of several.

Built for both halves of the audience

If you run the site: install, activate, and open Tools then MCP Logs. There is no setup screen and no configuration. Logging starts the moment an MCP client makes a request.

If you build on it: there is a full REST API covering every admin feature, authenticated via WordPress Application Passwords or WooCommerce API keys. The plugin is also MCP-aware itself, registering a server with ten abilities so an agent can introspect its own activity log. Source ships under src/ and builds with npm run build.

Why log deletion is not exposed to AI agents

The plugin registers ten MCP abilities. The two log-deletion abilities, clear-old-logs and clear-all-logs, are deliberately left out of that set.

The same tool set reads log content that an untrusted caller can influence. Pairing that with a one-call wipe would let planted text steer an administrator’s agent into erasing the audit trail. Deletion stays available in the admin screen and over REST, where a human is doing it. Sites that accept the trade-off can re-add the abilities with the alfmcp_mcp_server_abilities filter.

REST API

Eighteen endpoints under /wp-json/activity-log-for-mcp/v1/:

  • GET /requests for a list with filters, sort, and pagination
  • GET /stats for totals, success rate, and calls per ability
  • GET /sessions/{id} for every request in a session, in order
  • GET /search for full-text search across routes, abilities, and bodies
  • GET /errors for recent failed executions and HTTP errors
  • GET /tool-performance for per-ability call count, error rate, and unique users
  • GET /filters for distinct ability names and users
  • GET /export-csv for a server-side streamed CSV download
  • DELETE /requests to clear all logs
  • DELETE /retention to delete logs older than a given date
  • GET /security-events for detected events with filters and pagination
  • GET /security-events/stats for alert counts, active sessions, and top rule over 7 days
  • GET /security-events/export-csv for a CSV of detected events
  • PUT /security-events/{id}/acknowledge to mark an event reviewed
  • DELETE /security-events/clear-acknowledged to remove reviewed events
  • GET|PUT /security-settings to read or update detection and alerting settings
  • POST /security-settings/test-alert to send a test alert email

MCP abilities

The plugin registers an MCP server (activity-log-for-mcp-server) with ten abilities:

  • get-activity for paginated log retrieval with filters
  • get-stats for summary metrics with an optional date range
  • get-activity-by-session for a full session trace, with optional body exclusion for lighter payloads
  • search-activity for full-text search across stored requests and responses
  • analyze-errors for recent errors with full details
  • get-tool-performance for per-ability performance metrics
  • get-security-events for detected events with filters
  • get-security-stats for alert counts, active sessions, and top rule over 7 days
  • acknowledge-event to mark a security event reviewed
  • test-alert to send a test alert email

Privacy and data handling

Everything stays in your WordPress database. Logs live in {prefix}alfmcp_requests and detected events in {prefix}alfmcp_security_events. There is no telemetry, no third-party call, and no external dependency at runtime.

Credential-bearing headers including Authorization, Cookie, and X-Api-Key are replaced with [redacted] before anything is written, so the log never becomes a store of replayable credentials. Add your own header names with the alfmcp_sensitive_headers filter. Request and response bodies are stored up to 64 KB each and truncated beyond that, adjustable with alfmcp_max_body_bytes.

You control retention and can clear everything from the admin screen or over REST.

Disclaimer

MCP Logs is not affiliated with, endorsed by, or sponsored by any AI provider or the Model Context Protocol project. "MCP” and "Model Context Protocol” are referenced solely to describe the open protocol that this plugin observes.

Privacy Policy

MCP Logs records REST API requests that contain the Mcp-Session-Id header. Logged data includes request routes, methods, headers, bodies, response data, user IDs, and timestamps. Credential-bearing headers are redacted before storage. All data is stored in your WordPress database and is never transmitted to external services.

اسکرین شاٹس

انسٹالیشن

  1. Upload the activity-log-for-mcp folder to /wp-content/plugins/, or install through the WordPress plugin directory.
  2. Activate the plugin from the Plugins screen.
  3. Open Tools then MCP Logs and start watching activity as it happens.

No configuration is required. The first MCP request to hit your site appears in the log immediately.

Detection rules and email alerts are off until you turn them on. When you are ready, open the Security Events tab, enable the rules you want, set a threshold and time window for each, and add the addresses that should receive alerts. Send a test alert to confirm delivery before you rely on it.

عمومی سوالات

I have never heard of MCP. Do I need this plugin?

If no AI agents connect to your site, probably not. This plugin is for sites that expose MCP servers, either through custom code or through another plugin, and want visibility into how agents use them. If you have started exploring AI integrations for WordPress, installing this before something goes wrong is much easier than reconstructing what happened afterward.

Does it work with the MCP server plugin I already use?

Yes, as long as the client sends the Mcp-Session-Id header, which is part of the MCP transport spec and which most clients send automatically. MCP Logs detects requests by that header rather than by plugin, so traffic from any compliant server is logged.

Do I still need this if my MCP server plugin has its own log?

That depends on how much detail you need. A server’s own log usually records the tool name and some parameters. MCP Logs stores the full request and response bodies, groups requests by session, and adds detection rules, alerts, and the kill switch on top. If your site runs more than one MCP server, it also gives you one log instead of several.

Will this modify or block requests?

By default, no. The plugin observes and records, and requests pass through untouched.

The one exception is the kill switch, which is off unless you turn it on or unless you enable auto-disable on a detection rule. While it is on, MCP requests are logged and then rejected with a 503 explaining why.

What exactly gets logged?

Route, HTTP method, request headers, request body, response status, response body, ability name, execution status (success, error, or unknown), user ID, MCP session ID, and timestamp.

Will my API keys end up in the log?

No. Authorization, Cookie, X-Api-Key, and similar credential-bearing headers are replaced with [redacted] before anything is written. Add your own header names with the alfmcp_sensitive_headers filter.

Does the plugin slow down my site?

No measurable impact on regular page loads. The logger only fires on MCP REST endpoints, writes a single row per request, and object-caches all subsequent reads. There is no front-end JavaScript and no admin overhead outside the plugin’s own page.

Where is the data stored?

In two custom tables in your own database, {prefix}alfmcp_requests and {prefix}alfmcp_security_events. Nothing is transmitted externally, not to Anthropic, not to any third party, not anywhere.

How do I authenticate API requests?

WordPress Application Passwords (Users then Your Profile then Application Passwords) work out of the box over HTTP Basic Auth.

WooCommerce API keys are also supported when WooCommerce is active, but as of 1.1.0 they require an HTTPS connection and must be sent in the Authorization header. Passing them as consumer_key and consumer_secret URL arguments is no longer accepted, because secrets in a URL end up in server logs, proxy logs, and browser history. Either method maps to a real WordPress user, and that user needs the manage_options capability.

Can I delete old logs automatically?

Yes. Call the DELETE /retention endpoint or the clear-old-logs ability with a before_date, manually or from a scheduled cron job. Cutoffs inside the last 24 hours are refused, so a scheduled job cannot quietly erase the record of what just happened.

My MCP client does not appear in the logs. Why?

The plugin only logs requests that include the Mcp-Session-Id header. Most clients send it automatically. If yours does not, requests pass through silently. That is a client-side configuration issue rather than a plugin issue.

Does it work with WooCommerce?

Yes. The plugin logs MCP requests regardless of which other plugins are active, and adds support for WooCommerce API key authentication alongside Application Passwords. If an agent can update orders, adjust stock, or change prices on your store, this is the record of what it did.

What happens if I uninstall it?

Uninstalling removes the security events table, the plugin options, and the cooldown transients, and unschedules the digest cron. Your request log is deliberately kept, so uninstalling does not destroy the audit trail.

جائزے

There are no reviews for this plugin.

شراکت دار اور ڈیویلپرز

“MCP Logs” اوپن سورس سافٹ ویئر ہے۔ مندرجہ ذیل لوگوں نے اس پلگ ان میں حصہ لیا:

شراکت دار

“MCP Logs” کا 3 زبانوں میں ترجمہ کیا گیا ہے۔ تعاون کے لیے مترجمین کا شکریہ۔

“MCP Logs” کا اپنی زبان میں ترجمہ کریں۔

ڈویلپمینٹ میں دلچسپی ہے؟

کوڈ براؤز کریں، ایس این وی ریپوزیٹری کو چیک کریں یا ڈویلپمینٹ لاگ کو سبسکرائب کریں بذریعہ آر ایس ایس۔

چینج لاگ

1.1.0

  • New – Plugin renamed from "Activity Log for MCP” to "MCP Logs”. Menu, emails, and admin notices already used this name.
  • New – Threat detection with three rules that run after every logged request: request velocity per session, destructive tool use from a configurable watchlist, and error storms.
  • New – Per-rule controls for enable, threshold, time window, severity, and auto-disable.
  • New – Destructive-tool watchlist can auto-populate by scanning previously seen tool names for delete, remove and drop.
  • New – Security Events tab with filters, stat cards, CSV export, and per-event "mark as reviewed”.
  • New – Session Replay: open any security event and step through the full request timeline for that MCP session.
  • New – Kill switch to turn off all MCP access in one click. Blocked requests are still logged first, so the audit trail stays complete, and callers get a 503 explaining why and when access was disabled.
  • New – Detection rules with auto-disable can trip the kill switch themselves.
  • New – HTML email alerts with a 15-minute per-rule, per-session cooldown, stating whether the offending request was executed or blocked.
  • New – One-click, nonce-protected "Disable MCP Access” link in alert emails.
  • New – Optional daily digest email, separate alert and digest recipient lists, and a "send test alert” button.
  • New – Site-wide admin notice while MCP access is disabled.
  • New – Eight REST endpoints under /security-events and /security-settings.
  • New – Four MCP abilities: get-security-events, get-security-stats, acknowledge-event and test-alert.
  • New – {prefix}alfmcp_security_events table, plus two composite indexes on the requests table for faster session and status queries.
  • Security – WooCommerce API keys could authenticate site-wide. Authentication scope was matched against the raw request URI, which includes the query string, so appending the plugin namespace as a throwaway URL argument passed the check on any request. Scope is now taken from the parsed route.
  • Security – WooCommerce API keys are no longer accepted over plain HTTP or as query-string arguments. They now require HTTPS and the Authorization header.
  • Security – Unauthenticated visitors could plant audit-log entries. Requests were recorded before route matching and before any permission check, so a POST to any invented path created a row with an attacker-chosen body. Only registered routes are logged now.
  • Security – Stored request and response bodies are capped at 64 KB, bounding table growth from a single request.
  • Security – Log deletion is no longer exposed to AI agents. The MCP server offered one-call wipes alongside the abilities that read raw log content, so text planted in a log entry could steer an administrator’s agent into erasing the record. Deletion stays available in the admin screen and over REST.
  • Security – clear-old-logs refuses any cutoff inside the last 24 hours.
  • Security – Authorization and Cookie headers are no longer stored in plaintext, and rows written by earlier versions are scrubbed on upgrade. Three entries in the redaction list could never match, because WordPress rewrites header names to use underscores while the list used hyphens.
  • Security – The get-activity, get-activity-by-session, search-activity and analyze-errors abilities ignored the 500-row cap, so one call could pull every matching row, request and response bodies included, into memory.
  • Security – Invalid date filters reached the database instead of being discarded, silently returning everything or nothing depending on which end of the range was malformed.
  • Security – Release workflow actions are pinned to commit SHAs rather than floating tags.
  • Fix – Restored the per-page size options (10 to 500) on the Logs table.
  • Fix – get-security-stats described a 24-hour window while returning 7 days of data.
  • Fix – Security evaluation is wrapped so a failure can never break an MCP response.
  • Update – Database tables are created on load rather than only on activation, so upgrades pick up the new table without reactivating.
  • Update – Added uninstall.php to remove the security events table, plugin options and cooldown transients, and unschedule the digest cron. Your request log is deliberately kept.
  • Dev – New filters for email content, recipients, headers and template, detection patterns, redacted header names, body size cap, whether a request is logged, and which abilities the MCP server exposes.
  • Dev – Test suite grown from 61 to 133 tests. Several tests named for a security property asserted only that a function returned an array, and two of the issues above were sitting behind them.

1.0.0

  • New – Initial release.
  • New – React admin UI built with @wordpress/components.
  • New – MCP request detection via the Mcp-Session-Id header.
  • New – 10 REST API endpoints with full filtering, search, and pagination.
  • New – 7 MCP abilities exposed via the plugin’s MCP server.
  • New – WordPress Application Password and WooCommerce API key authentication.
  • New – Full-text search across stored request and response bodies.
  • New – Server-side streamed CSV export.
  • New – Per-ability performance metrics.
  • New – Session-based log grouping with optional body exclusion.
  • New – Date-based retention management.
  • New – Object caching on all database reads.