You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -13,7 +13,7 @@ Additionally, you can create your own capabilities (tools, prompts, and resource
13
13
14
14
The [[= product_name =]] MCP server framework (`ibexa/mcp`) is built on top of the [official PHP SDK for MCP (`mcp/sdk`)](https://github.com/modelcontextprotocol/php-sdk).
15
15
16
-
A PHP class that implements MCP server capabilities such as tools, prompts, or resources, must:
16
+
A PHP class that implements MCP server capabilities such as tools, prompts, or resources must:
17
17
18
18
- implement [`Ibexa\Contracts\Mcp\McpCapabilityInterface`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Mcp-McpCapabilityInterface.html) so that it can be scanned for capabilities
19
19
- use attributes from the [`Ibexa\Contracts\Mcp\Attribute` namespace](/api/php_api/php_api_reference/namespaces/ibexa-contracts-mcp-attribute.html) to declare capabilities
@@ -25,7 +25,7 @@ It accepts the following optional arguments:
25
25
26
26
-`servers` - array of server identifiers the tool is assigned to
27
27
<br>For more information, see [tools configuration](mcp_config.md#tool-configuration).
28
-
-`name` - tool codename - if not set, function name is used
28
+
-`name` - tool codename - if not set, the function name is used
29
29
-`title` - tool title for user interfaces - if not set, the `name` is used
30
30
-`description` - tool description, used by AI agents to understand the tool's purpose
31
31
-`icons` - array of [`Mcp\Schema\Icon`](https://github.com/modelcontextprotocol/php-sdk/blob/main/src/Schema/Icon.php) instances
@@ -53,7 +53,7 @@ Methods that return a prompt are marked with the [`Ibexa\Contracts\Mcp\Attribute
53
53
It accepts several arguments that describe how the prompt is used:
54
54
55
55
-`servers` - array of server identifiers exposing this prompt - required for prompts
56
-
-`name` (optional) - prompt codename - if not set, method name is used
56
+
-`name` (optional) - prompt codename - if not set, the method name is used
57
57
-`title` (optional) - prompt title - if not set, `name` is used
-`icons` (optional) - array of [`Mcp\Schema\Icon`](https://github.com/modelcontextprotocol/php-sdk/blob/main/src/Schema/Icon.php) instances
@@ -63,7 +63,7 @@ It accepts several arguments that describe how the prompt is used:
63
63
64
64
The framework automatically builds the `arguments` array from the method arguments and their types.
65
65
Prompt method arguments must be strings to comply with the [`GetPromptRequestParams` schema](https://modelcontextprotocol.io/specification/2025-11-25/schema#getpromptrequestparams).
66
-
To add argument descriptions, use DocBlock `@param` tags, it's mapped to the `description` defined by the [`PromptArgument` schema](https://modelcontextprotocol.io/specification/2025-11-25/schema#promptargument).
66
+
To add argument descriptions, use DocBlock `@param` tags, which are mapped to the `description` defined by the [`PromptArgument` schema](https://modelcontextprotocol.io/specification/2025-11-25/schema#promptargument).
67
67
68
68
## Example
69
69
@@ -99,7 +99,7 @@ In a new `config/packages/mcp.yaml` file, define a new MCP server for the `defau
Adapt the `allowed_hosts` to your case, for example, if you want to use the DDEV `.ddev.site` domain instead of its `127.0.0.1` address equivalent.
102
+
Adapt the `allowed_hosts` to your case, for example, if you want to use the DDEV `.ddev.site` domain instead of the equivalent `127.0.0.1` address.
103
103
104
104
An `ibexa.mcp.example` route is now available:
105
105
@@ -113,15 +113,15 @@ Create an `ExampleCapabilities` class that implements `McpCapabilityInterface`.
113
113
114
114
The class contains:
115
115
116
-
- a method marked with an [`McpTool` attribute](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Mcp-Attribute-McpTool.html) that associates it to the `example` server as `greet` tool
116
+
- a method marked with an [`McpTool` attribute](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Mcp-Attribute-McpTool.html) that associates it with the `example` server as the`greet` tool
117
117
- a method marked with an [`McpPrompt` attribute](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Mcp-Attribute-McpPrompt.html) that provides a prompt template to users
In this example, the `servers` attribute parameter associates only this tool with the `example` server.
124
-
Alternatively, you can assign all tools from the class to a server by using the `tools` parameter in server configuration.
124
+
Alternatively, you can assign all tools from the class to a server by using the `tools` parameter in the server configuration.
125
125
For more information, see [tools configuration](mcp_config.md#tool-configuration).
126
126
127
127
For the prompt, the `servers` parameter is required.
@@ -249,7 +249,7 @@ You can test your server with the [MCP Inspector](https://modelcontextprotocol.i
249
249
You can even use the inspector as a DDEV add-on with [`michtio/ddev-mcp-inspector`](https://github.com/michtio/ddev-mcp-inspector).
250
250
You still need to ask for a JWT token through REST or GraphQL APIs, and use it in the MCP Inspector configuration to connect to the server.
251
251
252
-
You can use a Web interface to obtain the JWT token:
252
+
You can use a web interface to obtain the JWT token:
253
253
254
254
-[REST live documentation](rest_api_authentication.md#jwt-token-obtained-through-rest-documentation)
255
255
-[GraphiQL](graphql.md#jwt-authentication)
@@ -283,21 +283,23 @@ You can select and test it in the right column.
283
283
284
284

285
285
286
-
### Perform Copilot CLI test
286
+
### Perform Copilot or Claude Code test
287
287
288
-
#### Add MCP server to Copilot CLI
288
+
You can test your MCP server with [Copilot CLI](https://docs.github.com/en/copilot/concepts/agents/copilot-cli/about-copilot-cli) or [Claude Code CLI](https://code.claude.com/docs/en/overview), as illustrated here, or with any other agent or interface.
289
289
290
-
For the sake of the [Copilot CLI](https://docs.github.com/en/copilot/concepts/agents/copilot-cli/about-copilot-cli) test in this example, you configure the MCP server in an `.mcp.json` file at the [[= product_name =]] project root.
291
-
This way it is only available for a session opened from there.
290
+
#### Add MCP server to agent CLI
291
+
292
+
For the sake of the agent test, in this example, you configure the MCP server in an `.mcp.json` file at the [[= product_name =]] project root.
293
+
This way, it is only available for a session opened from there.
292
294
293
295
You can handle the JWT token for this test in the following ways:
294
296
295
-
- Hardcode the JWT token into the configuration and update it at every expiration.
296
-
- Wrap a JWT token request and an MCP server call into a script.
297
+
-[Hard-code the JWT token](#hard-coded-variant) into the configuration and update it at every expiration.
298
+
-[Wrap a JWT token request and an MCP server call into a script](#fully-scripted-variant).
297
299
298
-
##### Hardcoded variant
300
+
##### Hard-coded variant
299
301
300
-
The hardcoded JWT token configuration in `.mcp.json` looks as follows:
302
+
The hard-coded JWT token configuration in `.mcp.json` looks as follows:
When Copilot complains that it can't communicate with the MCP server, reload the MCP servers in Copilot CLI with one of these methods:
347
+
When the agent complains that it can't communicate with the MCP server, reload it:
334
348
335
-
- Run `/mcp reload` command to reload all MCP servers.
336
-
- Run `/mcp disable ibexa-example` and `/mcp enable ibexa-example` to only reload the `ibexa-example` server.
349
+
=== "Copilot CLI"
337
350
338
-
!!! note "Reloading multiple MCP servers"
351
+
Reload the MCP servers in Copilot CLI with one of these methods:
339
352
340
-
If you have several MCP servers enabled globally, reloading all of them at the same time can be time consuming.
341
-
Consider reloading them one by one.
353
+
- Run `/mcp reload` command to reload all MCP servers.
354
+
- Run `/mcp disable ibexa-example` and `/mcp enable ibexa-example` to only reload the `ibexa-example` server.
342
355
343
-
#### Run MCP server test with Copilot CLI
356
+
!!! note "Reloading multiple MCP servers"
344
357
345
-
Launch Copilot CLI at the project root, where the `.mcp.json` file is located:
358
+
If you have several MCP servers enabled globally, reloading all of them at the same time can be time-consuming.
359
+
Consider reloading them one by one.
346
360
347
-
```bash
348
-
cd /path/to/project
349
-
copilot
350
-
```
361
+
=== "Claude Code CLI"
362
+
363
+
Run `/mcp reconnect ibexa-example` command to reconnect the `ibexa-example` MCP server.
364
+
365
+
#### Run MCP server test with Copilot CLI or Claude Code CLI
366
+
367
+
Launch the agent CLI at the project root, where the `.mcp.json` file is located:
368
+
369
+
=== "Copilot CLI"
370
+
371
+
```bash
372
+
cd /path/to/project
373
+
copilot
374
+
```
375
+
376
+
=== "Claude Code CLI"
377
+
378
+
```bash
379
+
cd /path/to/project
380
+
claude
381
+
```
351
382
352
383
If prompted, confirm that you trust the files in this folder.
353
384
You may choose to have your choice remembered for the future.
354
385
355
-
Run the `/mcp show ibexa-example` to check the MCP server status and details:
386
+
You can check the MCP server status and details with the `/mcp` command:
356
387
357
-
```text
358
-
MCP Server: ibexa-example
388
+
=== "Copilot CLI"
359
389
360
-
Type: http
361
-
URL: http://localhost/mcp/example
362
-
Status: ✓ Connected
363
-
Source: /path/to/project/.mcp.json
390
+
Run the `/mcp show ibexa-example` command to check the MCP server status and details:
364
391
365
-
Tools (1/1 enabled):
366
-
✓ greet: Greet a user by name
367
-
```
392
+
``` text
393
+
MCP Server: ibexa-example
394
+
395
+
Type: stdio
396
+
Command: bash
397
+
Status: ✓ Connected
398
+
Source: /path/to/project/.mcp.json
399
+
400
+
Tools (1/1 enabled):
401
+
✓ greet: Greet a user by name (70 tokens)
402
+
```
403
+
404
+
=== "Claude Code CLI"
368
405
369
-
You can prompt Copilot to greet you.
406
+
Run the `/mcp` command and select ibexa-example to check the MCP server status and details:
407
+
408
+
``` text
409
+
Ibexa-example MCP Server
410
+
411
+
Status: ✔ connected
412
+
Command: bash
413
+
Args: mcp-ibexa-example-wrapper.sh
414
+
Config location: /path/to/project/.mcp.json
415
+
Capabilities: tools
416
+
Tools: 1 tool
417
+
```
418
+
419
+
You can prompt the agent to greet you.
370
420
It should use the `greet` tool to do so.
371
421
372
422
- You can ask it "Please, greet me." and it might respond with a request for your name if it doesn't already know it.
373
-
- You can also give it another name to greet, like in the prompt template.
423
+
- You can also give it another name to greet, as shown in the prompt template.
374
424
375
425
During a morning session, the interaction could look like this:
376
426
377
-
```text
378
-
❯ Hi. Please, greet me.
427
+
=== "Copilot CLI"
379
428
380
-
◐ The user wants to be greeted. I'll use the ibexa-example-greet tool, but I don't know their name. Let me ask them first... actually, the tool requires a name. Let me ask the user for their name.
429
+
```text
430
+
❯ Hi. Please, greet me.
381
431
382
-
Wait, actually I can just greet them without knowing their name using a general greeting, but the tool requires a name parameter. Let me ask for their name.
432
+
◐ The user wants to be greeted. I'll use the ibexa-example-greet tool, but I don't know their name. Let me ask them first... actually, the tool requires a name. Let me ask the user for their name.
383
433
384
-
● Asked user What's your name?
385
-
└ Pulley
434
+
Wait, actually I can just greet them without knowing their name using a general greeting, but the tool requires a name parameter. Let me ask for their name.
386
435
387
-
● Greet a user (MCP: ibexa-example) · name: "Pulley"
❯ Please, greet someone named "ElePHPant" in a general way (so I could reuse it at any time)
498
+
499
+
Called ibexa-example
500
+
501
+
⏺ Hello, ElePHPant!
502
+
503
+
✻ Brewed for 5s
504
+
505
+
❯ Please, greet someone named "ElePHPant" like it's 22:30
506
+
507
+
⏺ That falls under the "evening" variant: Good evening, ElePHPant!
508
+
509
+
✻ Sautéed for 2s
510
+
```
511
+
512
+
The agent's reflections, reaction times, and final responses, including the improvised emojis, may differ from those examples.
513
+
The key point is that the agent decides to use the `greet` tool, calls it with the right argument, and then uses the call result in its final output.
419
514
420
-
The Copilot's reflection and its final response, including the improvised emoji, may differ from this example.
421
-
The key point is that Copilot CLI decides to use the `greet` tool, calls it with the right argument, displays the call result, and then uses it in its final output.
515
+
You can fine-tune the prompt, or remove unnecessary variants if needed.
516
+
For example, you could instruct the agent to always use the time-of-day variants, or simply remove the `general` and `close` variants.
517
+
Removing what's unnecessary is more efficient than extending the instructions.
0 commit comments