MCP Connector

Securely Query Teradata with OAuth

MCP server for Teradata with OAuth 2.1, LDAP/Kerberos auth, SQL queries, schema tools, and interactive ECharts visualization.

Works with teradatakeycloak

90
Spark score
out of 100
Updated 3 months ago
Version 1.0.0
Models
universal

Add to Favorites

Why it matters

Access and analyze your Teradata data securely using enterprise OAuth 2.1 authentication. This asset provides robust database interaction capabilities with granular access control.

Outcomes

What it gets done

01

Execute SELECT queries on Teradata tables.

02

List databases, tables, and table details.

03

Analyze data for missing and negative values.

04

Authenticate and authorize access via OAuth 2.1 and Keycloak.

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/vb-teradata | bash

Capabilities

Tools your agent gets

query

Executes SELECT queries to read data from the database

list_db

Lists all databases in the Teradata system

list_tables

Lists objects in a database

show_tables_details

Shows detailed information about database tables

list_missing_values

Lists top fields with missing values in a table

list_negative_values

Shows the count of fields with negative values in a table

list_distinct_values

Returns the count of unique categories for a column in a table

standard_deviation

Shows the mean value and standard deviation for a column in a table

Overview

Teradata MCP Server

An MCP server for Teradata supporting TD2/LDAP/Kerberos/OAuth 2.1 authentication, SQL query execution, schema exploration, data-quality analysis, and interactive ECharts visualization. Use to query, explore, or visualize Teradata data through Claude. Auth setup and OAuth scopes should match the intended access level - visualize_query needs teradata:query, not just teradata:read.

What it does

Teradata MCP Server connects AI assistants to a Teradata database with multiple authentication mechanisms - TD2 (default username/password), LDAP, Kerberos, and JWT via Teradata's LOGMECH setting - plus OAuth 2.1 support with Keycloak integration, JWT validation, and scope-based authorization following RFC 9728 protected resource metadata. It provides query tools (query for plain tabular SQL results, visualize_query for rendering results as interactive ECharts charts through an MCP App), schema tools (list_db, list_tables, show_tables_details for column names and types), and analysis tools (list_missing_values, list_negative_values, list_distinct_values, standard_deviation).

The visualize_query MCP App renders 19 chart types across five categories: Bar (basic, grouped, stacked, horizontal, sorted, waterfall, rounded, polar), Line (basic, smooth, area, stacked area, step), Pie (pie, doughnut, rose/Nightingale), Scatter (scatter, bubble), and Mixed (bar plus line).

git clone https://github.com/arturborycki/mcp-teradata.git
cd mcp-teradata
uv sync
uv run teradata-mcp "teradatasql://user:password@host/database"

Connection resilience includes automatic retry with exponential backoff (configurable max retries and backoff delays) and non-blocking database operations via asyncio.to_thread(). A per-tool QueryBand provides an audit trail for Teradata workload management. OAuth scopes are granular: teradata:read, teradata:write, teradata:query, teradata:admin, and teradata:schema - notably, visualize_query requires the teradata:query scope specifically, not just teradata:read. Supported transports are stdio (for Claude Desktop/CLI, no OAuth), SSE, and streamable-http (both with full OAuth and discovery endpoint support).

When to use - and when NOT to

Use this connector when you want Claude to query, explore the schema of, or visualize data in a Teradata database - running ad hoc SQL, checking table structure, spotting data-quality issues like null or negative values, or rendering query results as interactive charts.

Authentication setup varies significantly by mechanism (TD2 is simplest; LDAP requires matching the authcid format to your directory type - Active Directory Simple Bind, Active Directory DIGEST-MD5, or OpenLDAP/Sun DS - and Kerberos/OAuth require additional infrastructure like Keycloak). Because it can execute arbitrary SQL against a production database, scope and credential configuration should match the intended access level (read-only versus write/admin) rather than defaulting to broad permissions.

Capabilities

Query: run SQL and get tabular results, or render results as one of 19 interactive chart types. Schema: list databases, list tables/views, show column names and types. Analysis: null-value counts, negative-value counts, distinct-value counts, and mean/standard-deviation per column.

How to install

