Installing MCP Bundle

← Installing MCP Bundle

Ashterix

docs: rewrite JsonRpcBundle docs, add SDK docs, move them under docs/api

en/docs/api/mcp-bundle/installation.md new file +133 āˆ’0

1 + # Installing MCP Bundle
2 +
3 + :::info
4 + Requirements for version 1.x: PHP >= 8.4, Symfony ^7.2 or ^8.0, `ufo-tech/json-rpc-bundle` ^10.4.3, `mcp/sdk` ^0.8.1. The JsonRpcBundle server must already be [installed](/docs/api/json-rpc-bundle/installation).
5 + :::
6 +
7 + ## Step 1: Installation
8 +
9 + ```bash
10 + composer require ufo-tech/mcp-bundle
11 + ```
12 +
13 + ## Step 2: Registering the bundle
14 +
15 + Add the bundle to `config/bundles.php` next to JsonRpcBundle:
16 +
17 + ```php
18 + return [
19 + // ...
20 + Ufo\JsonRpcBundle\UfoJsonRpcBundle::class => ['all' => true],
21 + Ufo\McpBundle\UfoMcpBundle::class => ['all' => true],
22 + ];
23 + ```
24 +
25 + ## Step 3: Configuration
26 +
27 + :::warning
28 + There is no Symfony Flex recipe for the bundle yet: the configuration files are copied by hand.
29 + :::
30 +
31 + Copy `vendor/ufo-tech/mcp-bundle/install/packages/ufo_mcp.yaml` to `config/packages/`. Minimal configuration:
32 +
33 + ```yaml
34 + # config/packages/ufo_mcp.yaml
35 + ufo_mcp:
36 + enabled: true
37 + mcp_server_info:
38 + name: 'io.github.your-org/your-app'
39 + title: 'Your App MCP Server'
40 + ```
41 +
42 + Without the file the bundle runs on defaults. All parameters are on the [Configuration](/docs/api/mcp-bundle/config) page.
43 +
44 + ## Step 4: Registering routes
45 +
46 + Copy `vendor/ufo-tech/mcp-bundle/install/routes/ufo_mcp.yaml` to `config/routes/`:
47 +
48 + ```yaml
49 + # config/routes/ufo_mcp.yaml
50 + ufo_mcp:
51 + resource: ../../vendor/ufo-tech/mcp-bundle/config/router.yaml
52 + prefix: /mcp
53 + defaults: { api_group: mcp }
54 + ```
55 +
56 + One import is one MCP endpoint serving one [API group](/docs/api/json-rpc-bundle/functionality/groups) (`api_group`). To add another endpoint, import the same `router.yaml` again with a different `prefix` and `api_group`; see [Routes](/docs/api/mcp-bundle/config).
57 +
58 + ## Step 5: Methods for MCP
59 +
60 + Add RPC methods to the endpoint's group with the `#[RPC\APIGroups]` attribute:
61 +
62 + ```php
63 + use Ufo\JsonRpcBundle\ApiMethod\Interfaces\IRpcService;
64 + use Ufo\McpBundle\Attribute\McpTool;
65 + use Ufo\RpcObject\RPC;
66 +
67 + #[RPC\Info('Catalog')]
68 + #[RPC\APIGroups(['mcp'], withDefault: false)] // only /mcp, not /rpc
69 + final class CatalogProcedure implements IRpcService
70 + {
71 + /** Search products by name. */
72 + #[McpTool(readOnlyHint: true)]
73 + public function search(string $query, int $limit = 10): array
74 + {
75 + // ...
76 + }
77 + }
78 + ```
79 +
80 + `withDefault: false` removes the methods from the default group (`/rpc`); without it the methods are available both on `/rpc` and on `/mcp`.
81 +
82 + :::info
83 + `#[McpTool]` is optional: it only adds hints for the agent. Every method of the group becomes a tool; see [Tools](/docs/api/mcp-bundle/tools).
84 + :::
85 +
86 + ## Verification
87 +
88 + | Request | What it returns |
89 + | --- | --- |
90 + | `POST /mcp` | The MCP endpoint (Streamable HTTP) |
91 + | `GET /mcp/manifest/claude.json` | A connection config for Claude Code (also `cursor`, `gemini`, `openai`) |
92 + | `GET /mcp/server.json` | The document for the MCP Registry |
93 +
94 + The Claude Code manifest:
95 +
96 + ::::columns
97 + :::col
98 + **Request**:
99 + ```bash
100 + curl https://example.com/mcp/manifest/claude.json
101 + ```
102 + :::
103 +
104 + :::col
105 + **Response**:
106 + ```json
107 + {
108 + "mcpServers": {
109 + "mcp": {
110 + "type": "http",
111 + "url": "https://example.com/mcp",
112 + "headers": {"Ufo-RPC-Token": "${UFO_MCP_TOKEN}"}
113 + }
114 + }
115 + }
116 + ```
117 + :::
118 + ::::
119 +
120 + If `protected_doc` is enabled in JsonRpcBundle, add the token header to the request. Save the response as the project's `.mcp.json` and set the `UFO_MCP_TOKEN` environment variable: Claude Code will see the group's tools.
121 +
122 + To list the tools without an AI client, use [MCP Inspector](https://github.com/modelcontextprotocol/inspector):
123 +
124 + ```bash
125 + npx -y @modelcontextprotocol/inspector --cli https://example.com/mcp \
126 + --transport http --header "Ufo-RPC-Token: change-me" --method tools/list
127 + ```
128 +
129 + ## What next?
130 +
131 + * [Configuration](/docs/api/mcp-bundle/config): several endpoints, versions, sessions.
132 + * [Tools](/docs/api/mcp-bundle/tools): how schemas, texts and results are built.
133 + * [HTTP and security](/docs/api/mcp-bundle/http_security): tokens, CORS, DNS rebinding.