Skip to main content

GF_MCP_Settings

MCP settings page for Gravity Forms.

Registers a settings subpage under GF Settings via hooks. Always loads — shows unavailable message when Abilities API or MCP bridge is missing, hides the toggle section via GF dependency when requirements are not met.

Since: 3.1.0

Source: includes/abilities/class-gf-mcp-settings.php:16

Details

  • Kind: class
  • Namespace: (global)

Methods

MethodDescription
init()Initialize hooks.
enqueue_admin_scripts()Enqueue scripts needed by the MCP settings page.
add_settings_tab()Add the MCP tab to the GF settings navigation.
render_settings_page()Render the MCP settings page.
is_mcp_available()Check if all MCP dependencies are available.
is_enabled()Check if MCP is enabled via the settings toggle.
get_enabled_tools()Get the list of ability names the admin has enabled.
is_tool_enabled()Check if a specific ability (tool) is enabled.
register_addon()Register an add-on's MCP tool contribution.
get_registered_addons()Get all registered add-on contributions, keyed by namespace.
get_registered_namespaces()Get every ability namespace admitted to GF's MCP surface.
is_registered_namespace()Whether an ability name's namespace is admitted to GF's MCP surface.
get_endpoint_mode()Get the configured endpoint mode.
is_dedicated_endpoint()Check if dedicated endpoint mode is active.

Method Reference

init()

public static function init()

Initialize hooks.

Returns

  • void

Since: 3.1.0

Source: includes/abilities/class-gf-mcp-settings.php:145

enqueue_admin_scripts()

public static function enqueue_admin_scripts()

Enqueue scripts needed by the MCP settings page.

The Settings renderer is built at render time (on the gform_settings_mcp action), which runs after admin_enqueue_scripts, so the framework never gets a chance to enqueue its own conditional scripts for this subview. The tool sections use a live dependency, whose inline bootstrap needs the Settings dependencies script defined in the document head before the page body runs it — so it is enqueued here directly.

Returns

  • void

Since: 3.1.0

Source: includes/abilities/class-gf-mcp-settings.php:165

add_settings_tab()

public static function add_settings_tab( $tabs )

Add the MCP tab to the GF settings navigation.

Parameters

NameTypeDefaultDescription
$tabsarrayExisting settings tabs.

Returns

  • array

Since: 3.1.0

Source: includes/abilities/class-gf-mcp-settings.php:190

render_settings_page()

public static function render_settings_page()

Render the MCP settings page.

Fired by do_action( 'gform_settings_mcp' ) from the default case in GFSettings::settings_page().

Returns

  • void

Since: 3.1.0

Source: includes/abilities/class-gf-mcp-settings.php:214

is_mcp_available()

public static function is_mcp_available()

Check if all MCP dependencies are available.

Requires the WordPress Abilities API (wp_register_ability) — WordPress 6.9+ core. Requires the canonical WordPress MCP Adapter package loaded by Composer.

Returns

  • bool

Since: 3.1.0

Source: includes/abilities/class-gf-mcp-settings.php:547

is_enabled()

public static function is_enabled()

Check if MCP is enabled via the settings toggle.

Returns

  • bool

Since: 3.1.0

Source: includes/abilities/class-gf-mcp-settings.php:569

get_enabled_tools()

public static function get_enabled_tools()

Get the list of ability names the admin has enabled.

Returns

  • string[]

Since: 3.1.0

Source: includes/abilities/class-gf-mcp-settings.php:580

is_tool_enabled()

public static function is_tool_enabled( $ability_name )

Check if a specific ability (tool) is enabled.

The master MCP setting gates everything: when MCP is disabled no tool is enabled regardless of the saved list. This is the single source of truth consulted by every exposure and execution gate.

Parameters

NameTypeDefaultDescription
$ability_namestringThe full ability name (e.g. 'gravityforms/forms-get').

Returns

  • bool

Since: 3.1.0

Source: includes/abilities/class-gf-mcp-settings.php:599

register_addon()

public static function register_addon( $config )

Register an add-on's MCP tool contribution.

Gravity Forms is the single MCP host for the ecosystem: add-ons (Gravity Flow, Stripe, …) contribute their abilities to GF's endpoint rather than running their own MCP server. Abilities are still registered through the WordPress Abilities API as usual; this contract governs only exposure on GF's endpoint, settings rendering, and gating.

Abilities self-describe (label, summary, readonly/destructive annotations, required capability, mcp.public), so an add-on does NOT re-declare per-tool metadata here — it declares its namespace, a group label for its settings metabox, and optionally a skill entry and default-enabled policy.

Parameters

NameTypeDefaultDescription
$configarray{

Returns

  • bool — True if registered; false if the config was invalid or collides with core.

Since: 3.1.0

Source: includes/abilities/class-gf-mcp-settings.php:636

get_registered_addons()

public static function get_registered_addons()

Get all registered add-on contributions, keyed by namespace.

Returns

  • array<string,array>

Since: 3.1.0

Source: includes/abilities/class-gf-mcp-settings.php:705

get_registered_namespaces()

public static function get_registered_namespaces()

Get every ability namespace admitted to GF's MCP surface.

Core ('gravityforms') plus every registered add-on namespace. This is the allowlist the dedicated server tool-list assembly checks against.

Returns

  • string[]

Since: 3.1.0

Source: includes/abilities/class-gf-mcp-settings.php:732

is_registered_namespace()

public static function is_registered_namespace( $ability_name )

Whether an ability name's namespace is admitted to GF's MCP surface.

True for core 'gravityforms/*' abilities and for any ability under a registered add-on namespace. Used fail-closed by the server tool-list assembly so a foreign or unregistered namespace can never be exposed.

Parameters

NameTypeDefaultDescription
$ability_namestringFull ability name, e.g. 'gravityflow/inbox-list'.

Returns

  • bool

Since: 3.1.0

Source: includes/abilities/class-gf-mcp-settings.php:756

get_endpoint_mode()

public static function get_endpoint_mode()

Get the configured endpoint mode.

Returns

  • string — 'site' or 'dedicated'.

Since: 3.1.0

Source: includes/abilities/class-gf-mcp-settings.php:1013

is_dedicated_endpoint()

public static function is_dedicated_endpoint()

Check if dedicated endpoint mode is active.

When true, GF abilities are served from a dedicated MCP server at /wp-json/mcp/gravityforms instead of the shared site MCP.

Returns

  • bool

Since: 3.1.0

Source: includes/abilities/class-gf-mcp-settings.php:1031