Skip to main content
Glama

MCP-сервер local-mysql

Это MCP-сервер для локальной разработки, который предоставляет доступ к базам данных MySQL для VSCode (и Copilot CLI). Он предоставляет два инструмента: query (только для SELECT) и execute (только для INSERT / UPDATE).

Этот сервер предназначен исключительно для локальной разработки. Не развертывайте его в производственной среде и не подключайте к рабочим базам данных.

Настройки подключения

Значения по умолчанию соответствуют src/main/resources/application.yml.

Параметр

По умолчанию

Переопределение через переменную окружения

host

localhost

FO_DB_HOST

port

3306

FO_DB_PORT

user

root

FO_DB_USER

password

admin

FO_DB_PASS

Пул соединений не зависит от схемы и не привязан к базе данных по умолчанию. Указывайте схему в параметре schema при каждом вызове или используйте полное имя, например oa.t_xxx. Разрешенные схемы: fo, oa, bo, cm, nepro.

Related MCP server: MySQL MCP Server

Установка и сборка

cd mcp-server
npm install
npm run build

После сборки перезапустите MCP-клиент (VSCode / Copilot CLI), чтобы перечитать настройки.

Если вы хотите вести итеративную разработку без пересборки:

npm run dev

Инструменты

query — SELECT только для чтения

{
  "sql": "SELECT id, name FROM m_article WHERE id = ?",
  "params": [123],
  "schema": "fo"          // 省略可
}

Возвращаемое значение:

{
  "schema": "fo",
  "rowCount": 1,
  "truncated": false,
  "maxRows": 1000,
  "fields": [{ "name": "id", "type": 3 }, { "name": "name", "type": 253 }],
  "rows": [{ "id": 123, "name": "..." }]
}

Ограничения:

  • Только один оператор (несколько операторов отклоняются)

  • Должен начинаться с SELECT (в v1 CTE / WITH не поддерживаются)

  • Лимит результатов: 1000 строк. Если truncated: true, это означает, что существуют дополнительные строки

execute — INSERT или UPDATE

{
  "sql": "UPDATE m_article SET name = ? WHERE id = ?",
  "params": ["new name", 123],
  "schema": "fo"
}

Возвращаемое значение:

{
  "schema": "fo",
  "affectedRows": 1,
  "insertId": 0,
  "changedRows": 1,
  "warningStatus": 0
}

Ограничения:

  • Только один оператор

  • Должен начинаться с INSERT или UPDATE

  • DELETE, DROP, ALTER, CREATE, TRUNCATE, RENAME, GRANT, REVOKE, REPLACE, MERGE, CALL, LOAD, HANDLER, LOCK, UNLOCK, SET, USE, START, BEGIN, COMMIT, ROLLBACK, SAVEPOINT — все отклоняются

Интеграция

Клонируйте этот репозиторий рядом с проектом, который будет использовать сервер, и создайте следующую структуру каталогов:

parent/
├── mcp-local-mysql/        ← このリポジトリ
└── your-project/
    └── .vscode/mcp.json    (Copilot CLI の場合は .mcp.json)

VSCode

Добавьте .vscode/mcp.json в корень проекта. Корневой ключ — servers:

{
  "servers": {
    "local-mysql": {
      "command": "node",
      "args": ["../mcp-local-mysql/dist/index.js"],
      "env": {}
    }
  }
}

Если вы хотите переопределить учетные данные для каждого рабочего пространства, отредактируйте объект env. Например:

"env": { "FO_DB_USER": "devuser", "FO_DB_PASS": "devpass" }

Также убедитесь, что обнаружение MCP включено в .vscode/settings.json, чтобы VSCode мог распознать .vscode/mcp.json:

{
  "chat.mcp.discovery.enabled": true
}

Copilot CLI

Добавьте .mcp.json в корень проекта. Корневой ключ — mcpServers:

{
  "mcpServers": {
    "local-mysql": {
      "command": "node",
      "args": ["../mcp-local-mysql/dist/index.js"],
      "env": {}
    }
  }
}

Примечания по безопасности

  • На уровне драйвера установлено multipleStatements: false (эшелонированная защита, добавленная в валидатор)

  • Все запросы параметризованы — значения должны передаваться через params, не вставляйте их напрямую в SQL-строку

  • Имена схем сверяются с белым списком перед вставкой в USE `...`

  • Логи сервера выводятся только в stderr. stdout зарезервирован исключительно для фреймов протокола MCP

Available Tools

2 tools
executeA

Run a single INSERT or UPDATE statement against the local FO MySQL database. DELETE, DDL (CREATE/ALTER/DROP/TRUNCATE), and all other statement types are rejected. Use the schema parameter or fully-qualified table names. Use ? placeholders and pass values via the params array. Returns affectedRows and insertId.

ParametersJSON Schema
NameRequiredDescriptionDefault
sqlYesA single INSERT or UPDATE statement using ? placeholders.
paramsNoPositional parameters bound to ? placeholders.
schemaNoOptional default schema for unqualified table names.

TDQS

A4.6/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden and does well by disclosing critical behavioral traits: it specifies allowed statement types (INSERT/UPDATE), rejected statement types (DELETE/DDL), return values (affectedRows and insertId), and operational constraints (single statement, local database). It doesn't mention authentication needs, rate limits, or error handling, but covers the essential mutation behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is perfectly front-loaded with the core purpose in the first sentence, followed by specific constraints and implementation details. Every sentence earns its place by providing essential information about allowed operations, parameter usage, and return values without any redundancy or wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with no annotations and no output schema, the description does an excellent job covering purpose, constraints, parameter usage, and return values. It could be more complete by mentioning authentication requirements or error scenarios, but given the complexity and lack of structured fields, it provides substantial contextual information to guide proper tool usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3. The description adds meaningful context beyond the schema: it explains the relationship between sql and params parameters ('Use ? placeholders and pass values via the `params` array'), clarifies the purpose of the schema parameter ('Use the `schema` parameter or fully-qualified table names'), and provides implementation guidance that helps understand how parameters work together.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Run a single INSERT or UPDATE statement'), the target resource ('against the local FO MySQL database'), and distinguishes from the sibling tool 'query' by specifying allowed statement types. It provides precise verb+resource+scope differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly states when to use this tool (for INSERT/UPDATE statements) and when not to use it (DELETE, DDL, and other statement types are rejected). It also provides clear alternatives by mentioning the sibling tool 'query' implicitly through contrast, and gives specific implementation guidance about schema usage and parameter binding.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

