Skip to main content
Enable the Lightdash MCP server on your self-hosted instance and make its endpoint reachable by your AI clients. This page covers deployment configuration and network access; use the feature documentation for client setup, authentication, tools, and permissions.

Prerequisites

  • Enterprise license — LIGHTDASH_LICENSE_KEY must be set on your instance.
  • HTTPS — MCP clients connect over HTTPS. See secure Lightdash with HTTPS if your instance is HTTP-only.

Enable MCP

Set the following environment variable on your Lightdash backend, then restart it:
Lightdash includes the OAuth server; you don’t need a separate OAuth service. Organization administrators can still turn MCP access off, even when MCP_ENABLED=true.

Optional configuration

run_metric_query has no separate MCP variable — its row cap is AI_COPILOT_MAX_QUERY_LIMIT (default 5000), the same instance-wide setting that limits AI agent queries (see AI agent environment variables). It isn’t configurable per organization, and a requested limit above the cap is clamped without the response saying so. The query tool doesn’t read that variable. Each query node returns up to 500 rows by default and at most 5,000. To reduce the filter-related query schema sent to the model, enable compact filter expressions. That section covers deployment and client-refresh requirements.

MCP URL format

Once enabled, the MCP endpoint is available at:
Replace <your-lightdash-host> with your instance’s domain (e.g. lightdash.yourcompany.com).

Connect an AI assistant

Follow Connect a client to generate configuration using your instance’s URL. For headless integrations, see custom integrations.

Network requirements

If your Lightdash instance sits behind a firewall or VPN, ensure the MCP client can reach it over HTTPS. See the MCP network requirements for additional domains that may need allow-listing depending on the AI assistant. The client needs /api/v1/mcp, the OAuth endpoints under /api/v1/oauth/, and the /.well-known/oauth-* discovery paths. Some clients connect from their vendor’s cloud rather than from the user’s machine, so an instance that’s only reachable on your internal network works from one client and fails from another. For those clients, allow the vendor’s published outbound IP ranges to reach these paths. Allow more than GET: Claude’s cloud calls POST /api/v1/oauth/token and POST /api/v1/oauth/register, and it needs POST and GET (it opens an SSE stream) on /api/v1/mcp itself. A GET-only or exact-path allowlist rule lets OAuth discovery pass but leaves the connection stuck after you click Continue connecting in Claude. To check that the endpoint is reachable from a given network, run:
A reachable instance returns 401 Unauthorized with a WWW-Authenticate header pointing at your SITE_URL. If that URL isn’t the public HTTPS address of your instance, OAuth discovery fails. Also check discovery directly:
Its issuer and token_endpoint should both be your instance’s public HTTPS address (SITE_URL), not an internal hostname.

Outbound egress for OAuth client ID metadata documents

Lightdash 2.580.0 and later accepts OAuth client ID metadata documents as a way for MCP clients to identify themselves, instead of registering a client first. Claude uses this: it presents an https URL as its client_id, for example https://claude.ai/oauth/mcp-oauth-client-metadata. When a user opens the authorization page for that client, the Lightdash backend fetches the document at that URL itself, over HTTPS, with no redirects and a 5-second timeout — so your backend pods need direct outbound HTTPS access to claude.ai, not routed through a proxy that blocks it. If that fetch fails, the authorization page returns 400 Invalid client_id or redirect_uri instead of the consent page.
Versions 2.580.0–2.589.3 reject client ID metadata documents that advertise extra grant types, which Claude’s document does — you need 2.589.4 or later.

Connect through a gateway on another hostname

Some MCP clients reach Lightdash through a gateway on a different hostname from SITE_URL. These clients send the gateway URL as the OAuth resource parameter. With agent identity on for the instance or organization, Lightdash accepts only its own URLs as resource: SITE_URL, SITE_URL/api/v1/mcp and the project MCP URLs. Lightdash rejects the gateway URL with invalid_target, and sign-in fails. With agent identity off, Lightdash ignores resource, and you don’t need this setting. To accept the gateway URLs, list them in AUTH_OAUTH_SERVER_MCP_RESOURCE_ALIASES, separated by commas. Then restart the backend:
Add the exact value that each client sends as resource. Most clients send the MCP server URL from their configuration. Lightdash ignores one trailing slash and compares the rest of the text exactly. An entry doesn’t cover its sub-paths. For example, if a client sends https://mcp-gateway.example.com/lightdash/projects/<uuid>, add that full URL. MCP clients that parse the URL, such as the official TypeScript SDK, send it in normalized form. An entry in any other form never matches a request, so Lightdash doesn’t start with one. Each entry must:
  • Start with https:// and have a host.
  • Use a lowercase hostname.
  • Leave out the default port, :443.
  • Percent-encode the path and contain no . or .. segments.
  • Have no query string, fragment, username, password, spaces or backslashes.
  • End with at most one trailing slash.
  • Not be one of Lightdash’s own URLs: SITE_URL, SITE_URL/api/v1/mcp or a project MCP URL. Lightdash already accepts those.
If an entry is invalid, Lightdash doesn’t start. The startup error names the variable, the position of the entry in the list, such as Entry 2, and the reason. The error doesn’t print the entry. The setting changes only which resource values Lightdash accepts. Lightdash still issues tokens for its own MCP endpoint. It still rejects any resource that isn’t in the list with invalid_target. Every other OAuth check stays the same. The OAuth discovery documents, such as /.well-known/oauth-protected-resource, still name SITE_URL. Some MCP clients compare that value with the URL they connect to. The official TypeScript SDK does, and it refuses to sign in when the two differ. If your gateway presents its own hostname to clients, it must serve or rewrite these documents with its own URL.

Troubleshooting