Skip to content

Commit 8a588a3

Browse files
refactor: add completion capability and simplify capabilities config
- Updated the capabilities structure in `mcp.php` to streamline the configuration by removing nested arrays for tools, resources, prompts, and logging. - Enhanced the `McpServiceProvider` to reflect the new configuration structure, ensuring compatibility with the updated capabilities. - Added support for completions and clarified the experimental capabilities in the configuration.
1 parent 0b094cb commit 8a588a3

File tree

4 files changed

+60
-51
lines changed

4 files changed

+60
-51
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"require": {
2222
"php": "^8.1",
2323
"laravel/framework": "^9.46 || ^10.34 || ^11.29 || ^12.0",
24-
"php-mcp/server": "^3.0"
24+
"php-mcp/server": "^3.1"
2525
},
2626
"require-dev": {
2727
"laravel/pint": "^1.13",
@@ -62,4 +62,4 @@
6262
},
6363
"minimum-stability": "dev",
6464
"prefer-stable": true
65-
}
65+
}

config/mcp.php

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -153,28 +153,35 @@
153153
| support for tools, resources, prompts, and their related functionality like
154154
| subscriptions and change notifications.
155155
|
156+
| The following capabilities are supported:
157+
| - tools - Whether the server offers tools.
158+
| - toolsListChanged - Whether the server supports sending a notification when the list of tools changes.
159+
| - resources - Whether the server offers resources.
160+
| - resourcesSubscribe - Whether the server supports resource subscriptions.
161+
| - resourcesListChanged - Whether the server supports sending a notification when the list of resources changes.
162+
| - prompts - Whether the server offers prompts.
163+
| - promptsListChanged - Whether the server supports sending a notification when the list of prompts changes.
164+
| - logging - Whether the server supports sending log messages to the client.
165+
| - completions - Whether the server supports argument autocompletion suggestions.
166+
| - experimental - Experimental, non-standard capabilities that the server supports.
167+
|
156168
*/
157169
'capabilities' => [
158-
'tools' => [
159-
'enabled' => (bool) env('MCP_CAP_TOOLS_ENABLED', true),
160-
'listChanged' => (bool) env('MCP_CAP_TOOLS_LIST_CHANGED', true),
161-
],
170+
'tools' => (bool) env('MCP_CAP_TOOLS_ENABLED', true),
171+
'toolsListChanged' => (bool) env('MCP_CAP_TOOLS_LIST_CHANGED', true),
162172

163-
'resources' => [
164-
'enabled' => (bool) env('MCP_CAP_RESOURCES_ENABLED', true),
165-
'subscribe' => (bool) env('MCP_CAP_RESOURCES_SUBSCRIBE', true),
166-
'listChanged' => (bool) env('MCP_CAP_RESOURCES_LIST_CHANGED', true),
167-
],
173+
'resources' => (bool) env('MCP_CAP_RESOURCES_ENABLED', true),
174+
'resourcesSubscribe' => (bool) env('MCP_CAP_RESOURCES_SUBSCRIBE', true),
175+
'resourcesListChanged' => (bool) env('MCP_CAP_RESOURCES_LIST_CHANGED', true),
168176

169-
'prompts' => [
170-
'enabled' => (bool) env('MCP_CAP_PROMPTS_ENABLED', true),
171-
'listChanged' => (bool) env('MCP_CAP_PROMPTS_LIST_CHANGED', true),
172-
],
177+
'prompts' => (bool) env('MCP_CAP_PROMPTS_ENABLED', true),
178+
'promptsListChanged' => (bool) env('MCP_CAP_PROMPTS_LIST_CHANGED', true),
173179

174-
'logging' => [
175-
'enabled' => (bool) env('MCP_CAP_LOGGING_ENABLED', true),
176-
'setLevel' => (bool) env('MCP_CAP_LOGGING_SET_LEVEL', false),
177-
],
180+
'logging' => (bool) env('MCP_CAP_LOGGING_ENABLED', true),
181+
182+
'completions' => (bool) env('MCP_CAP_COMPLETIONS_ENABLED', true),
183+
184+
'experimental' => null,
178185
],
179186

180187
/*

samples/basic/composer.lock

Lines changed: 22 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/McpServiceProvider.php

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,16 @@ protected function buildServer(): void
6262
$logger = $app['log']->channel(config('mcp.logging.channel'));
6363
$cache = $app['cache']->store($app['config']->get('mcp.cache.store'));
6464
$capabilities = ServerCapabilities::make(
65-
tools: config('mcp.capabilities.tools.enabled', true),
66-
toolsListChanged: config('mcp.capabilities.tools.listChanged', true),
67-
resources: config('mcp.capabilities.resources.enabled', true),
68-
resourcesSubscribe: config('mcp.capabilities.resources.subscribe', true),
69-
resourcesListChanged: config('mcp.capabilities.resources.listChanged', true),
70-
prompts: config('mcp.capabilities.prompts.enabled', true),
71-
promptsListChanged: config('mcp.capabilities.prompts.listChanged', true),
72-
logging: config('mcp.capabilities.logging.enabled', true),
73-
experimental: null,
65+
tools: (bool) config('mcp.capabilities.tools', true),
66+
toolsListChanged: (bool) config('mcp.capabilities.toolsListChanged', true),
67+
resources: (bool) config('mcp.capabilities.resources', true),
68+
resourcesSubscribe: (bool) config('mcp.capabilities.resourcesSubscribe', true),
69+
resourcesListChanged: (bool) config('mcp.capabilities.resourcesListChanged', true),
70+
prompts: (bool) config('mcp.capabilities.prompts', true),
71+
promptsListChanged: (bool) config('mcp.capabilities.promptsListChanged', true),
72+
logging: (bool) config('mcp.capabilities.logging', true),
73+
completions: (bool) config('mcp.capabilities.completions', true),
74+
experimental: config('mcp.capabilities.experimental', null),
7475
);
7576

7677
$sessionHandler = $this->createSessionHandler($app);
@@ -83,7 +84,8 @@ protected function buildServer(): void
8384
->withCache($cache)
8485
->withSessionHandler($sessionHandler, $sessionTtl)
8586
->withCapabilities($capabilities)
86-
->withPaginationLimit((int) config('mcp.pagination_limit', 50));
87+
->withPaginationLimit((int) config('mcp.pagination_limit', 50))
88+
->withInstructions(config('mcp.server.instructions'));
8789

8890
$registrar = $app->make(McpRegistrar::class);
8991
$registrar->applyBlueprints($builder);

0 commit comments

Comments
 (0)