Back to Mindsdb

MindsDB's MCP Server Usage and Tools

docs/model-context-protocol/usage.mdx

26.1.03.5 KB
Original Source

MindsDB is an MCP server that enables your MCP applications to answer questions over large-scale federated data spanning databases, data warehouses, and SaaS applications.

Start MindsDB as an MCP Server

Follow the steps below to use MindsDB as an MCP server.

  1. Install MindsDB locally via Docker or Docker Desktop.

  2. Connect your data source and/or upload files to MindsDB in order to ask questions over your data.

    <Accordion title="Sample Data"> You can use our sample dataset that stores the sales manager data.
    sql
    CREATE DATABASE sales_manager_data
    WITH ENGINE = "postgres",
    PARAMETERS = {
        "user": "demo_user",
        "password": "demo_password",
        "host": "samples.mindsdb.com",
        "port": "5432",
        "database": "sales_manager_data"
    };
    
    </Accordion>
  3. Start MindsDB MCP server.

    • Without authentication (suitable for local tools):

      bash
      docker run --name mindsdb_container -p 47334:47334 mindsdb/mindsdb
      
    • With PAT authentication (suitable for remote):

      bash
      docker run --name mindsdb_container -p 47334:47334 -e MINDSDB_USERNAME=admin -e MINDSDB_PASSWORD=password123 mindsdb/mindsdb
      

      Get a Bearer token:

      bash
      curl -X POST -d '{"username":"admin","password":"password123"}' -H "Content-Type: application/json" http://localhost:47334/api/login
      

      Use this token as Authorization: Bearer <token> in your MCP client.

    • With OAuth 2.0 (for enterprise deployments): configure MINDSDB_MCP_OAUTH_ENABLED=true along with MINDSDB_MCP_OAUTH_ISSUER_URL, MINDSDB_MCP_OAUTH_CLIENT_ID, and MINDSDB_MCP_OAUTH_CLIENT_SECRET.

  4. To confirm the MindsDB MCP server is running use http://127.0.0.1:47334/mcp/status. A successful response means your MCP environment is ready.

MCP Capabilities

Tools

query — Executes SQL queries against MindsDB using MySQL syntax.

Parameters:

  • query (required): SQL query string
  • context (optional): Dict with default database, e.g. {"db": "my_postgres"}

Returns one of:

  • {"type": "table", "column_names": [...], "data": [...]} — for SELECT results
  • {"type": "ok", "affected_rows": N} — for INSERT/UPDATE/DELETE
  • {"type": "error", "error_code": N, "error_message": "..."} — on failure

Resources

MCP resources expose schema information for discovery:

Resource URIDescription
schema://databasesLists all connected data sources
schema://databases/{db}/tablesLists tables in a database
schema://databases/{db}/tables/{table}/columnsLists columns with types
schema://knowledge_basesLists knowledge bases

Prompts

sample_table — Generates instructions to fetch 5 sample rows and describe a table's structure.

Transport Modes

  • HTTP (SSE): http://127.0.0.1:47334/mcp/sse
  • HTTP (Streamable): http://127.0.0.1:47334/mcp/streamable
  • Stdio: run with --mcp-stdio flag for local stdio-based transport

Configuration

CORS, rate limiting, DNS rebinding protection, and OAuth settings for the MCP server are configured via the api.mcp section of config.json or the corresponding environment variables. See Extend the Default MindsDB Configuration for the full parameter reference.