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
|**Agents**|`/api/mcp/agents`| Discover and read data products (indexed views with comments). Designed for customer-facing AI agents. Available on the HTTP port (default `6876`). |
23
-
|**Observatory**|`/api/mcp/observatory`| Query `mz_*` system catalog tables for troubleshooting and observability. Available on the HTTP port (default `6876`). |
24
-
25
-
The endpoints use [JSON-RPC 2.0](https://www.jsonrpc.org/specification) over
26
-
HTTP POST and support the MCP `initialize`, `tools/list`, and `tools/call`
20
+
The endpoint uses [JSON-RPC 2.0](https://www.jsonrpc.org/specification) over
21
+
HTTP POST and supports the MCP `initialize`, `tools/list`, and `tools/call`
27
22
methods.
28
23
29
-
### Enabling / Disabling the MCP endpoints
24
+
### Enabling the endpoint
30
25
31
-
MCP endpoints can be toggled at runtime using system parameters:
26
+
The agents endpoint is disabled by default. Enable it at runtime using system
27
+
parameters:
32
28
33
29
| Parameter | Default | Description |
34
30
|-----------|---------|-------------|
35
31
|`enable_mcp_agents`|`false`| Enable or disable the `/api/mcp/agents` endpoint. |
36
-
|`enable_mcp_observatory`|`false`| Enable or disable the `/api/mcp/observatory` endpoint. |
37
32
|`enable_mcp_agents_query_tool`|`false`| Show or hide the `query` tool on the agents endpoint. |
38
33
|`mcp_max_response_size`|`1000000`| Maximum response size in bytes. Queries exceeding this limit return an error. |
39
34
40
35
```mzsql
41
-
-- Disable the agents endpoint
42
-
ALTER SYSTEM SET enable_mcp_agents = false;
43
-
44
-
-- Enable the query tool
45
-
ALTER SYSTEM SET enable_mcp_agents_query_tool = true;
36
+
ALTER SYSTEM SET enable_mcp_agents = true;
46
37
```
47
38
48
-
When an endpoint is disabled, requests return HTTP 503 (Service Unavailable).
39
+
When the endpoint is disabled, requests return HTTP 503 (Service Unavailable).
49
40
50
41
## Authentication and access control {#rbac}
51
42
52
-
Accessing the MCP endpoints requires [basic authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication#basic_authentication_scheme),
43
+
Accessing the MCP endpoint requires [basic authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication#basic_authentication_scheme),
53
44
just as connecting via a SQL client (e.g. `psql`). The authenticated role
54
45
determines which data products are visible based on RBAC privileges.
55
46
@@ -64,7 +55,7 @@ Use the credentials of a Materialize user or
64
55
***Password:** An [app password](/security/cloud/users-service-accounts/create-service-accounts/).
65
56
66
57
For production use, we recommend creating a dedicated service account and
67
-
granting it a role with limited privileges (see below).
58
+
granting it a role with limited privileges (see [Required privileges](#required-privileges)).
68
59
69
60
{{< /tab >}}
70
61
@@ -100,7 +91,7 @@ workloads. This ensures agent queries do not consume resources from your other
100
91
clusters, and limits visibility to only the data products you choose to expose.
101
92
102
93
```mzsql
103
-
CREATE CLUSTER mcp_cluster SIZE 'xsmall';
94
+
CREATE CLUSTER mcp_cluster SIZE '25cc';
104
95
CREATE SCHEMA mcp_schema;
105
96
```
106
97
@@ -177,8 +168,11 @@ GRANT mcp_agent TO '<service-account-name>';
177
168
178
169
{{< tab "Self-Managed" >}}
179
170
171
+
Create a functional role for privileges, then assign it to a login role:
172
+
180
173
```mzsql
181
-
CREATE ROLE mcp_agent LOGIN PASSWORD 'secret';
174
+
-- Functional role (cannot log in, holds privileges)
175
+
CREATE ROLE mcp_agent;
182
176
183
177
GRANT USAGE ON DATABASE materialize TO mcp_agent;
184
178
GRANT USAGE ON SCHEMA mcp_schema TO mcp_agent;
@@ -190,21 +184,23 @@ GRANT USAGE ON CLUSTER mcp_cluster TO mcp_agent;
190
184
-- and only see objects in mcp_schema by default.
191
185
ALTER ROLE mcp_agent SET cluster TO mcp_cluster;
192
186
ALTER ROLE mcp_agent SET search_path TO mcp_schema;
187
+
188
+
-- Login role (used for authentication)
189
+
CREATE ROLE my_agent LOGIN PASSWORD 'secret';
190
+
GRANT mcp_agent TO my_agent;
193
191
```
194
192
193
+
You can create additional login roles and grant them the same `mcp_agent` role
194
+
as needed.
195
+
195
196
{{< /tab >}}
196
197
197
198
{{< /tabs >}}
198
199
199
200
If any privilege is missing, the data product will not appear in the agent's
200
201
tool list.
201
202
202
-
## Agents endpoint
203
-
204
-
**`POST /api/mcp/agents`**
205
-
206
-
The agents endpoint exposes your data products as MCP tools. It provides the
207
-
following tools:
203
+
## Tools
208
204
209
205
### `get_data_products`
210
206
@@ -318,39 +314,6 @@ Execute a SQL `SELECT` statement against your data products.
318
314
}
319
315
```
320
316
321
-
## Observatory endpoint
322
-
323
-
**`POST /api/mcp/observatory`**
324
-
325
-
The observatory endpoint gives agents read-only access to the Materialize
326
-
system catalog for troubleshooting and observability.
327
-
328
-
### `query_system_catalog`
329
-
330
-
Execute a SQL query restricted to `mz_*` system tables.
331
-
332
-
| Parameter | Type | Required | Description |
333
-
|-----------|------|----------|-------------|
334
-
|`sql_query`| string | Yes |`SELECT` query using only `mz_*` system tables. |
0 commit comments