{"title":"Model Context Protocol (MCP)","description":"Connect MCP-compatible AI clients to Altertable so agents can query lakehouse data through governed, scoped tools.","order":700,"askSuggestions":["Which access scope should I grant my MCP client?","Why does a pinned MCP endpoint return 403?","How do I switch MCP to another environment?"],"navigation":true,"routeId":"queryDataMcp","body":{"code":"var Component=(()=>{var b=Object.create;var d=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,y=Object.prototype.hasOwnProperty;var P=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports),x=(n,t)=>{for(var r in t)d(n,r,{get:t[r],enumerable:!0})},p=(n,t,r,i)=>{if(t&&typeof t==\"object\"||typeof t==\"function\")for(let s of A(t))!y.call(n,s)&&s!==r&&d(n,s,{get:()=>t[s],enumerable:!(i=w(t,s))||i.enumerable});return n};var C=(n,t,r)=>(r=n!=null?b(f(n)):{},p(t||!n||!n.__esModule?d(r,\"default\",{value:n,enumerable:!0}):r,n)),M=n=>p(d({},\"__esModule\",{value:!0}),n);var m=P((z,u)=>{u.exports=_jsx_runtime});var I={};x(I,{default:()=>g,frontmatter:()=>T});var e=C(m()),T={title:\"Model Context Protocol (MCP)\",routeId:\"queryDataMcp\",description:\"Connect MCP-compatible AI clients to Altertable so agents can query lakehouse data through governed, scoped tools.\",order:700,askSuggestions:[\"Which access scope should I grant my MCP client?\",\"Why does a pinned MCP endpoint return 403?\",\"How do I switch MCP to another environment?\"]};function v(n){let t={a:\"a\",code:\"code\",h1:\"h1\",h2:\"h2\",h3:\"h3\",h4:\"h4\",li:\"li\",ol:\"ol\",p:\"p\",pre:\"pre\",strong:\"strong\",ul:\"ul\",...n.components},{DocsAppAction:r,DocsMcpAccess:i,DocsPreviewDocument:s,DocsPreviewSection:o,DocsPrompt:h,DocsTable:l,DocsUrl:a}=t;return r||c(\"DocsAppAction\",!0),i||c(\"DocsMcpAccess\",!0),s||c(\"DocsPreviewDocument\",!0),o||c(\"DocsPreviewSection\",!0),h||c(\"DocsPrompt\",!0),l||c(\"DocsTable\",!0),a||c(\"DocsUrl\",!0),(0,e.jsxs)(s,{anchors:\"model-context-protocol-mcp goal prerequisites steps 1-add-the-server pin-a-scope 2-let-the-client-discover-oauth-settings 3-review-tool-permissions verification connect-other-mcp-servers-to-altertable troubleshooting next-steps\",children:[(0,e.jsxs)(o,{sectionId:\"model-context-protocol-mcp\",sectionTitle:\"Model Context Protocol (MCP)\",anchors:\"\",ancestors:\"\",index:\"0\",children:[(0,e.jsx)(t.h1,{id:\"model-context-protocol-mcp\",children:\"Model Context Protocol (MCP)\"}),`\n`,(0,e.jsx)(t.p,{children:\"Altertable's MCP server gives AI clients a governed way to interact with your lakehouse.\"}),`\n`]}),(0,e.jsxs)(o,{sectionId:\"goal\",sectionTitle:\"Goal\",anchors:\"\",ancestors:\"\",index:\"1\",children:[(0,e.jsx)(t.h2,{id:\"goal\",children:\"Goal\"}),`\n`,(0,e.jsx)(t.p,{children:\"Connect an MCP-compatible AI client to Altertable, authorize one environment, and verify that the client can discover Altertable tools and catalogs.\"}),`\n`]}),(0,e.jsxs)(o,{sectionId:\"prerequisites\",sectionTitle:\"Prerequisites\",anchors:\"\",ancestors:\"\",index:\"2\",children:[(0,e.jsx)(t.h2,{id:\"prerequisites\",children:\"Prerequisites\"}),`\n`,(0,e.jsxs)(t.ul,{children:[`\n`,(0,e.jsxs)(t.li,{children:[\"An Altertable account with \",(0,e.jsx)(t.a,{href:\"/docs/administration/access-control\",children:\"access to the organization and environment\"}),\" you want to query.\"]}),`\n`,(0,e.jsx)(t.li,{children:\"An AI client that supports hosted MCP servers over streamable HTTP and OAuth 2.0.\"}),`\n`]}),`\n`,(0,e.jsxs)(t.p,{children:[\"Clients that only support local \",(0,e.jsx)(t.code,{children:\"stdio\"}),\" servers cannot connect to Altertable's hosted MCP server.\"]}),`\n`]}),(0,e.jsxs)(o,{sectionId:\"steps\",sectionTitle:\"Steps\",anchors:\"\",ancestors:\"\",index:\"3\",children:[(0,e.jsx)(t.h2,{id:\"steps\",children:\"Steps\"}),`\n`]}),(0,e.jsxs)(o,{sectionId:\"1-add-the-server\",sectionTitle:\"1. Add the server\",anchors:\"\",ancestors:\"steps\",index:\"4\",children:[(0,e.jsx)(t.h3,{id:\"1-add-the-server\",children:\"1. Add the server\"}),`\n`,(0,e.jsx)(l,{columns:[\"Setting\",\"Value\"],data:[{Setting:\"Server URL\",Value:\"`https://mcp.altertable.ai/mcp`\"},{Setting:\"Transport\",Value:\"`Streamable HTTP`\"},{Setting:\"Authentication\",Value:\"`OAuth 2.0`\"}]}),`\n`,(0,e.jsxs)(t.ol,{children:[`\n`,(0,e.jsxs)(t.li,{children:[\"Add \",(0,e.jsx)(t.code,{children:\"https://mcp.altertable.ai/mcp\"}),\" as an MCP server in your client.\"]}),`\n`,(0,e.jsx)(t.li,{children:\"Start the connection or authorization flow.\"}),`\n`,(0,e.jsx)(t.li,{children:\"Log in to Altertable in the browser when prompted.\"}),`\n`,(0,e.jsx)(t.li,{children:\"Choose the organization and environment the client should access.\"}),`\n`,(0,e.jsx)(t.li,{children:\"Approve the connection and return to your client.\"}),`\n`]}),`\n`,(0,e.jsx)(t.p,{children:\"After approval, the client uses an OAuth bearer token for MCP tool discovery and execution. Access is scoped to the environment selected during authorization. You must belong to its organization and have permission to use that environment. Tools are filtered by the granted tier, resource permissions, enabled product features, and connected integrations. Reconnect and authorize again to change the environment or scope.\"}),`\n`,(0,e.jsxs)(t.p,{children:[\"Start with \",(0,e.jsx)(t.code,{children:\"https://mcp.altertable.ai/mcp\"}),\" and grant \",(0,e.jsx)(i,{tier:\"mcp:ro\"}),\" access for exploration. Choose \",(0,e.jsx)(i,{tier:\"mcp:analyst\"}),\" when you need to create analyses or data apps. Choose \",(0,e.jsx)(i,{tier:\"mcp:rw\"}),\" only when you need lakehouse writes or schema changes.\"]}),`\n`]}),(0,e.jsxs)(o,{sectionId:\"pin-a-scope\",sectionTitle:\"Pin a scope\",anchors:\"\",ancestors:\"steps 1-add-the-server\",index:\"5\",children:[(0,e.jsx)(t.h4,{id:\"pin-a-scope\",children:\"Pin a scope\"}),`\n`,(0,e.jsx)(t.p,{children:\"Choose the least access your workflow needs during authorization. The default endpoint accepts all three tiers. To request a specific access level up front, use a pinned endpoint:\"}),`\n`,(0,e.jsx)(l,{columns:[\"Access\",\"Endpoint\"],columnWidths:[\"9rem\",\"auto\"],data:[{Access:(0,e.jsx)(i,{tier:\"mcp:ro\"}),Endpoint:(0,e.jsx)(a,{url:\"https://mcp.altertable.ai/mcp/read-only\"})},{Access:(0,e.jsx)(i,{tier:\"mcp:analyst\"}),Endpoint:(0,e.jsx)(a,{url:\"https://mcp.altertable.ai/mcp/analyst\"})},{Access:(0,e.jsx)(i,{tier:\"mcp:rw\"}),Endpoint:(0,e.jsx)(a,{url:\"https://mcp.altertable.ai/mcp/read-write\"})}]}),`\n`,(0,e.jsxs)(t.p,{children:[\"The \",(0,e.jsx)(t.a,{href:\"/docs/api-references/glossary#mcp-access-names\",children:\"glossary\"}),\" maps each display label to its endpoint and OAuth scope.\"]}),`\n`,(0,e.jsxs)(t.p,{children:[\"A pinned endpoint requires its exact tier, even if your token grants broader access. A mismatch returns \",(0,e.jsx)(t.code,{children:\"403 insufficient_scope\"}),\". Use the default endpoint when the client should choose access during authorization.\"]}),`\n`,(0,e.jsx)(t.p,{children:\"For example, to add a read-only connection in Claude Code:\"}),`\n`,(0,e.jsx)(t.pre,{children:(0,e.jsx)(t.code,{className:\"language-bash\",children:`claude mcp add --transport http altertable-mcp https://mcp.altertable.ai/mcp/read-only\n`})}),`\n`]}),(0,e.jsxs)(o,{sectionId:\"2-let-the-client-discover-oauth-settings\",sectionTitle:\"2. Let the client discover OAuth settings\",anchors:\"\",ancestors:\"steps\",index:\"6\",children:[(0,e.jsx)(t.h3,{id:\"2-let-the-client-discover-oauth-settings\",children:\"2. Let the client discover OAuth settings\"}),`\n`,(0,e.jsxs)(t.p,{children:[\"Compatible clients should discover OAuth settings automatically and follow the metadata URL in the server\\u2019s \",(0,e.jsx)(t.code,{children:\"WWW-Authenticate\"}),\" challenge. Pinned endpoints provide path-specific metadata. Altertable supports protected resource metadata, authorization server discovery, and dynamic client registration.\"]}),`\n`,(0,e.jsx)(l,{columns:[\"Purpose\",\"URL\"],columnWidths:[\"35%\",\"65%\"],data:[{Purpose:\"MCP server endpoint\",URL:(0,e.jsx)(a,{url:\"https://mcp.altertable.ai/mcp\"})},{Purpose:\"Protected resource metadata\",URL:\"[https://mcp.altertable.ai/.well-known/oauth-protected-resource](https://mcp.altertable.ai/.well-known/oauth-protected-resource)\"},{Purpose:\"Authorization server metadata\",URL:\"[https://app.altertable.ai/.well-known/oauth-authorization-server](https://app.altertable.ai/.well-known/oauth-authorization-server)\"}]}),`\n`,(0,e.jsxs)(t.p,{children:[\"When a client calls an authenticated MCP method without a valid token, Altertable may return a \",(0,e.jsx)(t.code,{children:\"WWW-Authenticate: Bearer ...\"}),\" challenge that points the client to the protected resource metadata.\"]}),`\n`]}),(0,e.jsxs)(o,{sectionId:\"3-review-tool-permissions\",sectionTitle:\"3. Review tool permissions\",anchors:\"\",ancestors:\"steps\",index:\"7\",children:[(0,e.jsx)(t.h3,{id:\"3-review-tool-permissions\",children:\"3. Review tool permissions\"}),`\n`,(0,e.jsx)(t.p,{children:\"MCP tools can list catalogs and semantic metrics, query the lakehouse, validate SQL, and create outputs such as data apps, memories, notifications, and scheduled tasks when the granted tier and resource permissions allow it.\"}),`\n`,(0,e.jsxs)(t.p,{children:[\"For the exact tool schema, see \",(0,e.jsx)(t.a,{href:\"/docs/api-references/mcp-tools\",children:\"MCP tools\"}),\".\"]}),`\n`]}),(0,e.jsxs)(o,{sectionId:\"verification\",sectionTitle:\"Verification\",anchors:\"\",ancestors:\"\",index:\"8\",children:[(0,e.jsx)(t.h2,{id:\"verification\",children:\"Verification\"}),`\n`,(0,e.jsx)(t.p,{children:\"Ask the connected client:\"}),`\n`,(0,e.jsx)(h,{children:(0,e.jsx)(t.pre,{children:(0,e.jsx)(t.code,{className:\"language-text\",children:`Use Altertable to list my available catalogs.\n`})})}),`\n`,(0,e.jsx)(t.p,{children:\"The client should discover the Altertable tools, request authorization if needed, and return catalogs from the environment selected during authorization.\"}),`\n`]}),(0,e.jsxs)(o,{sectionId:\"connect-other-mcp-servers-to-altertable\",sectionTitle:\"Connect other MCP servers to Altertable\",anchors:\"\",ancestors:\"\",index:\"9\",children:[(0,e.jsx)(t.h2,{id:\"connect-other-mcp-servers-to-altertable\",children:\"Connect other MCP servers to Altertable\"}),`\n`,(0,e.jsxs)(t.p,{children:[\"To give Altertable agents access to another service, open \",(0,e.jsx)(t.strong,{children:\"MCP servers\"}),\" in settings and connect the supported server. Datadog and Datadog EU are available integrations. Review which environments have the connection enabled; a connection can be enabled or disabled per environment. Use the reauthentication action when its authorization needs renewal.\"]}),`\n`,(0,e.jsx)(t.p,{children:\"These connections supply tools to Altertable agents. To connect an external AI client to Altertable's data, use the endpoint and OAuth flow above.\"}),`\n`]}),(0,e.jsxs)(o,{sectionId:\"troubleshooting\",sectionTitle:\"Troubleshooting\",anchors:\"\",ancestors:\"\",index:\"10\",children:[(0,e.jsx)(t.h2,{id:\"troubleshooting\",children:\"Troubleshooting\"}),`\n`,(0,e.jsxs)(t.ul,{children:[`\n`,(0,e.jsxs)(t.li,{children:[(0,e.jsx)(t.strong,{children:\"Client cannot connect\"}),\": confirm it supports hosted MCP over streamable HTTP and OAuth.\"]}),`\n`,(0,e.jsxs)(t.li,{children:[(0,e.jsx)(t.strong,{children:\"Discovery does not start\"}),\": use exactly \",(0,e.jsx)(t.code,{children:\"https://mcp.altertable.ai/mcp\"}),\" (or \",(0,e.jsx)(t.code,{children:\"/mcp/read-only\"}),\", \",(0,e.jsx)(t.code,{children:\"/mcp/analyst\"}),\", or \",(0,e.jsx)(t.code,{children:\"/mcp/read-write\"}),\" if you pinned a scope).\"]}),`\n`,(0,e.jsxs)(t.li,{children:[(0,e.jsx)(t.strong,{children:\"Browser login loops\"}),\": finish authorization in the browser window opened by the client.\"]}),`\n`,(0,e.jsxs)(t.li,{children:[(0,e.jsx)(t.strong,{children:\"No tools appear\"}),\": reconnect so the client reruns discovery, authorization, and tool listing.\"]}),`\n`,(0,e.jsxs)(t.li,{children:[(0,e.jsx)(t.strong,{children:\"Wrong environment\"}),\": reconnect and choose the correct environment during authorization.\"]}),`\n`,(0,e.jsxs)(t.li,{children:[(0,e.jsx)(t.strong,{children:\"403 on a pinned endpoint\"}),\": the token's granted scope doesn't match the endpoint (e.g. a read-only token used against \",(0,e.jsx)(t.code,{children:\"/mcp/read-write\"}),\"). Reauthorize with the matching scope, or connect to the bare \",(0,e.jsx)(t.code,{children:\"https://mcp.altertable.ai/mcp\"}),\" endpoint instead.\"]}),`\n`]}),`\n`,(0,e.jsx)(r,{destination:\"mcpServer\"}),`\n`]}),(0,e.jsxs)(o,{sectionId:\"next-steps\",sectionTitle:\"Next steps\",anchors:\"\",ancestors:\"\",index:\"11\",children:[(0,e.jsx)(t.h2,{id:\"next-steps\",children:\"Next steps\"}),`\n`,(0,e.jsxs)(t.ul,{children:[`\n`,(0,e.jsxs)(t.li,{children:[(0,e.jsx)(t.a,{href:\"/docs/api-references/mcp-tools\",children:\"Review MCP tools\"}),\" to see the exact schemas and permissions.\"]}),`\n`,(0,e.jsxs)(t.li,{children:[(0,e.jsx)(t.a,{href:\"/docs/agents/setup\",children:\"Set up an AI client\"}),\" with client-specific instructions.\"]}),`\n`,(0,e.jsxs)(t.li,{children:[(0,e.jsx)(t.a,{href:\"/docs/lakehouse/clients/cli\",children:\"Install the Altertable CLI\"}),\" for terminal automation and structured agent output.\"]}),`\n`]})]})]})}function g(n={}){let{wrapper:t}=n.components||{};return t?(0,e.jsx)(t,{...n,children:(0,e.jsx)(v,{...n})}):v(n)}function c(n,t){throw new Error(\"Expected \"+(t?\"component\":\"object\")+\" `\"+n+\"` to be defined: you likely forgot to import, pass, or provide it.\")}return M(I);})();\n;return Component;"},"_id":"docs/agents/mcp.mdx","_raw":{"sourceFilePath":"docs/agents/mcp.mdx","sourceFileName":"mcp.mdx","sourceFileDir":"docs/agents","contentType":"mdx","flattenedPath":"docs/agents/mcp"},"type":"Docs","path":"/agents/mcp","level":2,"parent":"agents"}