Teradata MCP Server

Teradata MCP Server

Enables secure interaction with Teradata databases through SQL queries, schema exploration, and business intelligence analysis with enterprise-grade OAuth 2.1 authentication and workload management capabilities.

Category
访问服务器

README

Teradata MCP Server with OAuth 2.1 Authentication

Overview

A Model Context Protocol (MCP) server implementation that provides secure database interaction and business intelligence capabilities through Teradata. This server enables running SQL queries, analyzing business data, and workload management with enterprise-grade OAuth 2.1 authentication.

🔐 Security Features

  • OAuth 2.1 Authentication with Keycloak integration
  • JWT Token Validation using JWKS endpoints
  • Scope-based Authorization for fine-grained access control
  • Protected Resource Metadata (RFC 9728 compliant)
  • Token Introspection support for opaque tokens
  • Production-ready connection resilience and error handling
  • Automatic Connection Retry for improved reliability

Components

Tools

The server offers comprehensive database and workload management tools:

Query Tools

  • query
    • Execute SELECT queries to read data from the database
    • Required Scopes: teradata:query, teradata:read
    • Input:
      • query (string): The SELECT SQL query to execute
    • Returns: Query results as array of objects

Schema Tools

  • list_db

    • Lists all databases in the Teradata system
    • Required Scopes: teradata:read
    • Returns: List of databases
  • list_tables

    • Lists objects in a database
    • Required Scopes: teradata:read
    • Input:
      • db_name (string): Database name
    • Returns: List of database objects under provided or user default database
  • show_tables_details

    • Show detailed information about a database tables
    • Required Scopes: teradata:read
    • Input:
    • table_name (string): Name of the table
    • db_name (string): Name of the database
    • Returns: Array of column names and data types

Analysis Tools

  • list_missing_values
    • Lists the top features with missing values in a table
    • Required Scopes: teradata:read
  • list_negative_values
    • Lists how many features have negative values in a table
    • Required Scopes: teradata:read
  • list_distinct_values
    • Lists how many distinct categories are there for column in the table
    • Required Scopes: teradata:read
  • standard_deviation
    • What is the mean and standard deviation for column in table?
    • Required Scopes: teradata:read

🚀 Quick Start

1. Basic Setup (No Authentication)

# Clone the repository
git clone https://github.com/arturborycki/mcp-teradata.git
cd mcp-teradata

# Install dependencies
uv install

# Run with database connection
uv run teradata-mcp "teradatasql://user:password@host/database"

2. OAuth-Enabled Setup

# Copy environment configuration
cp .env.example .env

# Edit .env with your OAuth settings
OAUTH_ENABLED=true
KEYCLOAK_URL=https://your-keycloak.com
KEYCLOAK_REALM=teradata-realm
KEYCLOAK_CLIENT_ID=teradata-mcp
KEYCLOAK_CLIENT_SECRET=your-secret
OAUTH_RESOURCE_SERVER_URL=https://your-mcp-server.com

# Run with OAuth
uv run teradata-mcp "teradatasql://user:password@host/database"

Configuration

Database Connection

DATABASE_URI=teradatasql://username:password@hostname/database

Connection Retry Settings

# Number of retry attempts for database connections (default: 1)
TOOL_RETRY_MAX_ATTEMPTS=1

# Delay between retry attempts in seconds (default: 1.0)  
TOOL_RETRY_DELAY_SECONDS=1.0

OAuth 2.1 Settings

# Enable OAuth authentication
OAUTH_ENABLED=true

# Keycloak configuration
KEYCLOAK_URL=https://keycloak.example.com
KEYCLOAK_REALM=teradata-realm  
KEYCLOAK_CLIENT_ID=teradata-mcp
KEYCLOAK_CLIENT_SECRET=your-client-secret

# Resource server identification
OAUTH_RESOURCE_SERVER_URL=https://your-mcp-server.com

# Optional: Required scopes
OAUTH_REQUIRED_SCOPES=teradata:read,teradata:query

# Security settings
OAUTH_VALIDATE_AUDIENCE=true
OAUTH_VALIDATE_SCOPES=true
OAUTH_REQUIRE_HTTPS=true

Supported OAuth Scopes

  • teradata:read - Read access to database resources
  • teradata:write - Write access to database resources
  • teradata:query - Execute SQL queries
  • teradata:admin - Administrative access (TDWM, user management)
  • teradata:schema - Schema management operations

Transport Compatibility

OAuth 2.1 authentication is supported across all MCP transport methods:

Transport OAuth Support Discovery Endpoints Notes
SSE ✅ Full Support ✅ Available OAuth endpoints integrated into Starlette app
Streamable HTTP ✅ Full Support ✅ Available OAuth endpoints via FastMCP FastAPI integration
Stdio ➖ N/A ➖ N/A No HTTP endpoints, authentication via environment

Discovery Endpoints Available:

  • /.well-known/oauth-protected-resource - Protected resource metadata (RFC 9728)
  • /.well-known/mcp-server-info - MCP server capabilities and OAuth configuration
  • /health - Health check with OAuth status

