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 the host renders
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(\count($mimeTypes))->isPositiveInt('"mimeTypes" must not be empty.');
32: Assert::that($mimeTypes)
33: ->values()
34: ->isNonEmptyString('each "mimeTypes" must be a non-empty string, {type} given.')
35: ;
36: }
37:
38: #[\Override]
39: public function getIdentifier(): string
40: {
41: return Apps::IDENTIFIER;
42: }
43:
44: #[\Override]
45: public function getSettings(): array
46: {
47: return ['mimeTypes' => $this->mimeTypes];
48: }
49:
50: #[\Override]
51: public function getRequests(): array
52: {
53: return [];
54: }
55:
56: #[\Override]
57: public function getNotifications(): array
58: {
59: return [];
60: }
61:
62: #[\Override]
63: public function getRequestHandlers(): array
64: {
65: return [];
66: }
67:
68: #[\Override]
69: public function getNotificationHandlers(): array
70: {
71: return [];
72: }
73:
74: #[\Override]
75: public function getOutboundRequests(): array
76: {
77: return [];
78: }
79: }
80: