| @@ -4,11 +4,28 @@ | ||
| 4 | 4 | namespace WPMedia\MCP\OAuth\Transport; |
| 5 | 5 | |
| 6 | 6 | use WP\MCP\Core\McpAdapter; |
| 7 | 7 | use WP\MCP\Infrastructure\ErrorHandling\ErrorLogMcpErrorHandler; |
| 8 | +use WPMedia\MCP\OAuth\Context; | |
| 8 | 9 | |
| 9 | 10 | class Server { |
| 10 | 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 | + /** | |
| 11 | 28 | * Register the MCP server with the adapter. |
| 12 | 29 | * |
| 13 | 30 | * Creates an isolated server at /wp-json/mcp/mcp-oauth-server using the custom |
| 14 | 31 | * OAuthHttpTransport for JWT Bearer authentication. |
| @@ -30,9 +47,9 @@ | ||
| 30 | 47 | 'MCP Server with OAuth 2.1 authentication', |
| 31 | 48 | 'v1.0.0', |
| 32 | 49 | [ OAuthHttpTransport::class ], |
| 33 | 50 | ErrorLogMcpErrorHandler::class, |
| 34 | - McpObservabilityHandler::class, | |
| 51 | + $this->context->observability_handler(), | |
| 35 | 52 | [ |
| 36 | 53 | 'mcp-adapter/discover-abilities', |
| 37 | 54 | 'mcp-adapter/get-ability-info', |
| 38 | 55 | 'mcp-adapter/execute-ability', |