MindsDB MySQL MCP Server

MindsDB MySQL MCP Server

Connects AI clients to MindsDB via the MySQL protocol to execute SQL queries, manage databases, and perform semantic searches within knowledge bases. It enables automated workflows through job scheduling and provides seamless integration with external data sources.

Category
访问服务器

README

MindsDB MySQL MCP Server

MCP server for MindsDB that connects via MySQL protocol (port 47335), providing reliable tools for Claude Code and Desktop.

Why MySQL over SSE/HTTP?

  • MySQL protocol is stable and well-tested
  • No async event loop issues (the "this event loop is already running" errors)
  • Better error messages and debugging
  • Works reliably with knowledge base queries

Installation

cd mcp/mindsdb-mysql
npm install
npm run build

Configuration

Environment Variables

Variable Default Description
MINDSDB_HOST 127.0.0.1 MindsDB server host
MINDSDB_PORT 47335 MindsDB MySQL port
MINDSDB_USER mindsdb Username (use your MindsDB Cloud email for cloud instances)
MINDSDB_PASSWORD (empty) Password (required for MindsDB Cloud)

Claude Code (~/.claude.json)

{
  "mcpServers": {
    "mindsdb": {
      "type": "stdio",
      "command": "node",
      "args": [
        "/path/to/mindsdb-mysql/dist/index.js"
      ],
      "env": {
        "MINDSDB_HOST": "localhost",
        "MINDSDB_PORT": "47335",
        "MINDSDB_USER": "mindsdb",
        "MINDSDB_PASSWORD": ""
      }
    }
  }
}

For MindsDB Cloud, use your email as MINDSDB_USER and your password for MINDSDB_PASSWORD.

Claude Desktop (claude_desktop_config.json)

Same configuration, add to the mcpServers object.

Available Tools (11)

1. query - Execute SQL

Execute any MindsDB SQL query. Use this for custom queries not covered by other tools.

query(sql: string, database?: string): QueryResult

2. list_databases - List Data Sources

List all databases/data sources in MindsDB.

list_databases(): string[]

3. list_knowledge_bases - List KBs

List all knowledge bases in MindsDB.

list_knowledge_bases(): KnowledgeBase[]

4. describe - Describe Any Object

Describe a model, table, or knowledge base. Returns column information.

describe(name: string, database?: string): Description

5. search_kb - Search Knowledge Base

Search a knowledge base using hybrid semantic + keyword search.

search_kb(
  kb_name: string,
  question: string,
  limit?: number,         // default: 10
  alpha?: number,         // default: 0.5 (0=keyword, 1=semantic)
  min_relevance?: number, // default: 0
  metadata_filter?: Record<string, string>
): SearchResult[]

6. insert_kb - Insert Data into Knowledge Base

Insert data into a knowledge base from a source query.

insert_kb(
  kb_name: string,
  source_query: string,   // e.g., "SELECT id, content FROM mydb.docs"
  batch_size?: number,    // default: 1000
  threads?: number,       // default: 1
  skip_existing?: boolean // default: false
): { rows_inserted: number }

7. create_kb - Create Knowledge Base

Create a new knowledge base with embedding model configuration.

create_kb(
  name: string,
  embedding_model: {
    provider: string,     // openai, azure, google, ollama
    model_name: string,
    api_key?: string
  },
  content_columns: string[],
  metadata_columns?: string[],
  id_column?: string,
  reranking_model?: {...},
  storage?: string        // default: chromadb
): { kb_name: string }

8. list_jobs - List Scheduled Jobs

List all scheduled jobs in MindsDB.

list_jobs(): Job[]

9. create_job - Schedule Recurring Query

Create a scheduled job to run a query at regular intervals.

create_job(
  name: string,
  query: string,          // SQL to execute
  every: string,          // e.g., "1 hour", "1 day"
  start?: string,         // ISO datetime
  end?: string            // ISO datetime
): { job_name: string }

10. list_tables - List Tables

List all tables in a specific database.

list_tables(database: string): string[]

11. connect_database - Connect External Data Source

Connect an external database as a data source in MindsDB.

connect_database(
  name: string,
  engine: string,         // postgres, mysql, mongodb, etc.
  parameters: {
    host: string,
    port: number,
    database: string,
    user: string,
    password: string
  }
): { database_name: string }

Testing

With MCP Inspector

npx @modelcontextprotocol/inspector node dist/index.js

Or with a remote MindsDB instance:

MINDSDB_HOST=your-mindsdb-host MINDSDB_PORT=47335 \
  npx @modelcontextprotocol/inspector node dist/index.js

Manual verification

After configuring Claude Code, restart and verify:

# In Claude Code, these tools should be available:
mcp__mindsdb__list_databases
mcp__mindsdb__list_knowledge_bases
mcp__mindsdb__search_kb
mcp__mindsdb__query
# ... etc.

MindsDB SQL Reference

Knowledge Base Query

-- Semantic search
SELECT * FROM my_kb WHERE content = 'search phrase' LIMIT 10;

-- With relevance filter
SELECT * FROM my_kb WHERE content = 'query' AND relevance >= 0.5;

-- Hybrid search (keyword + semantic)
SELECT * FROM my_kb WHERE content = 'query' AND hybrid_search_alpha = 0.8;

-- Metadata filter
SELECT * FROM my_kb WHERE content = 'query' AND metadata_column = 'value';

Output Columns

  • chunk_id: <id>:<chunk_number>of<total>:<start_char>to<end_char>
  • chunk_content: The text content
  • relevance: 0-1 score (higher = better match)
  • distance: Vector distance (lower = closer)

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选