1: <?php
2:
3: declare(strict_types=1);
4:
5: /**
6: * This file is part of the Nexus MCP SDK package.
7: *
8: * (c) 2026 John Paul E. Balandan, CPA <paulbalandan@gmail.com>
9: *
10: * For the full copyright and license information, please view
11: * the LICENSE file that was distributed with this source code.
12: */
13:
14: namespace Nexus\Mcp\Extension\Apps\Client;
15:
16: use Nexus\Assert\Assert;
17: use Nexus\Mcp\Client\Extension\ClientExtensionInterface;
18: use Nexus\Mcp\Extension\Apps\Apps;
19:
20: /**
21: * The official MCP Apps extension (`io.modelcontextprotocol/ui`, SEP-1865) for the client.
22: */
23: final readonly class AppsClientExtension implements ClientExtensionInterface
24: {
25: /**
26: * @param list<non-empty-string> $mimeTypes The UI resource mime types rendered by the host
27: */
28: public function __construct(private array $mimeTypes = [Apps::MIME_TYPE])
29: {
30: Assert::that($mimeTypes)->isList('"mimeTypes" must be a list, {type} given.');
31: Assert::that($mimeTypes)->hasMinCount(1, '"mimeTypes" must not be empty.');
32: Assert::that($mimeTypes)->values()->isNonEmptyString('each "mimeTypes" must be a non-empty string, {type} given.');
33: }
34:
35: #[\Override]
36: public function getIdentifier(): string
37: {
38: return Apps::IDENTIFIER;
39: }
40:
41: #[\Override]
42: public function getSettings(): array
43: {
44: return ['mimeTypes' => $this->mimeTypes];
45: }
46:
47: #[\Override]
48: public function getRequests(): array
49: {
50: return [];
51: }
52:
53: #[\Override]
54: public function getNotifications(): array
55: {
56: return [];
57: }
58:
59: #[\Override]
60: public function getRequestHandlers(): array
61: {
62: return [];
63: }
64:
65: #[\Override]
66: public function getNotificationHandlers(): array
67: {
68: return [];
69: }
70:
71: #[\Override]
72: public function getOutboundRequests(): array
73: {
74: return [];
75: }
76: }
77: