Skip to main content
Glama
iskakaushik

ClickHouse MCP Server

by iskakaushik

list_databases

Retrieve a list of all available databases in the ClickHouse MCP Server for streamlined database management and access.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'list_databases' tool. It uses a ClickHouse client to execute the 'SHOW DATABASES' command and returns the list of databases.
    @mcp.tool()
    def list_databases():
        logger.info("Listing all databases")
        client = create_clickhouse_client()
        result = client.command("SHOW DATABASES")
        logger.info(f"Found {len(result) if isinstance(result, list) else 1} databases")
        return result
  • Helper function to create and return a ClickHouse client instance using environment variables, used by the list_databases handler.
    def create_clickhouse_client():
        host = os.getenv("CLICKHOUSE_HOST")
        port = os.getenv("CLICKHOUSE_PORT")
        username = os.getenv("CLICKHOUSE_USER")
        logger.info(f"Creating ClickHouse client connection to {host}:{port} as {username}")
        return clickhouse_connect.get_client(
            host=host,
            port=port,
            username=username,
            password=os.getenv("CLICKHOUSE_PASSWORD"),
        )

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/iskakaushik/mcp-clickhouse'

If you have feedback or need assistance with the MCP directory API, please join our Discord server