Skip to main content

AI agent for ClickHouse database analysis via MCP

Project description

ClickHouse MCP Agent

version

AI agent for ClickHouse database analysis via MCP (Model Context Protocol).

Features

  • Query ClickHouse databases using AI models
  • Structured output: analysis, SQL used, confidence
  • Easy connection management (predefined or custom)
  • No CLI or environment setup required

Supported Providers

  • OpenAI
  • Anthropic
  • Google Gemini
  • Groq
  • Mistral
  • Cohere

Usage

  • Configure your model, API key, and connection using the runtime config API.
  • Run queries using the ClickHouseAgent.
  • Multi-model/provider support is automatic—just set the API key for each provider.

See the examples/ directory for full, canonical usage scripts:

  • examples/example_minimal.py: Minimal query
  • examples/example_switch_provider.py: Switch provider/model at runtime
  • examples/example_error_handling.py: Error handling for missing API key
  • examples/example_multi_query.py: Multiple queries in a loop

All features and usage patterns are covered in these scripts.

Output

Returns a ClickHouseOutput object:

  • analysis: Natural language results with SQL queries
  • sql_used: SQL query that was executed
  • confidence: Confidence level (1-10)

Requirements

  • Python 3.10+
  • AI API key for your chosen provider (OpenAI, Anthropic, Google/Gemini, Groq, Mistral, Cohere)

All dependencies are handled by pyproject.toml.

Roadmap

✅ Completed Features

  • MCP Integration: PydanticAI + ClickHouse MCP server integration
  • Query Execution: SQL query generation and execution via MCP
  • Schema Inspection: Database, table, and column exploration
  • Connection Management: Multiple connection configurations (playground, custom)
  • RBAC Support: Per-query user credentials via config
  • Dynamic Connections: Runtime connection configuration, no environment dependencies
  • Direct API Key Passing: Pass AI API keys directly to agent (model_api_key)
  • Structured Output: ClickHouseOutput with analysis, SQL, and confidence
  • Type Safety: Full type annotations and mypy compliance
  • Code Quality: Black formatting, isort, flake8 linting
  • Multi-Model Support: Runtime selection of provider/model and API key management

🚧 Planned / In Progress

  • Message History: Add message_history parameter for conversational context
  • Conversational Agent: Persistent memory across queries
  • Improved Error Handling: More robust error and exception management
  • Advanced Output Formatting: Customizable output for downstream applications

Contributing

Open an issue or pull request for features or fixes.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

clickhouse_mcp_agent-0.4.0a0.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

clickhouse_mcp_agent-0.4.0a0-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file clickhouse_mcp_agent-0.4.0a0.tar.gz.

File metadata

  • Download URL: clickhouse_mcp_agent-0.4.0a0.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for clickhouse_mcp_agent-0.4.0a0.tar.gz
Algorithm Hash digest
SHA256 724ab28571004b4e6e2e6e588946aa1a25d59c6a99dc049278891b649bb8e125
MD5 9620b3160d7e229c166e684e5708f0c4
BLAKE2b-256 e25bf4fc6fd71c617a6ad8e862d4301ef1cc9fc47da882a66eebdfd414676bc6

See more details on using hashes here.

Provenance

The following attestation bundles were made for clickhouse_mcp_agent-0.4.0a0.tar.gz:

Publisher: publish-pypi.yml on AranNomante/clickhousemcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file clickhouse_mcp_agent-0.4.0a0-py3-none-any.whl.

File metadata

File hashes

Hashes for clickhouse_mcp_agent-0.4.0a0-py3-none-any.whl
Algorithm Hash digest
SHA256 42488b244b969b60ba77751051781e470649fb56779d3f7b2561b9569e83d1f6
MD5 cd61bf19e823429ab01bde911f3c6584
BLAKE2b-256 1e771637675fb0dd72b09b7df0933aad82ba118f3b812434334d8ba96fc7a04c

See more details on using hashes here.

Provenance

The following attestation bundles were made for clickhouse_mcp_agent-0.4.0a0-py3-none-any.whl:

Publisher: publish-pypi.yml on AranNomante/clickhousemcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page