Clone the repository and run uv sync, then uv run teradata-mcp "teradatasql://user:password@host/database" or set DATABASE_URI as an environment variable. Configure in Claude Desktop's claude_desktop_config.json with the DATABASE_URI and, depending on the auth mechanism, DB_LOGMECH/DB_LOGDATA (LDAP/Kerberos) or OAUTH_ENABLED plus Keycloak connection details (OAuth). Docker deployment is supported via docker compose up -d (or the OAuth-specific compose file).

Who it's for

Data analysts, database administrators, and developers who want Claude to query, explore, and visualize data in a Teradata database with authentication matching their organization's security model.

Source README

Teradata MCP Server

A Model Context Protocol (MCP) server for Teradata database with OAuth 2.1 authentication, multiple authentication mechanisms (TD2, LDAP, Kerberos), and interactive data visualization.

Features

  • Multiple Auth Mechanisms - TD2 (default), LDAP, Kerberos, JWT via Teradata LOGMECH
  • OAuth 2.1 with Keycloak integration, JWT validation, scope-based authorization
  • Protected Resource Metadata (RFC 9728 compliant)
  • Interactive Visualization - ECharts-based MCP App with 19 chart types
  • Connection Resilience - automatic retry with exponential backoff
  • Non-blocking I/O - all DB operations run via asyncio.to_thread()
  • Per-tool QueryBand - audit trail for Teradata workload management

Tools

Query Tools

  • query - Execute SQL queries, return plain tabular results
  • visualize_query - Execute SQL and render interactive ECharts charts via MCP App

Schema Tools

  • list_db - List all databases
  • list_tables - List tables/views in a database
  • show_tables_details - Show column names and types for a table

Analysis Tools

  • list_missing_values - Columns with NULL value counts
  • list_negative_values - Columns with negative value counts
  • list_distinct_values - Distinct category counts per column
  • standard_deviation - Mean and standard deviation for a column

MCP App - Interactive Visualization

The visualize_query tool renders results as interactive charts in the MCP client.

Category Charts
Bar Basic, Grouped, Stacked, Horizontal, Sorted, Waterfall, Rounded, Polar
Line Basic, Smooth, Area, Stacked Area, Step
Pie Pie, Doughnut, Rose / Nightingale
Scatter Scatter, Bubble
Mixed Bar + Line

Quick Start

Installation

git clone https://github.com/arturborycki/mcp-teradata.git
cd mcp-teradata
uv sync

Run with TD2 (Standard Authentication)

uv run teradata-mcp "teradatasql://user:password@host/database"

Or via environment variable:

export DATABASE_URI="teradatasql://user:password@host/database"
uv run teradata-mcp

Configuration

Claude Desktop

Add to your claude_desktop_config.json:

TD2 (Username/Password)
{
  "mcpServers": {
    "teradata": {
      "command": "uv",
      "args": [
        "--directory", "/path/to/mcp-teradata",
        "run", "teradata-mcp"
      ],
      "env": {
        "DATABASE_URI": "teradatasql://user:password@host/database"
      }
    }
  }
}
LDAP Authentication
{
  "mcpServers": {
    "teradata": {
      "command": "uv",
      "args": [
        "--directory", "/path/to/mcp-teradata",
        "run", "teradata-mcp"
      ],
      "env": {
        "DATABASE_URI": "teradatasql://@host/database",
        "DB_LOGMECH": "LDAP",
        "DB_LOGDATA": "authcid=ldap_user password=ldap_password"
      }
    }
  }
}

The authcid format depends on the LDAP directory:

