v2.0.0: includes/Core/Plugin.php
This commit is contained in:
@@ -1,41 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace AskTamMCP\Core;
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
final class Plugin {
|
||||
|
||||
private static ?self $instance = null;
|
||||
|
||||
public static function instance(): self {
|
||||
if (null === self::$instance) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
if (null === self::$instance) self::$instance = new self();
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
private function __construct() {}
|
||||
|
||||
public function boot(): void {
|
||||
load_plugin_textdomain('advanced-mcp-plugin', false, dirname(plugin_basename(ASKTAM_MCP_FILE)) . '/languages');
|
||||
|
||||
add_action('rest_api_init', [$this, 'registerRoutes']);
|
||||
|
||||
if (is_admin()) {
|
||||
new AdminMenu();
|
||||
new \AskTamMCP\Admin\AdminActions();
|
||||
}
|
||||
if (is_admin()) { new AdminMenu(); new \AskTamMCP\Admin\AdminActions(); }
|
||||
}
|
||||
|
||||
public function registerRoutes(): void {
|
||||
// MCP SSE + JSON-RPC
|
||||
(new \AskTamMCP\MCP\Server())->registerRoutes();
|
||||
|
||||
// OAuth 2.0 token endpoint (for Claude.ai connector)
|
||||
(new \AskTamMCP\MCP\OAuthServer())->registerRoutes();
|
||||
|
||||
// Admin API key CRUD
|
||||
(new \AskTamMCP\Admin\ApiKeyController())->registerRoutes();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user