PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / trunk
Booking for Appointments and Events Calendar – Amelia vtrunk
2.4.4 2.4.3 2.4.2 2.4.1 2.4 trunk 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.28 1.2.29 1.2.3 1.2.30 1.2.31 1.2.32 1.2.33 1.2.34 1.2.35 1.2.36 1.2.37 1.2.38 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.1.3 2.2 2.2.1 2.3
ameliabooking / src / Infrastructure / WP / MCP / AmeliaMcpServerRegistrar.php
ameliabooking / src / Infrastructure / WP / MCP Last commit date
AmeliaAbilitiesRegistrar.php 1 month ago AmeliaMcpServerRegistrar.php 2 months ago
AmeliaMcpServerRegistrar.php
63 lines
1 <?php
2
3 namespace AmeliaBooking\Infrastructure\WP\MCP;
4
5 class AmeliaMcpServerRegistrar
6 {
7 /**
8 * Register the Amelia MCP server via the adapter.
9 *
10 * @param mixed $adapter The adapter instance (WP\MCP\Core\McpAdapter).
11 */
12 public static function init($adapter): void
13 {
14 $adapter->create_server(
15 'amelia-mcp-server',
16 'mcp',
17 'amelia-mcp-server',
18 'Amelia Booking System',
19 'Amelia Booking System – appointments, events, services and customers.',
20 '1.0.0',
21 array( 'WP\\MCP\\Transport\\HttpTransport' ),
22 null,
23 null,
24 array(
25 'amelia/list-services',
26 'amelia/list-employees',
27 'amelia/list-customers',
28 'amelia/list-events',
29 'amelia/list-appointments',
30 'amelia/add-service',
31 'amelia/add-customer',
32 'amelia/create-appointment',
33 'amelia/create-event',
34 'amelia/book-event',
35 'amelia/cancel-booking',
36 'amelia/check-availability',
37 ),
38 array(),
39 array(),
40 static function () {
41 if (is_user_logged_in()) {
42 return true;
43 }
44
45 $username = sanitize_text_field($_SERVER['PHP_AUTH_USER'] ?? '');
46 $password = sanitize_text_field($_SERVER['PHP_AUTH_PW'] ?? '');
47
48 if (! $username || ! $password) {
49 return false;
50 }
51
52 $user = wp_authenticate_application_password(null, $username, $password);
53
54 if ($user instanceof \WP_User) {
55 return true;
56 }
57
58 return false;
59 }
60 );
61 }
62 }
63