Documentation
Ops
Developer Reference

Developer Reference


Constants

ConstantValueDescription
WCOPS_VERSIONe.g. 1.1.1Plugin version
WCOPS_PLUGIN_FILE__FILE__Absolute path to the main plugin file
WCOPS_PLUGIN_DIRplugin_dir_path()Plugin directory path
WCOPS_PLUGIN_URLplugin_dir_url()Plugin directory URL
WCOPS_REST_NAMESPACEwindcodex-ops/v1REST namespace
WCOPS_REST_ROUTE/mcpMCP route
WCOPS_PLUGIN_BASEplugin_basename()Plugin basename
WCOPS_PRO_PLUGIN_BASEwindcodex-ops-pro/windcodex-ops-pro.phpUsed to detect Ops Pro

REST Routes

RouteMethodDescription
/wp-json/windcodex-ops/v1/mcpPOSTMCP JSON-RPC endpoint (Bearer token required)
/wp-json/windcodex-ops/v1/oauth/registerPOSTDynamic client registration (10 per hour per IP)
/wp-json/windcodex-ops/v1/oauth/tokenPOSTToken exchange and refresh (30 per 5 minutes per IP)
/wcops-oauth/authorizeGET/POSTConsent screen (rewrite rule, not REST)

OAuth lifetimes: authorization code 5 minutes, access token 1 hour, refresh token 30 days.

Options

OptionDescription
wcops_settingsAll plugin settings (shared with Ops Pro)

Key settings inside wcops_settings:

KeyDefaultDescription
enabledtrueMaster switch for the connector
read_onlyfalseExpose read-only tools only
max_results_limit50Cap on rows returned by list tools
tool_groupsall truePer-group toggles: wp_site, wp_posts, wp_pages, wp_media, wp_taxonomy, wp_navigation, wp_site_health, wp_seo
requests_per_minute_limit120Clamped to 10-600 on every read
allow_dynamic_registrationtrueOAuth auto-registration
connect_capabilitymanage_optionsWho can connect: manage_options (Administrators only) or edit_others_posts (Editors and above). Any other value falls back to manage_options
require_preview_on_high_risktruePreview gate for irreversible single-item tools
log_ai_activitytrueRecord tool calls in the activity log
enable_undo_logtrueKeep undo history
undo_window_hours72Undo window (72, 96, or 168)
email_alerts_on_high_riskfalseEmail the admin address when a high-risk action runs (max 10/hour)
weekly_activity_summarytrueWeekly digest email
delete_data_on_uninstallfalseRemove data on uninstall

Cron

HookScheduleDescription
wcops_weekly_summaryWeeklySends the weekly activity summary (from 1.1.1). Scheduled while the setting is on; removed on deactivation

Filters

FilterArgumentsDescription
wcops_ability_capability$capability (string), $tool_name (string), $destructive (bool)Change the WordPress capability required to run a tool through the Abilities API
wcops_connect_capability$capability (string)Change the capability a user needs to approve a connection, which the connection's user must keep on every request and tool call
add_filter( 'wcops_ability_capability', function ( $capability, $tool_name, $destructive ) {
    if ( 'wp_cleanup_database' === $tool_name ) {
        return 'manage_options';
    }
    return $capability;
}, 10, 3 );

Default capabilities: content tools require edit_posts (or delete_posts when destructive); other tools require manage_options.

WordPress Abilities API

On WordPress 6.9+, each tool is also registered as an ability in the windcodex-ops category. Ability names follow windcodex-ops/<tool-name-with-dashes>, for example windcodex-ops/wp-create-post.

Tool definitions are not a public PHP API. Treat the MCP endpoint and the Abilities API as the supported integration surfaces.