Directory Format
Active Directory (Simple Bind) authcid=user@domain.com
Active Directory (DIGEST-MD5) authcid=DOMAIN\username
OpenLDAP / Sun DS authcid=username
Kerberos Authentication
{
  "mcpServers": {
    "teradata": {
      "command": "uv",
      "args": [
        "--directory", "/path/to/mcp-teradata",
        "run", "teradata-mcp"
      ],
      "env": {
        "DATABASE_URI": "teradatasql://@host/database",
        "DB_LOGMECH": "KRB5"
      }
    }
  }
}
OAuth-Enabled Configuration
{
  "mcpServers": {
    "teradata": {
      "command": "uv",
      "args": [
        "--directory", "/path/to/mcp-teradata",
        "run", "teradata-mcp"
      ],
      "env": {
        "DATABASE_URI": "teradatasql://user:password@host/database",
        "OAUTH_ENABLED": "true",
        "KEYCLOAK_URL": "https://your-keycloak.example.com",
        "KEYCLOAK_REALM": "teradata-realm",
        "KEYCLOAK_CLIENT_ID": "teradata-mcp",
        "KEYCLOAK_CLIENT_SECRET": "your-secret",
        "OAUTH_RESOURCE_SERVER_URL": "https://your-mcp-server.example.com"
      }
    }
  }
}

Environment Variables

Database Connection
Variable Description Default
DATABASE_URI Teradata connection URL (teradatasql://user:pass@host/db) -
DB_LOGMECH Authentication mechanism: TD2, LDAP, KRB5, TDNEGO, JWT TD2
DB_LOGDATA LDAP/JWT credentials (e.g., authcid=user password=pass) -
DB_SSL_MODE TLS mode: ALLOW, PREFER, REQUIRE, VERIFY-CA, VERIFY-FULL -
DB_ENCRYPT_DATA Enable transport encryption true
Connection Resilience
Variable Description Default
DB_MAX_RETRIES Max reconnection attempts 3
DB_INITIAL_BACKOFF Initial backoff delay (seconds) 1.0
DB_MAX_BACKOFF Max backoff delay (seconds) 30.0
MCP Transport
Variable Description Default
MCP_TRANSPORT Transport: stdio, sse, streamable-http stdio
MCP_HOST Bind address for HTTP transports localhost
MCP_PORT Port for HTTP transports 8000
MCP_PATH Path for streamable-http /mcp/
OAuth 2.1
Variable Description Default
OAUTH_ENABLED Enable OAuth authentication false
KEYCLOAK_URL Keycloak server URL -
KEYCLOAK_REALM Keycloak realm name -
KEYCLOAK_CLIENT_ID OAuth client ID -
KEYCLOAK_CLIENT_SECRET OAuth client secret -
OAUTH_RESOURCE_SERVER_URL Resource server URL -
OAUTH_REQUIRED_SCOPES Required scopes (comma-separated) -
OAUTH_VALIDATE_AUDIENCE Validate token audience true
OAUTH_VALIDATE_SCOPES Validate token scopes true
OAUTH_REQUIRE_HTTPS Require HTTPS for OAuth URLs true
CORS_ALLOWED_ORIGINS CORS allowed origins *

OAuth Scopes

Scope Description
teradata:read Read access to database resources
teradata:write Write access to database resources
teradata:query Execute SQL queries
teradata:admin Administrative access
teradata:schema Schema management operations

Transport Compatibility

Transport OAuth Discovery Endpoints Use Case
stdio N/A N/A Claude Desktop, CLI clients
SSE Full Available Web applications
Streamable HTTP Full Available API integrations

Discovery endpoints (when OAuth enabled):

  • /.well-known/oauth-protected-resource - RFC 9728 metadata
  • /.well-known/mcp-server-info - MCP capabilities
  • /health - Health check

Docker Deployment

Development

docker compose up -d

With OAuth

docker compose -f docker-compose.oauth.yml up -d

Build

uv build

Troubleshooting

Database connection issues:

  • Verify DATABASE_URI format: teradatasql://user:pass@host/database
  • Check network connectivity to Teradata server
  • For LDAP: ensure DB_LOGMECH=LDAP and DB_LOGDATA are set correctly
  • Connection issues are automatically retried (configurable via DB_MAX_RETRIES)

LDAP authentication fails:

  • Verify the Teradata server has LDAP configured in TDGSS
  • Check authcid format matches your directory type
  • Escape special characters in passwords (@\@, spaces → use quotes)

Permission denied errors:

  • Verify user has required OAuth scopes
  • Check Keycloak role assignments
  • visualize_query requires teradata:query scope (not just teradata:read)

Debug logging:

export LOG_LEVEL=DEBUG
uv run teradata-mcp

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.