MCP SQL Server
MCP SQL Server (Разработка)
Профессиональный MCP-сервер для подключения любой совместимой с MCP LLM к базе данных SQL и выполнения:
Запросов (
SELECT,WITH,SHOWи т. д.)DML (
INSERT,UPDATE,DELETE)DDL (
CREATE,ALTERи опциональноDROP/TRUNCATE)
Этот сервер предназначен для личного использования при разработке с поддержкой ИИ.
Возможности
Протокол MCP через stdio (совместим с MCP-клиентами).
Подключение к нескольким движкам через
SQLAlchemy(sqlite,postgresql,mysql,mssqlи т. д.).Инструменты MCP, ориентированные на повседневные операции:
sql_capabilitiessql_list_tablessql_describe_tablesql_runsql_run_script
Блокировка деструктивных DDL по умолчанию (
DROP/TRUNCATEзаблокированы).Настраиваемый лимит строк и операторов в скрипте.
Related MCP server: FastMCP MySQL Server
Установка
python -m venv .venv
source .venv/bin/activate
pip install -e .Конфигурация (переменные окружения)
Префикс: MCP_SQL_
MCP_SQL_DATABASE_URL: URL SQLAlchemy. По умолчанию:sqlite:///./dev.dbMCP_SQL_MAX_ROWS: максимальное количество строк, возвращаемых запросом. По умолчанию:200MCP_SQL_MAX_SCRIPT_STATEMENTS: максимальное количество операторов в скрипте. По умолчанию:100MCP_SQL_ALLOW_DESTRUCTIVE_DDL:true/falseдля разрешенияDROPиTRUNCATE. По умолчанию:false
Пример
export MCP_SQL_DATABASE_URL='postgresql+psycopg://dev_user:dev_pass@localhost:5432/devdb'
export MCP_SQL_MAX_ROWS=500
export MCP_SQL_ALLOW_DESTRUCTIVE_DDL=falseЗапуск сервера
mcp-sql-serverТакже можно запустить его как модуль:
python -m mcp_sql_server.serverЗапуск двойным кликом в Windows
Включен файл start_mcp_sql_server.bat для упрощения запуска:
Автоматически создает
.venv(если он не существует).Устанавливает/обновляет зависимости.
Запускает MCP-сервер.
Просто дважды кликните по этому .bat файлу.
Конфигурация в MCP-клиенте (общий пример)
{
"mcpServers": {
"sql-dev": {
"command": "mcp-sql-server",
"env": {
"MCP_SQL_DATABASE_URL": "sqlite:///./dev.db",
"MCP_SQL_MAX_ROWS": "200",
"MCP_SQL_ALLOW_DESTRUCTIVE_DDL": "false"
}
}
}
}Рекомендуемый рабочий процесс
sql_capabilitiesдля проверки активной конфигурации.sql_list_tablesдля изучения схемы.sql_describe_tableдля проверки метаданных.sql_runдля запросов или точечных DML-операций.sql_run_scriptдля пакетов контролируемых изменений.
Рекомендации для разработки с поддержкой ИИ
Используйте пользователей базы данных с минимальными привилегиями.
Работайте с локальной базой данных разработки или временным снимком (snapshot).
Держите
MCP_SQL_ALLOW_DESTRUCTIVE_DDL=falseпо умолчанию.Версионируйте структурные изменения с помощью миграций.
Примечание по безопасности
Этот проект не предназначен для промышленной эксплуатации. Он ориентирован на локальную продуктивность в средах разработки.
Руководство для Claude в VS Code
Ознакомьтесь с README_CLAUDE_VSCODE.md для получения полного примера настройки и использования.
Available Tools
5 toolssql_capabilitiesB
Describe la configuración activa y operaciones soportadas.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool describes configuration and operations, implying a read-only, informational function, but doesn't specify details like whether it requires authentication, returns structured data, or has any side effects. For a tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.
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, concise sentence in Spanish: 'Describe la configuración activa y operaciones soportadas.' It is front-loaded with the core purpose and wastes no words, making it efficient and easy to parse. Every part of the sentence contributes to understanding the tool's function.
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?
Given the tool's complexity (0 parameters, no annotations, but with an output schema), the description is minimally adequate. It explains what the tool does but lacks details on usage context, behavioral traits, or how it differs from siblings. The presence of an output schema means the description doesn't need to explain return values, but overall, it's incomplete for effective agent use without additional context.
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?
The tool has 0 parameters, and the schema description coverage is 100% (since there are no parameters to describe). In such cases, the baseline score is 4, as there's no need for the description to compensate for missing parameter information. The description doesn't add parameter semantics, but that's acceptable given the lack of parameters.
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 tool's purpose: 'Describe la configuración activa y operaciones soportadas' (Describe active configuration and supported operations). It uses a specific verb ('describe') and identifies the resource ('active configuration and supported operations'), making the purpose understandable. However, it doesn't explicitly differentiate from sibling tools like sql_describe_table or sql_list_tables, which prevents a perfect score.
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. There are multiple sibling SQL tools (sql_describe_table, sql_list_tables, sql_run, sql_run_script), but the description doesn't indicate when sql_capabilities is appropriate compared to these other tools. No context or exclusions are mentioned.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
sql_describe_tableB
Describe columnas, PK, FK e índices de una tabla.
| Name | Required | Description | Default |
|---|---|---|---|
| table_name | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. It describes what the tool does but lacks critical details: it doesn't specify if this is a read-only operation, what permissions are required, how errors are handled, or the format of the output. For a metadata query tool with zero annotation coverage, this is a significant gap in transparency.
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, efficient sentence in Spanish that directly states the tool's function without unnecessary words. It's front-loaded with the core purpose, making it easy to parse quickly. Every part of the sentence earns its place by specifying what is described.
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?
Given the tool's moderate complexity (a metadata query with one parameter), no annotations, and an output schema present, the description is minimally adequate. It covers the basic purpose but lacks details on usage, behavior, and parameter nuances. The output schema mitigates the need to explain return values, but overall completeness is limited, aligning with a score of 3.
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?
The schema description coverage is 0%, meaning the input schema provides no descriptions for parameters. The description adds some value by implying the 'table_name' parameter is used to specify which table to describe, but it doesn't clarify syntax, format, or constraints. With one parameter and low schema coverage, the description partially compensates but not fully, warranting a baseline score.
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 tool's purpose: 'Describe columnas, PK, FK e índices de una tabla' (Describe columns, primary keys, foreign keys, and indexes of a table). It specifies the verb 'describe' and the resource 'table', with details about what aspects are described. However, it doesn't explicitly differentiate from sibling tools like sql_list_tables or sql_capabilities, which prevents a perfect score.
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. It doesn't mention sibling tools like sql_list_tables (for listing tables) or sql_capabilities (for broader metadata), nor does it specify prerequisites or exclusions. This leaves the agent with minimal context for tool selection.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
sql_list_tablesB
Lista tablas y vistas disponibles en el esquema actual.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden but only states the action without disclosing behavioral traits like permissions needed, rate limits, or output format. It mentions 'esquema actual' which adds some context but is insufficient for a mutation-free tool.
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, efficient sentence in Spanish that directly states the tool's purpose without any wasted words. It is front-loaded and appropriately sized for its simplicity.
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?
Given the tool's low complexity (0 params, read-only listing), an output schema exists, and schema coverage is high, the description is minimally adequate. However, it lacks details on scope or behavior that could enhance completeness, such as what 'esquema actual' entails or how results are structured.
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?
The tool has 0 parameters, and schema description coverage is 100%, so no parameter info is needed. The description doesn't add param semantics, but with zero params, the baseline is appropriately high as there's nothing to compensate for.
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 verb ('Lista') and resource ('tablas y vistas disponibles en el esquema actual'), making the purpose understandable. However, it doesn't explicitly differentiate from sibling tools like sql_describe_table or sql_run, which prevents a score of 5.
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?
No guidance is provided on when to use this tool versus alternatives such as sql_describe_table for detailed table info or sql_run for querying. The description implies usage for listing but lacks explicit context or exclusions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
sql_runB
Ejecuta una sentencia SQL individual usando parámetros nombrados opcionales.
| Name | Required | Description | Default |
|---|---|---|---|
| statement | Yes | ||
| params | No |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It states this executes SQL statements but doesn't cover critical aspects like whether it's read-only or destructive, authentication requirements, transaction behavior, error handling, or rate limits. For a SQL execution tool, this is a significant gap in safety and operational 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, efficient sentence in Spanish that directly states the tool's function. It's front-loaded with the core purpose and includes the key detail about optional named parameters without any unnecessary words or redundancy.
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?
Given the tool's complexity (SQL execution with parameters), lack of annotations, and 0% schema description coverage, the description is incomplete. However, the presence of an output schema means the agent can infer return values from structured data, raising the baseline. The description covers the basic action but misses critical behavioral and usage context.
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 0%, so the schema provides no parameter documentation. The description adds some value by explaining that 'params' are 'parámetros nombrados opcionales' (optional named parameters), but it doesn't clarify the format of 'statement' (e.g., SQL dialect, allowed operations) or provide examples. It partially compensates but leaves key details undocumented.
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 tool's purpose: 'Ejecuta una sentencia SQL individual usando parámetros nombrados opcionales' (Executes a single SQL statement using optional named parameters). It specifies the verb ('ejecuta'), resource ('sentencia SQL'), and scope ('individual'), though it doesn't explicitly differentiate from sibling tools like sql_run_script.
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. It doesn't mention sibling tools like sql_run_script (for scripts vs. single statements) or sql_list_tables/sql_describe_table (for metadata queries), leaving the agent to guess based on tool names alone.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
sql_run_scriptA
Ejecuta múltiples sentencias SQL en secuencia; se detiene al primer error.
| Name | Required | Description | Default |
|---|---|---|---|
| script | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key behavioral traits: executes multiple statements sequentially and stops at the first error. This provides important context about transaction-like behavior and error handling that isn't captured elsewhere. However, it doesn't mention permissions, rate limits, or what happens on success.
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 extremely concise - a single sentence that communicates both the core functionality and a critical behavioral constraint. Every word earns its place, with no wasted verbiage. The structure is front-loaded with the main purpose followed by the important behavioral detail.
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?
Given the tool has an output schema (which handles return values) and only one parameter, the description provides good contextual completeness. It covers the key behavioral aspects (sequential execution, error stopping) that aren't captured in structured fields. For a single-parameter tool with output schema, this is reasonably complete, though it could mention permissions or other constraints.
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 0%, so the schema provides no parameter documentation. The description doesn't explicitly mention the 'script' parameter or explain its format, content requirements, or syntax. However, the description implies the parameter contains multiple SQL statements, which adds some semantic context beyond the bare schema.
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 tool's purpose: 'Ejecuta múltiples sentencias SQL en secuencia' (executes multiple SQL statements in sequence). It specifies the verb (execute) and resource (SQL statements) with additional detail about sequential execution. However, it doesn't explicitly differentiate from sibling tools like 'sql_run' which might handle single statements.
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 implied usage guidance through the phrase 'se detiene al primer error' (stops at the first error), suggesting this tool is appropriate for batch operations where atomic execution is desired. However, it doesn't explicitly state when to use this vs. alternatives like 'sql_run' or provide any exclusion criteria.
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.
5 tool updates
v0.1.0- First observed
sql_capabilities - First observed
sql_describe_table - First observed
sql_list_tables - First observed
sql_run - First observed
sql_run_script
TDQS
Each tool has a clearly distinct purpose: sql_capabilities provides metadata about the server, sql_describe_table describes a specific table's structure, sql_list_tables enumerates available tables/views, sql_run executes a single SQL statement, and sql_run_script handles multiple statements. There is no overlap or ambiguity between these functions.
All tool names follow a consistent snake_case pattern with a 'sql_' prefix and descriptive verb_noun combinations (e.g., sql_list_tables, sql_run_script). This uniformity makes the tool set predictable and easy to understand.
With 5 tools, the server is well-scoped for SQL operations. Each tool serves a specific, essential function in a database interaction workflow, from discovery (list_tables, describe_table) to execution (run, run_script), and configuration (capabilities). No tool feels redundant or missing.
The tool set covers core SQL operations effectively: listing and describing tables, running queries and scripts, and checking server capabilities. A minor gap is the lack of tools for schema modification (e.g., create/alter/drop tables) or transaction management, but agents can work around this using sql_run for such operations.
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
The Ramp MCP server enables users to securely connect Ramp with AI assistants like ChatGPT and Claude to query financial data and take actions using natural language. It transforms Ramp's developer API into a SQL interface that LLMs can query, allowing admins to analyze spend trends, identify cost savings, and run complex SQL analyses on comprehensive datasets (transactions, purchase orders, vendors, users), while all users can manage cards, view transactions, request reimbursements, and get expense policy answers.
The Instant MCP server is a wrapper around the Instant Platform SDK that enables creating, managing, and updating InstantDB applications directly within an editor. It provides tools for fetching rules files for LLMs, retrieving and pushing app schemas, managing permission rules, and executing database queries. Key capabilities include schema management (get-schema, push-schema), permission management (get-perms, push-perms), query execution, and listing recent query history.
The BigQuery remote MCP server is a fully managed service that uses the Model Context Protocol to connect AI applications and LLMs to BigQuery data sources. It provides secure, standardized tools for AI agents to list datasets and tables, retrieve schemas, generate and execute SQL queries through natural language, and analyze data—enabling direct access to enterprise analytics data without requiring manual SQL coding.
Related MCP Servers
- AlicenseBqualityDmaintenanceAn MCP server that connects AI assistants to Microsoft SQL Server databases, enabling schema exploration and read-only queries safely.49374MIT
- AlicenseNot gradedqualityDmaintenanceA secure and efficient MCP server for MySQL database operations, enabling LLMs to execute SQL queries with read-only access by default and optional write permissions.3MIT
- AlicenseNot gradedqualityDmaintenanceA multi-database MCP server that enables LLMs to safely interact with MySQL, PostgreSQL, SQLite, and others through a unified tool interface, with permission modes and schema resources.1665MIT
- AlicenseAqualityAmaintenanceA read-only MCP server that exposes SQL database access to LLMs, supporting multiple database types, compact columnar results, pagination, and file export.618MIT
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/miguel1603/MCP-SQL'
If you have feedback or need assistance with the MCP directory API, please join our Discord server