tableau-mcp
CLAUDE.md347 starsChanged 6 months agoApache-2.0View on GitHub
Build variants use esbuild with conditional code via globalIdentifiers to customize the final bundle. Key tools include: - queryDatasource: Query Tableau datasources - contentExploration: Search workbooks, views, datasources - getDatasourceMetadata: Retri
- Reads credentials
In this repository6 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .cursor/rules/auth.mdcCursor rule
- .cursor/rules/tableau-mcp.mdcCursor rule
- .cursor/rules/testing.mdcCursor rule
- .cursor/rules/tools.mdcCursor rule
- create-pr-from-commitsSkill
The file
We split this CLAUDE.md into the rules it gives an agent
10 rules. About 0 are common, 2 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 225
Test full MCP flows
- Very specific: line 238
Create tool.ts extending WebTool:
- Very specific: line 247
Add to src/tools/web/tools.ts factories
- Very specific: line 248
Add tool name to src/tools/web/toolName.ts
- Very specific: line 249
Write tests in tool.test.ts
- Very specific: line 252
Add to Config class in src/config.ts
- Very specific: line 253
Add to BaseConfig in src/config.shared.ts if shared across variants
- Very specific: line 255
Add to src/overridableConfig.ts if should be overridable per-site
- Distinctive: line 271
Keep code comments concise: explain the non-obvious WHY only.
- Very specific: line 277
Default bump is patch. To request minor/major instead, check the corresponding box under "Version Bump" in the PR description (see …
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Build & Development Commands
Building
npm run build # Production build (minified, bundled)
npm run build:dev # Development build (external packages, debug logging)
npm run build:desktop # Desktop variant build
npm run build:combined # Combined variant build
npm run build:docker # Build Docker imageRunning the Server
npm run start:http # Start HTTP server (default port 3927)
npm run start:http:apm # Start with APM telemetry tracing enabled
npm run start:http:docker # Run via Docker containerTesting
npm test # Unit tests (src/**/*.test.ts)
npm run test:e2e # End-to-end tests
npm run test:eval # Evaluation tests
npm run test:oauth:embedded # OAuth embedded tests
npm run test:oauth:tableau # OAuth Tableau tests (Playwright)
npm run coverage # Unit test coverage reportLinting & Formatting
npm run lint # Run ESLint
npm run lint:fix # Auto-fix ESLint issuesMCP Inspector
npm run inspect # Build + inspect with MCP Inspector (stdio)
npm run inspect:http # Run HTTP server + inspector
npm run inspect:docker # Build Docker + inspectRunning Individual Tests
npx vitest run src/path/to/file.test.ts # Run specific unit test
npx vitest run src/path/to/file.test.ts -t "pattern" # Run tests matching pattern
npx playwright test tests/oauth/tableau-authz # Run specific Playwright testArchitecture
Build Variants
The project supports multiple build variants via src/scripts/build.ts:
- default: Standard HTTP/stdio server
- desktop: Desktop-specific variant with ext-apps integration
- combined: Both web and desktop tools
Build variants use esbuild with conditional code via globalIdentifiers to customize the final bundle.
Transport Modes
Two MCP transport modes defined in src/transports.ts:
- stdio: Standard input/output (for Claude Desktop, npx usage)
- http: HTTP server with Express (for multi-user deployments)
Authentication Types
Configured via AUTH env var (see src/config.ts):
- pat: Personal Access Token (PAT_NAME + PAT_VALUE)
- uat: User Access Token with JWT
- direct-trust: Connected App direct trust (CONNECTED_APP_* vars)
- oauth: OAuth 2.0 flow (embedded or Tableau authz server)
Core Server Architecture
Entry Point (src/index.ts)
- Loads dotenv configuration
- Initializes Tableau server info (via
getTableauServerInfo) - Creates either stdio or HTTP transport based on
TRANSPORTenv var - Sets up notification level and file logging if configured
Web Server (src/server.web.ts + src/server/express.ts)
WebMcpServerextends baseServerclass- Registers web tools from
src/tools/web/tools.ts - Express server handles:
- OAuth middleware (embedded or Tableau provider)
- Passthrough auth middleware (
X-Tableau-Authheader) - Session management (unless
DISABLE_SESSION_MANAGEMENT=true) - CORS configuration
- Latency metrics
- MCP StreamableHTTPServerTransport
Desktop Server (src/server.desktop.ts)
- Desktop variant uses
@modelcontextprotocol/ext-appsfor discovery - Integrates with
DesktopDiscovererto find local Tableau Desktop instances - Tools are proxied to desktop via
DesktopToolExecutor
Tool Architecture
Web Tools (src/tools/web/)
Each tool is a subdirectory containing:
tool.ts: Tool definition extendingWebToolclass*.test.ts: Unit tests- Tool implements
paramsSchema(Zod) andcallbackfunction
Key tools include:
queryDatasource: Query Tableau datasourcescontentExploration: Search workbooks, views, datasourcesgetDatasourceMetadata: Retrieve datasource schema/fieldspulse: Pulse-related operationsprojects: Project managementadminInsights: Admin insights queries
Desktop Tools (src/tools/desktop/)
Desktop-specific tools that interact with local Tableau Desktop instances.
Tool Context (src/tools/web/toolContext.ts)
TableauWebRequestHandlerExtra provides:
- Config with request overrides
- Tableau auth info (userId, siteId, scopes)
- Server reference
- User/site LUID accessors
SDK Layer (src/sdks/tableau/)
Wraps Tableau REST API:
restApi.ts: Main API client using Zodiosapis/: REST API endpoint definitionsmethods/: Higher-level method wrapperstypes/: TypeScript types for API responses
Configuration (src/config.ts)
Config class extends BaseConfig with environment variables:
- Server connection (SERVER, SITE_NAME)
- Auth credentials (PAT_, UAT_, CONNECTED_APP_*)
- OAuth settings (OAUTH_*)
- Feature flags (ENABLE_MCP_SITE_SETTINGS, ENABLE_PASSTHROUGH_AUTH)
- Telemetry (TELEMETRY_PROVIDER, PRODUCT_TELEMETRY_ENDPOINT)
Feature Gates (src/features/)
Provider-based feature flag system (mirrors telemetry provider pattern):
- Server provider (default): Loads
features.jsonfrom filesystem (on-prem) - Custom provider: Loads user-specified provider from module path (for cloud/external services)
Files:
types.ts:FeatureGateProviderinterface, config schemas, type guardserverFeatureGate.ts: File-based provider (loadsfeatures.json)init.ts: Provider factory + custom loader + singleton + public API (initializeFeatureGate(),getFeatureGate(),resetFeatureGate(), re-exportsFeatureGateProvidertype)init.test.ts: All feature gate tests (includes provider tests + type guard tests)
Usage (import from init.ts):
import { getFeatureGate } from './features/init.js';
getFeatureGate().isFeatureEnabled('mcp-apps')Configuration (same pattern as TELEMETRY_PROVIDER):
# Default: server provider
FEATURE_GATE_PROVIDER=server
# Custom provider (e.g., for cloud service)
FEATURE_GATE_PROVIDER=custom
FEATURE_GATE_PROVIDER_CONFIG='{"module":"./my-feature-gate.js"}'Overridable Config (src/overridableConfig.ts)
MCP site settings allow per-site configuration stored in Tableau.
Request-level overrides via X-Tableau-MCP-Config header.
Sessions (src/sessions.ts)
HTTP mode supports session management:
- Session ID in
mcp-session-idheader - Stores MCP server instance per session
- Can be disabled with
DISABLE_SESSION_MANAGEMENT=true
Logging (src/logging/)
logger.ts: Core logging with masking (PATs, tokens)fileLogger.ts: Optional file-based loggingnotification.ts: MCP notification system (debug/info/warning/error)- Log masking can be disabled with
DISABLE_LOG_MASKING=true
Telemetry (src/telemetry/)
- APM/tracing via
tracing.ts(loaded with-rflag) - Product telemetry via
productTelemetry/ - Supports DataDog, Grafana, OpenTelemetry
- Configured via
TELEMETRY_PROVIDERenv var
OAuth (src/server/oauth/)
Two OAuth modes:
- Embedded: MCP server is its own authz server
- Tableau: Delegates to Tableau's OAuth provider
Flow:
/authorize→ Authorization request/token→ Token exchange/revoke→ Token revocation- Middleware validates access tokens and populates
authInfo
Environment Variables
Key variables (see env.example.list and .env):
SERVER: Tableau server URLSITE_NAME: Tableau site nameAUTH: Authentication type (pat/uat/direct-trust/oauth)TRANSPORT: Transport mode (stdio/http)PAT_NAME/PAT_VALUE: PAT credentialsHTTP_PORT_ENV_VAR_NAME: Port env var name (default: PORT)DANGEROUSLY_DISABLE_OAUTH: Disable OAuth for HTTP (testing only)DISABLE_SESSION_MANAGEMENT: Stateless HTTP modeENABLE_PASSTHROUGH_AUTH: Allow X-Tableau-Auth headerENABLE_MCP_SITE_SETTINGS: Enable per-site configurationBREAK_GLASS_DISABLE_GLOBALLY: Emergency kill switchCSP_ALLOWED_DOMAINS: Comma-separated list of domains for Content-Security-Policy (default:https://*.online.tableau.com,https://*.tableau.com)
Testing Strategy
Unit Tests (vitest.config.ts)
- Located in
src/alongside source files - Coverage excludes: scripts, SDKs, server
- Run with
npm test
E2E Tests (vitest.config.e2e.ts)
- Located in
tests/e2e/ - Test full MCP flows
OAuth Tests
- Embedded:
vitest.config.oauth.embedded.ts - Tableau: Playwright tests in
tests/oauth/tableau-authz/
Test Setup (src/testSetup.ts)
Global test configuration and mocks.
Common Development Patterns
Adding a New Web Tool
- Create directory:
src/tools/web/myTool/ - Create
tool.tsextendingWebTool:export class MyTool extends WebTool<typeof paramsSchema> { name = 'my_tool' as const; description = 'Tool description'; paramsSchema = z.object({ ... }); callback = async (args, context) => { ... }; } - Add to
src/tools/web/tools.tsfactories - Add tool name to
src/tools/web/toolName.ts - Write tests in
tool.test.ts
Adding Configuration
- Add to
Configclass insrc/config.ts - Add to
BaseConfiginsrc/config.shared.tsif shared across variants - Document in
env.example.list - Add to
src/overridableConfig.tsif should be overridable per-site
Feature Flags
Edit features.json at project root:
{
"my-feature": true
}Check in code:
if (getFeatureGate().isFeatureEnabled('my-feature')) { ... }Code Style
- Keep code comments concise: explain the non-obvious WHY only. Never restate what the code already makes obvious.
Versioning & Releases
package.json's version is bumped automatically — do NOT manually edit the version field or run npm run version:* in a PR. .github/workflows/auto-version-bump.yml bumps it after merge to main, commits, and tags (vX.Y.Z).
- Default bump is patch. To request minor/major instead, check the corresponding box under "Version Bump" in the PR description (see
.github/pull_request_template.md) — the workflow reads the merged PR's checklist to decide the bump type. - Publishing to npm (
publish.yml) is a separate, manual step: promoting a tag to a GitHub Release triggers it. .github/workflows/*.ymlfiles may be blocked from being read/edited by endpoint security tooling in some sandboxes — if so, hand the diff to the user as text for them to apply.
NPM Package
Published as @tableau/mcp-server with:
- Binary:
tableau-mcp-server→build/index.js - Exports: main entry +
./tracingfor APM - Requires Node.js >= 22.7.5
Documentation
Docusaurus site in docs/ subdirectory:
npm run docs:start # Start dev serverOfficial docs: https://tableau.github.io/tableau-mcp/
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