queryA

Run a read-only SELECT query against the local FO MySQL database. Only single SELECT statements are allowed; INSERT, UPDATE, DELETE, and DDL are rejected. Use the schema parameter to choose which database to run against (fo, oa, bo, cm, nepro), or use fully-qualified table names like oa.some_table. Results are capped at 1000 rows. Pass parameters via the params array using ? placeholders. CTEs (WITH ... SELECT) are not supported in v1.

ParametersJSON Schema
NameRequiredDescriptionDefault
sqlYesA single SELECT statement using ? placeholders for parameters.
paramsNoPositional parameters bound to ? placeholders.
schemaNoOptional default schema for unqualified table names.

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Since no annotations are provided, the description carries the full burden of behavioral disclosure. It effectively describes key behavioral traits: the read-only nature, query type restrictions, row capping at 1000, parameter binding method, schema selection options, and CTE limitations. However, it doesn't mention error handling, performance characteristics, or authentication requirements, leaving some gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is efficiently structured with four sentences that each add critical information: purpose and restrictions, schema usage, result capping, and parameter/CTE details. There's no wasted text, and the most important constraints (read-only, SELECT-only) are front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a query tool with 3 parameters, 100% schema coverage, and no output schema, the description provides good context about behavioral constraints and usage patterns. It covers the essential 'what happens when invoked' aspects but doesn't describe the return format or error responses, which would be helpful given the lack of output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 100% schema description coverage, the input schema already documents all three parameters thoroughly. The description adds some context about the schema parameter ('choose which database to run against') and params array ('Pass parameters via the `params` array using ? placeholders'), but doesn't provide significant additional semantic value beyond what's in the schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Run a read-only SELECT query') and resource ('against the local FO MySQL database'), making the purpose specific and unambiguous. It distinguishes from the sibling tool 'execute' by explicitly stating this is for read-only SELECT queries only, not for other SQL operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance on when to use this tool ('Only single SELECT statements are allowed') and when not to use it ('INSERT, UPDATE, DELETE, and DDL are rejected'). It also mentions an alternative approach ('use fully-qualified table names') and specifies version limitations ('CTEs are not supported in v1'), giving comprehensive usage context.

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.

  1. 2 tool updatesv0.1.0
    • First observedexecute
    • First observedquery

TDQS

A4.2/5.0

Scored across 2 tools

Disambiguation5/5

The two tools have clearly distinct purposes: 'execute' handles write operations (INSERT/UPDATE only), while 'query' handles read operations (SELECT only). Their descriptions explicitly define non-overlapping scopes with specific allowed statement types, leaving no ambiguity for an agent to misselect between them.

Naming Consistency5/5

Both tools follow a consistent, simple verb-based naming pattern ('execute' and 'query') that clearly indicates their action-oriented functions. The naming is uniform without any mixing of conventions, making it predictable and easy to understand at a glance.

Tool Count2/5

With only two tools, this server feels severely under-scoped for a MySQL database interface. While the tools cover basic read and limited write operations, the lack of tools for schema management, data definition, or broader CRUD operations (e.g., DELETE, CREATE TABLE) makes it incomplete for typical database workflows, suggesting the count is too low for the domain.

Completeness2/5

The tool surface has significant gaps for a MySQL server. It only supports SELECT, INSERT, and UPDATE, missing essential operations like DELETE, DDL (CREATE/ALTER/DROP), and other CRUD lifecycle functions. This will likely cause agent failures when trying to perform common database tasks, as the coverage is severely incomplete for the implied domain.

Maintenance

ActivityInactive
ResponsivenessSyncing

Related MCP Connectors

  • Draxlr's remote MCP server connects AI assistants to your SQL databases and dashboards. Explore schemas, run read-only queries, manage saved queries and dashboards, and export results, all with row-level security so each user sees only their own data.

  • 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.

  • Text-to-SQL MCP server: read-only queries on PostgreSQL, MySQL and SQL Server with your real schema

  • The HubSpot MCP Server acts as a bridge that enables AI assistants and Large Language Models to securely interact with HubSpot CRM data through natural conversation, without requiring users to understand complex API structures. It provides read-only access to standard CRM objects (contacts, companies, deals, tickets, products, invoices, and more) and their associations, secured via OAuth 2.0, allowing AI agents to perform tasks like summarizing deals, fetching company updates, and looking up record changes.

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    A Model Context Protocol server that provides secure, multi-database MySQL access with configurable security levels, enabling SQL queries across multiple databases directly from VS Code.
    684 npm
    1
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    A MySQL MCP server for secure database interaction, enabling schema inspection, query execution, and RBAC via AI coding assistants.
    1,075 npm
    5
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    A read-only MCP server that enables Claude Code to access MySQL databases, allowing safe querying with SELECT, SHOW, DESCRIBE, and EXPLAIN.
    15 npm
    MIT
  • A
    license
    A
    quality
    D
    maintenance
    A read-only MCP server that provides AI coding tools with database schema structure (tables, columns, keys, relationships) without exposing row data.
    3
    Apache 2.0