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
imagify / vendor / wp-media / mcp-oauth / inc / Transport / Server.php

Server.php in Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF trunk, at vendor/wp-media/mcp-oauth/inc/Transport/Server.php

60 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 declare( strict_types=1 );
3
4 namespace WPMedia\MCP\OAuth\Transport;
5
6 use WP\MCP\Core\McpAdapter;
7 use WP\MCP\Infrastructure\ErrorHandling\ErrorLogMcpErrorHandler;
8 use WPMedia\MCP\OAuth\Context;
9
10 class Server {
11 /**
12 * OAuth server context.
13 *
14 * @var Context
15 */
16 private $context;
17
18 /**
19 * Constructor.
20 *
21 * @param Context $context OAuth server context.
22 */
23 public function __construct( Context $context ) {
24 $this->context = $context;
25 }
26
27 /**
28 * Register the MCP server with the adapter.
29 *
30 * Creates an isolated server at /wp-json/mcp/mcp-oauth-server using the custom
31 * OAuthHttpTransport for JWT Bearer authentication.
32 *
33 * @return void
34 */
35 public function register_server(): void {
36 if ( ! class_exists( McpAdapter::class ) ) {
37 return;
38 }
39
40 $adapter = McpAdapter::instance();
41
42 $adapter->create_server(
43 'mcp-oauth-server',
44 'mcp',
45 'mcp-oauth-server',
46 'MCP OAuth Server',
47 'MCP Server with OAuth 2.1 authentication',
48 'v1.0.0',
49 [ OAuthHttpTransport::class ],
50 ErrorLogMcpErrorHandler::class,
51 $this->context->observability_handler(),
52 [
53 'mcp-adapter/discover-abilities',
54 'mcp-adapter/get-ability-info',
55 'mcp-adapter/execute-ability',
56 ]
57 );
58 }
59 }
60