Tableau Model Context Protocol (MCP)

repository·main·Indexed 43 days ago

https://github.com/tableau/tableau-mcp

A suite of developer primitives and a server (@tableau/mcp-server v4.10.5) that enables AI applications to integrate with Tableau for natural language data querying and content exploration. Supports both a managed hosted service for Tableau Cloud via OAuth 2.1 and self-hosted enterprise deployments for Tableau Server using PAT, Connected Apps, UAT, or passthrough authentication.

Tokens
85.2K
Snippets
191
Records
352
Agent score
37%

What's inside Tableau MCP

  1. Overview of Tableau MCP

    main
    Tableau MCP is a suite of developer primitives designed to simplify the creation of AI applications that integrate with Tableau. It provides tools, resources, and prompts that allow AI clients to interact with Tableau data and content.
  2. Introduction to Tableau MCP

    main

    Tableau MCP is an open-source implementation of the Model Context Protocol designed to facilitate communication between AI agents and Tableau. It enables agents to see, understand, and interact with Tableau data, metadata, and artifacts.

    It is compatible with any Tableau edition (Cloud or Server), though access to specific tools may depend on your Tableau SKU.

    Tableau MCP is available in two primary forms:

    1. Hosted Tableau MCP: A managed service available on every Tableau Cloud pod at https://mcp.tableau.com.
    2. Self-Hosted / Local: Can be run locally using npx.
  3. Enterprise Deployment of Tableau MCP

    main

    Tableau MCP can be self-hosted on your own infrastructure as a lightweight Node.js web application. It is designed to serve multiple MCP clients simultaneously using the Streamable HTTP transport.

    Key features for enterprise environments include:

    • Security: When OAuth is enabled, users sign in via Tableau, ensuring access is governed by your existing security and identity policies.
    • Extensibility: The server uses a plugin model, allowing you to customize operations like telemetry and monitoring to match your internal environment.
    • Scalability: It functions like a standard internal web application, exposed at a URL you control.
  4. Understand Tableau MCP Authorization modes

    main

    Tableau MCP supports different authorization models depending on your deployment needs:

    1. Embedded Authorization Server (Default for OAuth)

    When OAuth is enabled, the MCP server runs its own embedded authorization server.

    • Purpose: It issues access and refresh tokens to MCP clients using the authentication mechanisms configured at your Tableau site level.
    • Security: User context is stored within the access token, ensuring privileges persist end-to-end.
    • Limitation: Refresh tokens are stored in-memory. If the Tableau MCP process restarts, all refresh tokens are lost, and users must re-authenticate.
    • Token Lifespan: Access tokens expire after 1 hour by default. You can extend this up to 30 days using the OAUTH_ACCESS_TOKEN_TIMEOUT_MS environment variable.

    2. Passthrough Authentication

    This mode is designed for enterprise gateway or proxy deployments (e.g., Kerberos, OIDC).

    • Mechanism: The proxy forwards a valid Tableau REST API token to the MCP server.
    • Usage: Authentication to the MCP server behaves like the Tableau REST APIs, using the X-Tableau-Auth header.
    • Configuration: Set ENABLE_PASSTHROUGH_AUTH=true to enable this mode.
  5. Understand Download Workbook response behavior

    main

    The download-workbook tool returns different response shapes depending on the server configuration and success of the upload:

    1. S3 file mode enabled: Returns a resource_link containing a short-lived presigned URL to the workbook file in S3.
    2. S3 file mode disabled or upload failure: The tool writes the workbook to a local temporary directory and returns a JSON object containing the local file path.

    Metadata

    The tool preserves Tableau response metadata where available:

    • mimeType: Typically application/xml for .twb or application/octet-stream for .twbx.
    • name (for S3 mode) or filename (for temp-file mode): Extracted from Tableau's Content-Disposition header, with a fallback name generated if unavailable.
  6. Implement Multi-Turn Conversations for Pulse Insights

    main

    To enable follow-up questions and maintain context, you must include the full conversation history in the messages array. If you only send the latest question, the AI will lack the context of previous answers.

    Required sequence for a follow-up:

    1. Add the initial user question with role: 'ROLE_USER'.
    2. Add the assistant's response with role: 'ROLE_ASSISTANT' and content containing the previous response text.
    3. Add the follow-up question with role: 'ROLE_USER'.

    Example: Follow-up Request

    {
      "language": "LANGUAGE_EN_US",
      "locale": "LOCALE_EN_US",
      "messages": [
        {
          "action_type": "ACTION_TYPE_SUMMARIZE",
          "content": "What are the key insights for Sales?",
          "role": "ROLE_USER",
          "metric_group_context": [ /* ... */ ],
          "metric_group_context_resolved": true
        },
        {
          "action_type": "ACTION_TYPE_SUMMARIZE",
          "content": "Sales increased 5% with growth in Region A and B...",
          "role": "ROLE_ASSISTANT",
          "metric_group_context": [ /* ... */ ],
          "metric_group_context_resolved": true
        },
        {
          "action_type": "ACTION_TYPE_ANSWER",
          "content": "What factors contributed to the increase?",
          "role": "ROLE_USER",
          "metric_group_context": [ /* ... */ ],
          "metric_group_context_resolved": true
        }
      ]
    }
  7. Design tool names and groups

    main

    When adding new capabilities to the Tableau MCP server, follow these naming and grouping conventions to ensure AI models can reason about your tools effectively.

    Naming Convention

    Use kebab-case following the pattern verb-noun or verb-noun-qualifier. Examples include:

    • list-{resources} (e.g., list-datasources)
    • get-{resource} (e.g., get-workbook)
    • get-{resource}-{detail} (e.g., get-datasource-metadata)
    • query-{resource} (e.g., query-datasource)
    • search-{scope} (e.g., search-content)
    • generate-{output} (e.g., generate-pulse-insight-brief)

    Tool Grouping

    Organize tools into groups representing feature areas:

    • datasource: Data Q&A (listing, inspecting, querying)
    • workbook: Workbook exploration
    • view: View data and image retrieval
    • pulse: Tableau Pulse metrics and insights
    • content-exploration: Cross-content search
  8. How the two-phase update flow works

    main

    The update-cloud-extract-refresh-task tool uses a two-phase mutation pattern to ensure safety:

    1. Preview Phase: Call the tool with confirm: false (or omit the confirm parameter). The tool returns the proposed schedule and a single-use confirmationToken. This token is cryptographically bound to the specific taskId and the specific schedule provided in the preview.
    2. Update Phase: Call the tool again with confirm: true and provide the confirmationToken received in step 1. The server verifies the token matches the requested change before applying the update.

    Note on MCP-Apps (Human-in-the-loop): If the mcp-apps feature flag is enabled, the preview phase renders a visual confirm panel in an iframe. In this mode, the model cannot apply the change; a human must click Apply schedule change in the UI, which triggers a separate, model-invisible tool (confirm-update-cloud-export-refresh-task) to complete the update.

  9. Define tool parameters using Zod

    main

    Parameters are defined using Zod schemas. Follow these principles to improve AI reliability:

    • Minimize required parameters: Fewer requirements lead to more reliable calls.
    • Use descriptive enum values: Use Zod enums so the AI sees specific allowed options.
    • Validate early: Encode constraints (like LUID formats) directly in the Zod schema.
    • Include sensible defaults: Avoid requiring parameters like pagination limits or sort orders unless necessary.
  10. Architecture of the Tableau MCP deployment

    main

    The Tableau MCP deployment follows this communication flow:

    1. MCP Client (e.g., Claude Desktop) communicates with the Tableau MCP Server via the Streamable HTTP Transport Layer.
    2. The Tableau MCP Server (hosted on your platform) communicates with Tableau Cloud via standard HTTP.
    3. The server interacts with Tableau Cloud services including the VizQL Data Service, Metadata API, and other REST APIs.
  11. Handling duplicate Admin Insights datasources

    main

    In some Tableau sites, duplicate Admin Insights projects or cloned content may exist, leading to multiple datasources with the same name. The tool automatically resolves these to the canonical, system-provisioned datasource using the following logic:

    1. Project Filtering: Narrows candidates to the top-level Admin Insights project.
    2. Ranking: Candidates are ranked based on:
      • Certification status.
      • A canonical contentUrl slug (clones typically have a _<epoch-ms> suffix).
      • A non-empty description.
      • Ownership by the Tableau System Account (used as a tie-breaker).
      • The oldest createdAt timestamp (final tie-breaker).
    3. Error Recovery: If the chosen candidate fails with a Hyper connection error at runtime, the tool negative-caches that LUID and retries the next-ranked candidate.

    Diagnostic Warnings

    If ambiguity is detected, the result will include a warning in mcp.warnings:

    • ADMIN_INSIGHTS_AMBIGUOUS_DATASOURCE: Multiple candidates were found.
    • ADMIN_INSIGHTS_DATASOURCE_UNHEALTHY: A dead extract forced a fallback to a different candidate.

    Admins should use these warnings to identify and delete non-canonical copies.

  12. Override Tableau MCP configuration at different levels

    main

    Tableau MCP supports a hierarchical configuration model where more specific settings override more general ones. The precedence order (from lowest to highest priority) is:

    1. Environment Variables: The base configuration.
    2. Site Settings: Overrides specific variables on a per-site basis via the REST API. These apply to all users authenticated to that specific site.
    3. Request Overrides: The highest priority. These override settings on a per-request basis via an HTTP header. Note that Request Overrides are only available when using the HTTP transport.