fix: wire AdminActions into boot
This commit is contained in:
@@ -4,9 +4,6 @@ namespace AskTamMCP\Core;
|
|||||||
|
|
||||||
defined('ABSPATH') || exit;
|
defined('ABSPATH') || exit;
|
||||||
|
|
||||||
/**
|
|
||||||
* Main plugin bootstrap. Singleton.
|
|
||||||
*/
|
|
||||||
final class Plugin {
|
final class Plugin {
|
||||||
|
|
||||||
private static ?self $instance = null;
|
private static ?self $instance = null;
|
||||||
@@ -21,24 +18,20 @@ final class Plugin {
|
|||||||
private function __construct() {}
|
private function __construct() {}
|
||||||
|
|
||||||
public function boot(): void {
|
public function boot(): void {
|
||||||
// Load text domain
|
|
||||||
load_plugin_textdomain('advanced-mcp-plugin', false, dirname(plugin_basename(ASKTAM_MCP_FILE)) . '/languages');
|
load_plugin_textdomain('advanced-mcp-plugin', false, dirname(plugin_basename(ASKTAM_MCP_FILE)) . '/languages');
|
||||||
|
|
||||||
// Register REST routes (MCP endpoint + admin API)
|
|
||||||
add_action('rest_api_init', [$this, 'registerRoutes']);
|
add_action('rest_api_init', [$this, 'registerRoutes']);
|
||||||
|
|
||||||
// Admin UI
|
|
||||||
if (is_admin()) {
|
if (is_admin()) {
|
||||||
new AdminMenu();
|
new AdminMenu();
|
||||||
|
new \AskTamMCP\Admin\AdminActions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function registerRoutes(): void {
|
public function registerRoutes(): void {
|
||||||
// MCP SSE endpoint — AI clients connect here
|
|
||||||
$mcpServer = new \AskTamMCP\MCP\Server();
|
$mcpServer = new \AskTamMCP\MCP\Server();
|
||||||
$mcpServer->registerRoutes();
|
$mcpServer->registerRoutes();
|
||||||
|
|
||||||
// Internal admin REST routes (API key management)
|
|
||||||
$apiKeyController = new \AskTamMCP\Admin\ApiKeyController();
|
$apiKeyController = new \AskTamMCP\Admin\ApiKeyController();
|
||||||
$apiKeyController->registerRoutes();
|
$apiKeyController->registerRoutes();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user