Skip to main content

MCP Server

CRAFT handles the “what” — governed, accurate data retrieval from your enterprise systems — so your AI tools and agents can focus on the “why”: validating hypotheses, identifying root causes, running what-if scenarios, and surfacing anomalies. Use resolve_term so your agent knows what “active customer” means in your warehouse before generating SQL; use execute_query to validate results; use generate_plotly_chart to surface patterns instantly. Connect Claude Code, Cursor, Goose, or a purpose-built agent to https://craft.emergence.ai/mcp and CRAFT becomes a governed data layer for any reasoning workflow. Two connection patterns: (a) interactive — IDE clients query CRAFT while you code; (b) programmatic — embed CRAFT as a tool server in an agent pipeline for hypothesis testing, root cause analysis, anomaly detection, or what-if modeling.

Server details

Verify the endpoint (no auth needed)

Before setting up OAuth, confirm the server is reachable with the no-auth hello_world tool:
Expected response:
If this succeeds, network connectivity and DNS are confirmed. If you prefer a CLI tool:

Authentication

Interactive clients (OAuth)

Supported IDE clients use the MCP OAuth 2.0 PKCE authorization flow. On first connection, the client opens a browser window to craft.emergence.ai, where you sign in with your Google or Microsoft account. The access token is stored and refreshed by the client automatically — no manual token handling required.

X-Project-ID header

All tools except hello_world require an X-Project-ID header scoping the request to your CRAFT project. Find your project ID in the CRAFT console under Settings → Project → ID. X-Project-ID selects a project scope but does not grant access — project membership is enforced server-side against your JWT’s claims. Passing an arbitrary project ID returns an authorization error if you are not a member.

Token requirements for headless callers

Programmatic callers (agents, pipelines) must obtain an access token before calling tools: For service accounts and CI pipelines, see Service Accounts and Authentication.

Connect your AI client

Add the CRAFT MCP server from the CLI:
Or add it to .mcp.json in your project root (or ~/.claude.json for user-scope):
The OAuth browser flow triggers automatically on first tool call. Token refresh is handled by Claude Code.
Find your project ID in the CRAFT console under Settings → Project → ID.
Add to .cursor/mcp.json in your project (or ~/.cursor/mcp.json globally):
Set CRAFT_PROJECT_ID as a shell environment variable — Cursor expands ${env:VAR} at runtime. The OAuth browser window opens on first use.
Create .vscode/mcp.json in your project:
VS Code prompts for the project ID once and stores it securely. OAuth handles the access token automatically.
If tool calls fail silently, headers may not be forwarded — a known issue in some VS Code versions (#264095). Workaround: replace the type/url block with mcp-remote:
Note: mcp-remote handles the OAuth flow locally rather than delegating it to the server.
Add to ~/.config/goose/config.yaml:
Set CRAFT_PROJECT_ID in your environment. Alternatively, run goose configure, select Remote Extension (Streamable HTTP), and the interactive wizard will prompt you for the URL and any custom headers. OAuth triggers on first connection.

Interactive charts — MCP Apps extension

generate_plotly_chart returns both a raw plotly_json response (all clients) and an embedded interactive UI resource for clients that support the MCP Apps protocol. The embedded resource is a sandboxed iframe containing the full Plotly chart with a modebar — including an SVG download button — rendered inline alongside the chat without switching tabs. The interactive iframe is enabled by default (MCP_APPS_ENABLED=true). No client-side configuration is required; supported clients detect and render it automatically. Clients that support MCP Apps interactive chart rendering (verified 2026-05-28):
Claude Code and other non-Apps clients receive the raw plotly_json response. Render it locally with plotly.io.show(fig) in Python or Plotly.newPlot(...) in JavaScript. To disable the embedded resource globally, set MCP_APPS_ENABLED=false on the Talk2Data service.

Developer tools

Use these tools to test and debug CRAFT’s MCP server during development, especially the MCP Apps / Plotly rendering path.
MCPJam is a dedicated MCP inspector — web app (no install), desktop app, or CLI. It supports the MCP Apps extension and renders interactive Plotly charts inline.Web app or desktop: Add a server with URL https://craft.emergence.ai/mcp, enable OAuth, and set X-Project-ID in the headers field:
CLI: Run a health check and OAuth flow validation:
MCPJam provides full JSON-RPC trace visibility and guided OAuth conformance checks (DCR, PKCE, CIMD) — useful for validating the MCP server before shipping tool changes.
Postman can act as an MCP host (client), connecting to external MCP servers — distinct from Postman’s own MCP server for managing Postman resources.Go to Settings → MCP Hosts → Add and configure:
  • URL: https://craft.emergence.ai/mcp
  • Auth: OAuth (recommended) or access token
  • Headers: X-Project-ID: <your-project-id>
Postman supports the MCP Apps extension — Plotly charts appear inline in the Postman canvas. Once you have a working configuration, use Postman’s Export MCP config button to generate a ready-to-paste config for Claude Code, Cursor, or VS Code.

Calling CRAFT from an external agent

Any MCP-compatible agent framework can use CRAFT as a tool server, bringing governed data access to any reasoning pipeline.
Requires pydantic-ai-slim[fastmcp] and fastmcp:
MCPServerHTTP is deprecated — use FastMCPToolset with StreamableHttpTransport.
Headless callers need a programmatic access token. Obtain one via a Keycloak service account (client credentials grant). See Service Accounts for setup.

Available tools

Catalog tools

Always available — provide governed access to your project’s data catalog.

Talk2Data tools

Available when the deployment includes the Data Insights solution. See Data Connections to connect your data sources.
execute_query only accepts SELECT statements — DDL, DML, and admin functions are rejected. generate_sql delegates to the Text2SQL A2A agent; the first call in a session may take 3–8 s (cold start), subsequent calls ~1–2 s. generate_plotly_chart emits per-stage MCP progress notifications (parse → validate → render → verify) forwarded as A2A status events — visible in clients that display progress.

Per-project allowlist and governance

CRAFT enforces a per-project tool allowlist — each project defines which tools each agent identity may call. This is the key difference between the CRAFT MCP gateway and a raw FastMCP server. Configure allowlists in Platform → Authorization (RBAC model) and Platform → Agents (agent identity → allowlist mapping). Denied calls return a structured error:
Every tool call — allowed or denied — writes an audit event to the governance event log. Each event records:
  • Timestamp, agent identity, tool name, project ID
  • Input parameters (PII-scrubbed per governance policy)
  • Result status (allowed / denied / error)
Query audit events via Audit Log. Tool calls are tracked separately from LLM completions and do not flow through the LiteLLM gateway. See LLM Gateway for the complementary table.

Errors and limits

Limits:
  • execute_query: server-enforced cap of 500 rows; truncated: true in response when exceeded
  • sample_data: up to 100 rows (limit parameter; default 10)
  • generate_sql: first call may take 3–8 s (Text2SQL agent cold-start); subsequent calls ~1–2 s

Next steps

LLM Gateway

The complementary gateway for LLM completions — model allowlist, rate limits, and cost attribution.

Data Connections

Connect your data sources to enable Talk2Data tools.

Release Notes

Track new tools, breaking changes, and platform updates.