MindsDB's MCP server enables humans, AI, agents, and applications to get highly accurate answers across large-scale data sources. It allows you to connect, unify, and respond to questions over federated data spanning databases, data warehouses, and SaaS applications.
The fastest and recommended way to get started with the MindsDB MCP server is using Docker Desktop:
For more flexibility and customization options:
MindsDB allows you to connect to hundreds of enterprise data sources:
-- Example of connecting to a MySQL database
CREATE DATABASE mysql_connection
WITH ENGINE = 'mysql',
PARAMETERS = {
"user": "your_username",
"password": "your_password",
"host": "your_host",
"port": 3306,
"database": "your_database"
};
For a complete list of supported data sources, visit the data integrations documentation.
MindsDB allows you to prepare and unify data before generating responses:
Create knowledge bases to index and organize unstructured data:
-- Example of creating a knowledge base
CREATE KNOWLEDGE BASE my_kb
WITH ENGINE = 'chromadb',
STORAGE = 's3',
PARAMETERS = {
"bucket": "your-bucket",
"region": "us-east-1"
};
Create unified views across different data sources:
-- Example of creating a view joining data from different sources
CREATE VIEW combined_customer_data AS
SELECT c.customer_id, c.name, o.order_id, o.amount
FROM mysql_db.customers c
JOIN postgres_db.orders o
ON c.customer_id = o.customer_id;
Schedule data synchronization and transformation tasks:
-- Example of creating a job to update data hourly
CREATE JOB refresh_data_hourly
BEGIN
INSERT INTO target_table
SELECT * FROM source_table
WHERE update_date > '{{LAST_RUN}}';
END
EVERY HOUR;
Configure specialized agents to answer questions over your data:
-- Example of creating an agent
CREATE AGENT customer_support_agent
USING
MODEL = 'openai.gpt-4',
KNOWLEDGE_BASE = 'support_kb',
PROMPT TEMPLATE = 'Answer customer support questions based on our documentation: {{question}}';
MindsDB's MCP (Model Context Protocol) server allows seamless interaction with your data:
# Python example of connecting to MindsDB MCP server
from mcp_client import MCPClient
# Initialize client
client = MCPClient(url="http://localhost:8000/api/mcp")
# Send a query
response = client.query(
"What were our top-selling products last quarter?",
context={"database": "sales_data"}
)
# Process the response
print(response.content)
For more detailed information on using the MCP protocol, visit the MCP documentation.
Configure the MindsDB server using environment variables:
# Set these variables before starting the server
export MINDSDB_DB_PATH=/path/to/storage
export MINDSDB_LOG_LEVEL=INFO
export MINDSDB_API_PORT=8000
Modify the API behavior by adjusting the configuration:
# Example configuration (config.yaml)
api:
http:
host: 0.0.0.0
port: 8000
cors:
origins: ["*"]
rate_limiting:
enabled: true
limit: 100
period: 60
For additional configuration options and examples, refer to the MindsDB documentation.
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "mindsdb" '{"command":"npx","args":["-y","mindsdb"]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"mindsdb": {
"command": "npx",
"args": [
"-y",
"mindsdb"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"mindsdb": {
"command": "npx",
"args": [
"-y",
"mindsdb"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect