Expose a Materialized View over MCP
Beta Notice: MCP support in DeltaStream is currently in beta. Functionality may evolve as we continue to refine the integration.
The Model Context Protocol (MCP) is an open standard that lets AI agents securely connect to external data sources, tools, and APIs at runtime. It defines a simple set of endpoints for discovering, describing, and invoking capabilities exposed by an MCP server—enabling agents to safely access and use organizational data and systems without custom integrations. For more details, see the MCP specification.
Overview
DeltaStream offers native MCP support, allowing any materialized view to be easily exposed through its MCP endpoint. This enables AI agents to query and interact with live, materialized data using standardized MCP interfaces. Access is governed by DeltaStream’s role-based access control (RBAC) system, ensuring secure and fine-grained authorization for all requests.
Configuration
There is no configuration to enable MCP support within DeltaStream. It is a REST endpoint where access is governed by RBAC.
To grant an agent access:
Optional - Create a Role that has limited permissions - Create a role that only has access to materialized views to be exposed over the MCP endpoint.
Materialized view exposure — Any materialized view that the token's role has
SELECT
privilege on will be exposed over the MCP endpoint as a tool the agent can discover and use.Create an API token — Create an
API_TOKEN
for a role via the DeltaStream console or Admin API, and assign the intended role to that token.Provide the token to the agent — Configure the agent to call DeltaStream's MCP endpoint and include the token in the
Authorization: Bearer <API_TOKEN>
header.
Security recommendations:
Grant least privilege (only
SELECT
on required views).Rotate tokens regularly.
With a properly scoped API token, agents can immediately discover and interact with permitted materialized views using standard MCP endpoints.
Example Setup
Create a materialized view — Follow the guide in the DeltaStream documentation to create the materialized view you want to expose.
Create a role for the AI agent — Switch to the Org Admin role, create a new role and grant permissions. In this example, we'll call it
ai_agent
and the view will be calledmyview
in the databasemydb
and the schemapublic
.USE ROLE orgadmin; CREATE ROLE ai_agent; GRANT USAGE ON DATABASE mydb TO ROLE ai_agent; GRANT USAGE ON SCHEMA public TO ROLE ai_agent; GRANT SELECT ON mydb.public.myview TO ROLE ai_agent;
Create an API token — Generate a new API token and set
token.role_name
to the role you created above (ai_agent
).CREATE API_TOKEN myagent_token WITH ('token.role_name' = ai_agent);
Test the MCP endpoint — Verify access and discover exposed tools using
curl
. Refer to the DeltaStream REST API documentation to determine your API endpoint:curl -X POST https://<MY_API_ENDPOINT_HOSTNAME>/mcp/v1 \ -H "Content-Type: application/json" \ -H "Accept: application/json,text/event-stream" \ -H "Authorization: Bearer <MY_API_TOKEN>" \ -d '{ "jsonrpc": "2.0", "id": 2, "method": "tools/list", "params": {} }'
This command will list all materialized views granted to the role associated with your API token, confirming that the agent can successfully interact with DeltaStream via MCP.
Limitations
DeltaStream MCP does not support resources, prompts, roots, notifications, version negotiations, life cycle phases, or sampling, which are part of the broader MCP protocol.
Last updated