Transport Selection:

# SSE (Server-Sent Events) - Recommended for web applications
export MCP_TRANSPORT=sse
export MCP_HOST=0.0.0.0
export MCP_PORT=8000

# Streamable HTTP - Recommended for API integrations  
export MCP_TRANSPORT=streamable-http
export MCP_HOST=0.0.0.0
export MCP_PORT=8000
export MCP_PATH=/mcp/

# Stdio - For command-line clients (Claude Desktop)
export MCP_TRANSPORT=stdio

🐳 Docker Deployment

Without OAuth (Development)

docker-compose up -d

With OAuth (Production)

# Edit environment variables in docker-compose.oauth.yml
docker-compose -f docker-compose.oauth.yml up -d

With Keycloak (Testing)

# Includes Keycloak server for testing
docker-compose -f docker-compose.oauth.yml up keycloak mcp-teradata

🔑 Keycloak Setup

Automated Setup

Use the provided script to automatically configure Keycloak:

# For local development
./scripts/setup-keycloak.sh http://localhost:8080 admin admin

# For remote Keycloak
./scripts/setup-keycloak.sh https://your-keycloak.com admin-user admin-pass

Manual Setup

See the comprehensive guide in docs/OAUTH.md for detailed Keycloak configuration instructions.

🧪 Testing OAuth

Test your OAuth configuration:

# Run OAuth tests
./scripts/test-oauth.py

# Test with custom settings
./scripts/test-oauth.py --keycloak-url https://your-keycloak.com --realm your-realm

📋 API Endpoints

When OAuth is enabled, the server exposes discovery endpoints:

  • /.well-known/oauth-protected-resource - Protected resource metadata (RFC 9728)
  • /.well-known/mcp-server-info - MCP server capabilities and OAuth info
  • /health - Health check with OAuth status

Usage with Claude Desktop

Basic Configuration

{
  "mcpServers": {
    "teradata": {
      "command": "uv",
      "args": [
        "--directory",
        "/Users/MCP/mcp-teradata",
        "run",
        "teradata-mcp"
      ],
      "env": {
        "DATABASE_URI": "teradatasql://user:passwd@host/database"
      }
    }
  }
}

OAuth-Enabled Configuration

{
  "mcpServers": {
    "teradata": {
      "command": "uv", 
      "args": [
        "--directory",
        "/Users/MCP/mcp-teradata",
        "run",
        "teradata-mcp"
      ],
      "env": {
        "DATABASE_URI": "teradatasql://user:passwd@host/database",
        "OAUTH_ENABLED": "true",
        "KEYCLOAK_URL": "https://your-keycloak.com",
        "KEYCLOAK_REALM": "teradata-realm",
        "KEYCLOAK_CLIENT_ID": "teradata-mcp",
        "KEYCLOAK_CLIENT_SECRET": "your-secret",
        "OAUTH_RESOURCE_SERVER_URL": "https://your-server.com"
      }
    }
  }
}
# Add the server to your claude_desktop_config.json
{
  "mcpServers": {
    "teradata": {
      "command": "uv",
      "args": [
        "--directory",
        "/Users/MCP/mcp-teradata",
        "run",
        "teradata-mcp"
      ],
      "env": {
        "DATABASE_URI": "teradata://user:passwd@host"
      }
    }
  }
}

Usage as API container

Make sure to edit docker-compose.yml and update environment variable

docker compose build
docker compose up

🔧 Building

uv build

📚 Documentation

🔒 Security Best Practices

  1. Use HTTPS in production (OAUTH_REQUIRE_HTTPS=true)
  2. Secure client secrets using environment variables or secret management
  3. Implement proper token refresh for long-running applications
  4. Follow principle of least privilege when assigning scopes
  5. Regularly audit user permissions and access logs

🐛 Troubleshooting

Common Issues

OAuth authentication fails:

# Test Keycloak connectivity
curl https://your-keycloak.com/auth/realms/master/.well-known/openid-configuration

# Check server health
curl https://your-mcp-server.com/health

Database connection issues:

  • Verify DATABASE_URI format: teradatasql://user:pass@host/database
  • Check network connectivity to Teradata server
  • Ensure database credentials are correct
  • Connection issues are automatically retried once by default

Connection retry configuration:

  • Set TOOL_RETRY_MAX_ATTEMPTS to control retry behavior (0 = no retries)
  • Set TOOL_RETRY_DELAY_SECONDS to control delay between retries
  • Monitor logs for retry attempt messages

Permission denied errors:

  • Verify user has required OAuth scopes
  • Check Keycloak role assignments
  • Review scope mappings in client configuration

Debug Mode

Enable debug logging:

export LOG_LEVEL=DEBUG
export OAUTH_ENABLED=true
uv run teradata-mcp "teradatasql://user:pass@host/db"

🤝 Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📄 License

This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.

🙏 Acknowledgments

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选