dubin555_clickhouse_mcp_server

dubin555_clickhouse_mcp_server

by dubin555
A Model Context Protocol (MCP) server implementation for secure and structured database interaction with ClickHouse.

ClickHouse MCP Server for AI Database Interaction

Overview

The ClickHouse MCP Server is a Model Context Protocol (MCP) implementation designed to facilitate secure and structured interactions between AI assistants and ClickHouse databases. It allows AI systems to list tables, read data, and execute SQL queries through a controlled interface, ensuring responsible database access.

Configuration

To configure the ClickHouse MCP Server, set the following environment variables:

CLICKHOUSE_HOST=localhost    
CLICKHOUSE_PORT=8123         
CLICKHOUSE_USER=default
CLICKHOUSE_PASSWORD=CHANGE_TO_YOUR_PASSWORD
CLICKHOUSE_DATABASE=default

Alternatively, you can use command-line arguments:

  • --host: The database host
  • --port: The database port
  • --user: The database username
  • --password: The database password
  • --database: The database name

Usage

Fake Some Data in ClickHouse

To begin, you can populate ClickHouse with sample data. Refer to the SQL scripts in dev_contribute.md for detailed instructions.

Post Your Question to AI Assistant in CLINE

Once the data is ready, you can interact with the AI assistant in CLINE. For example, you might ask:

What is the sales volume in each region? Which product is the best-selling?

Demo Screenshot

CLINE Configuration

To integrate the MCP server with CLINE, configure it in VSCode or any other MCP client. Here’s an example configuration:

{
  "mcpServers": {
    "clickhouse": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/clickhouse_mcp_server",
        "run",
        "-m",
        "clickhouse_mcp_server.server"
      ],
      "env": {
        "CLICKHOUSE_HOST": "localhost",
        "CLICKHOUSE_PORT": "8123",
        "CLICKHOUSE_USER": "default",
        "CLICKHOUSE_PASSWORD": "CHANGE_TO_YOUR_PASSWORD",
        "CLICKHOUSE_DATABASE": "default"
      }
    }
  }
}

License

This project is licensed under the Apache License 2.0. See the LICENSE file for more details.

Contribute

Contributions are welcome! Refer to dev_contribute.md for guidelines on how to contribute to this project.

Prerequisites

Before contributing, ensure you have the following installed:

  • Python with the uv package manager
  • ClickHouse installation
  • MCP server dependencies

Acknowledgement

This project was inspired by the following open-source repositories:

Special thanks to the developers of these projects for their contributions to the open-source community.

About

No additional description, website, or topics are provided for this project.

Resources

License

Activity

Stars

Watchers

Forks

Report repository

Releases

No releases published.

Packages 0

No packages published.

Languages

Features & Capabilities

Categories
mcp_server model_context_protocol clickhouse python database ai_assistant api_integration sql

Implementation Details

Stats

0 Views
0 Likes
3 GitHub Stars

Repository Info

dubin555 Organization

Similar Servers

continuedev_continue by continuedev
0
0
0