datasource-mcp
Provides tools for executing SQL queries against a MySQL database, returning results as JSON.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@datasource-mcpShow me the top 10 customers by total spending"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
datasource-mcp
MySQL datasource MCP server for AI clients (Cursor, Claude Desktop, etc.).
Database Support: Currently supports MySQL only. Support for PostgreSQL, SQLite, and other databases is planned for future releases.
Install
pip install datasource-mcpIf the package is not yet available on your PyPI mirror, use the official index:
pip install datasource-mcp -i https://pypi.org/simple/Or run without installing (requires uv):
uvx datasource-mcpNote:
uvx datasource-mcpdownloads the package and immediately starts the MCP stdio server. It will block the terminal while waiting for a client connection. Configure it in your MCP client instead of running it manually.
Related MCP server: MySQL MCP Server
Cursor / MCP Client Config
Option 1: pip install (local environment)
Run pip install datasource-mcp first, then add this to mcp.json:
{
"mcpServers": {
"datasource-mcp": {
"command": "datasource-mcp",
"env": {
"DB_HOST": "127.0.0.1",
"DB_PORT": "3306",
"DB_USER": "root",
"DB_PASSWORD": "your_password",
"DB_NAME": "your_database"
}
}
}
}Option 2: uvx without installing (recommended)
No pip install required — uvx fetches the package from PyPI and runs it automatically. Requires uv to be installed.
{
"mcpServers": {
"datasource-mcp": {
"command": "uvx",
"args": ["datasource-mcp"],
"env": {
"DB_HOST": "127.0.0.1",
"DB_PORT": "3306",
"DB_USER": "root",
"DB_PASSWORD": "your_password",
"DB_NAME": "your_database"
}
}
}
}After updating the config, click Refresh in the MCP panel to apply changes.
Environment Variables
Variable | Default | Description |
|
| MySQL host |
|
| MySQL port |
|
| MySQL user |
|
| MySQL password |
|
| Database name |
|
| Connection timeout (seconds) |
Tools
db_exe
Execute SQL and return a JSON string:
{"success": true, "row_count": 1, "truncated": false, "rows": [...]}Error response:
{"success": false, "error": "error message"}Local Development
uv sync
uv run datasource-mcp
# or
uv run python -m datasource_mcpRequires Python >= 3.11.
Available Tools
1 tooldb_exeB
执行 SQL 并返回 JSON 字符串结果。
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | SQL 语句 | |
| max_rows | No | 查询最大返回行数,防止结果过大导致 MCP 超时 |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full responsibility for disclosing behavioral traits. It mentions only that it returns JSON, but doesn't disclose potential side effects (e.g., whether writes are possible), security implications, error behavior, or timeout handling. The max_rows parameter hints at timeout concerns, but the description fails to explain this context.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence, extremely concise and front-loaded. It contains no redundant information and every word contributes to the core meaning. This is an ideal size for such a clear-cut tool.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Executing arbitrary SQL is a high-complexity operation with significant potential for side effects and errors. Despite having an output schema (not provided in context), the description lacks crucial information like whether DDL/DML are allowed, read-only vs. write support, authentication requirements, or how errors are returned. The minimal description is inadequate for the risk level.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, with both parameters having descriptions in the schema. The tool description adds no additional meaning beyond what the schema already provides. Baseline 3 is appropriate because the schema does the heavy lifting.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action (execute SQL) and the output format (JSON string). It uses a specific verb and resource, making the tool's function unambiguous. With no sibling tools provided, distinction isn't necessary, so it satisfies the 5-level criterion.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives, nor any context about appropriate use cases. It merely states what it does, leaving the agent to infer usage. There is no mention of exclusions, prerequisites, or recommended scenarios.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
1 tool update
v0.1.0- First observed
db_exe
TDQS
With only one tool, there is no ambiguity in tool selection. The tool's description clearly states it executes SQL and returns JSON.
A single tool name, db_exe, follows snake_case and is understandable, but it lacks a clear verb_noun pattern. However, consistency is not an issue with only one tool.
The server has only one tool, which is too few for a datasource MCP server. Its apparent scope would typically require multiple tools for connection management, schema inspection, and querying.
The tool surface is severely limited; it only executes SQL. There are no tools to list tables, describe schemas, or manage data sources, causing significant gaps for agents.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
- mcpOAuthcom.gibsonai
GibsonAI MCP server: manage your databases with natural language
MCP server unifying ERPs, CRMs, APIs and knowledge base for Claude, ChatGPT and Gemini.
Query your warehouse or a CSV with Claude/ChatGPT over MCP, governed by table-level ACL + audit.
Cloud-hosted MCP server for secure AI access to enterprise data sources via CData Connect AI.
Related MCP Servers
- AlicenseBqualityDmaintenanceMCP server that allows Claude AI to interact directly with MySQL databases, enabling query execution and table information retrieval through natural language.154MIT
- AlicenseNot gradedqualityDmaintenanceA MySQL MCP server for secure database interaction, enabling schema inspection, query execution, and RBAC via AI coding assistants.1,0815MIT
- AlicenseNot gradedqualityCmaintenanceMCP server that connects AI agents to MySQL databases for schema exploration, data querying, and SQL execution via natural language.2MIT
- AlicenseNot gradedqualityDmaintenanceA production-ready MCP server for MySQL database integration with AI agents, enabling database exploration, CRUD operations, schema management, and performance monitoring through natural language.285MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/wangguoxi0814/datasource-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server