MindsDB's MCP server enables humans, AI, agents, and applications to get highly accurate answers across sprawled and large-scale data sources. The Model Context Protocol (MCP) server built into MindsDB allows your applications to connect, unify, and respond to questions over federated data spanning databases, data warehouses, and SaaS applications.
This is the fastest and recommended way to get started with MindsDB's MCP server:
For more flexibility and customization options:
# Pull the latest MindsDB image
docker pull mindsdb/mindsdb
# Run MindsDB with the MCP server enabled
docker run -p 47334:47334 -p 47335:47335 mindsdb/mindsdb
The MCP server will be available on port 47335 by default.
For those who want to install directly via Python:
pip install mindsdb
After installation, start the MindsDB server:
python -m mindsdb
Before using the MCP server, you need to connect your data sources:
-- Example: Connect to a MySQL database
CREATE DATABASE mysql_connection
WITH ENGINE = 'mysql',
PARAMETERS = {
"user": "your_user",
"password": "your_password",
"host": "your_host",
"port": 3306,
"database": "your_database"
};
MindsDB supports hundreds of data sources including databases, data warehouses, and SaaS applications.
After connecting your data sources, you can create unified views:
-- Create a view that joins data from multiple sources
CREATE VIEW unified_customer_data AS
SELECT c.*, o.order_id, o.order_date, o.amount
FROM mysql_connection.customers AS c
JOIN postgres_connection.orders AS o
ON c.customer_id = o.customer_id;
For unstructured data, you can create knowledge bases:
-- Create a knowledge base from documents
CREATE KNOWLEDGE BASE product_documentation
FROM files_connection.product_manuals;
To interact with your data through the MCP server, create and configure agents:
-- Create an agent that can answer questions about your data
CREATE AGENT customer_support_agent
USING
CONNECTION = openai_connection,
KNOWLEDGE BASE = product_documentation,
DATABASE = unified_customer_data,
MODEL = 'gpt-4';
You can interact with the MCP server using the MCP protocol:
// Example JavaScript client
const mcp = require('mcp-client');
const client = new mcp.Client({
host: 'localhost',
port: 47335,
});
// Connect to the MCP server
await client.connect();
// Send a query to an agent
const response = await client.query({
agent: 'customer_support_agent',
query: 'What are the total sales for customer ID 12345?'
});
console.log(response);
You can schedule data synchronization and transformation tasks:
-- Create a job to refresh a view daily
CREATE JOB refresh_unified_data
BEGIN
REFRESH VIEW unified_customer_data;
END
SCHEDULE EVERY 1 DAY;
To check the status of your MCP server and agents:
-- List all available agents
SELECT * FROM information_schema.agents;
-- List all running jobs
SELECT * FROM information_schema.jobs;
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 > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
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 explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.