PluginProbe
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF / trunk
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF vtrunk
2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.9 2.2.8 trunk 1.10 1.3.3 1.3.4 1.3.5 1.3.5.1 1.3.5.2 1.3.6 1.3.6.1 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.5 All 103 releases
← All changes | vendor/wp-media/mcp-oauth/inc/Context.php +33 -0 2.3.1 → trunk View file →
@@ -2,8 +2,11 @@
2 2 declare(strict_types=1);
3 3
4 4 namespace WPMedia\MCP\OAuth;
5 5
6 +use WP\MCP\Infrastructure\Observability\Contracts\McpObservabilityHandlerInterface;
7 +use WP\MCP\Infrastructure\Observability\NullMcpObservabilityHandler;
8 +
6 9 class Context {
7 10 /**
8 11 * Determines whether the MCP OAuth server is enabled.
9 12 *
@@ -22,6 +25,36 @@
22 25 *
23 26 * @param bool $enabled Whether the MCP OAuth server is enabled. Default true.
24 27 */
25 28 return wpm_apply_filters_typed( 'boolean', 'wpmedia_mcp_oauth_server_enabled', $enabled );
29 + }
30 +
31 + /**
32 + * Observability handler class used by the MCP server.
33 + *
34 + * Defaults to the mcp-adapter's null handler, so no observability event is
35 + * written unless a site opts in. The verbose handler
36 + * (`WPMedia\MCP\OAuth\Transport\McpObservabilityHandler`) records one event per
37 + * server creation, i.e. once per REST request, which floods debug.log on sites
38 + * running with WP_DEBUG and WP_DEBUG_LOG enabled.
39 + *
40 + * @return class-string<McpObservabilityHandlerInterface> Observability handler class name.
41 + */
42 + public function observability_handler(): string {
43 + /**
44 + * Filters the observability handler class used by the MCP server.
45 + *
46 + * The value must be a class implementing the mcp-adapter's
47 + * McpObservabilityHandlerInterface; any other value is ignored and the
48 + * null handler is used instead.
49 + *
50 + * @param string $handler Observability handler class name. Default NullMcpObservabilityHandler.
51 + */
52 + $handler = wpm_apply_filters_typed( 'string', 'wpmedia_mcp_oauth_observability_handler', NullMcpObservabilityHandler::class );
53 +
54 + if ( ! is_a( $handler, McpObservabilityHandlerInterface::class, true ) ) {
55 + return NullMcpObservabilityHandler::class;
56 + }
57 +
58 + return $handler;
26 59 }
27 60 }