local-mysql
local-mysql MCP-Server
Ein MCP-Server für die lokale Entwicklung, der FO MySQL-Datenbanken für VSCode (und die Copilot CLI) bereitstellt. Er bietet zwei Tools: query (nur für SELECT) und execute (nur für INSERT / UPDATE).
Dieser Server ist ausschließlich für die lokale Entwicklung bestimmt. Bitte nicht in Produktionsumgebungen bereitstellen oder mit Produktionsdatenbanken verbinden.
Verbindungseinstellungen
Die Standardwerte entsprechen denen in src/main/resources/application.yml.
Element | Standard | Überschreiben per Umgebungsvariable |
host |
|
|
port |
|
|
user |
|
|
password |
|
|
Der Verbindungspool ist schema-unabhängig und nicht an eine Standarddatenbank gebunden. Geben Sie das Schema bei jedem Aufruf über den Parameter schema an oder verwenden Sie vollqualifizierte Namen wie oa.t_xxx. Zulässige Schemata: fo, oa, bo, cm, nepro.
Related MCP server: MySQL MCP Server
Installation und Build
cd mcp-server
npm install
npm run buildStarten Sie nach dem Build den MCP-Client (VSCode / Copilot CLI) neu, um die Konfiguration neu zu laden.
Für iterative Entwicklung ohne erneuten Build:
npm run devTools
query — Schreibgeschütztes SELECT
{
"sql": "SELECT id, name FROM m_article WHERE id = ?",
"params": [123],
"schema": "fo" // 省略可
}Rückgabewert:
{
"schema": "fo",
"rowCount": 1,
"truncated": false,
"maxRows": 1000,
"fields": [{ "name": "id", "type": 3 }, { "name": "name", "type": 253 }],
"rows": [{ "id": 123, "name": "..." }]
}Einschränkungen:
Nur einzelne Statements (mehrere Statements werden abgelehnt)
Muss mit
SELECTbeginnen (in v1 werden CTE /WITHnicht unterstützt)Ergebnislimit: 1000 Zeilen. Wenn
truncated: truegesetzt ist, bedeutet dies, dass weitere Zeilen vorhanden sind.
execute — INSERT oder UPDATE
{
"sql": "UPDATE m_article SET name = ? WHERE id = ?",
"params": ["new name", 123],
"schema": "fo"
}Rückgabewert:
{
"schema": "fo",
"affectedRows": 1,
"insertId": 0,
"changedRows": 1,
"warningStatus": 0
}Einschränkungen:
Nur einzelne Statements
Muss mit
INSERToderUPDATEbeginnenDELETE,DROP,ALTER,CREATE,TRUNCATE,RENAME,GRANT,REVOKE,REPLACE,MERGE,CALL,LOAD,HANDLER,LOCK,UNLOCK,SET,USE,START,BEGIN,COMMIT,ROLLBACK,SAVEPOINT— alle werden abgelehnt
Einbindung
Klonen Sie dieses Repository parallel zu dem Projekt, das diesen Server verwendet, und stellen Sie die folgende Verzeichnisstruktur sicher:
parent/
├── mcp-local-mysql/ ← このリポジトリ
└── your-project/
└── .vscode/mcp.json (Copilot CLI の場合は .mcp.json)VSCode
Fügen Sie .vscode/mcp.json im Stammverzeichnis des Projekts hinzu. Der Root-Key ist servers:
{
"servers": {
"local-mysql": {
"command": "node",
"args": ["../mcp-local-mysql/dist/index.js"],
"env": {}
}
}
}Wenn Sie die Anmeldedaten pro Arbeitsbereich überschreiben möchten, bearbeiten Sie das env-Objekt. Beispiel:
"env": { "FO_DB_USER": "devuser", "FO_DB_PASS": "devpass" }Stellen Sie außerdem sicher, dass die MCP-Erkennung in .vscode/settings.json aktiviert ist, damit VSCode .vscode/mcp.json erkennt:
{
"chat.mcp.discovery.enabled": true
}Copilot CLI
Fügen Sie .mcp.json im Stammverzeichnis des Projekts hinzu. Der Root-Key ist mcpServers:
{
"mcpServers": {
"local-mysql": {
"command": "node",
"args": ["../mcp-local-mysql/dist/index.js"],
"env": {}
}
}
}Sicherheitshinweise
multipleStatements: falseist auf Treiberebene konfiguriert (Defense-in-Depth zusätzlich zum Validator)Alle Abfragen sind parametrisiert — Werte müssen immer über
paramsübergeben werden und dürfen nicht direkt in den SQL-String eingebettet werdenSchemanamen werden gegen eine Whitelist geprüft, bevor sie in
USE `...`eingebettet werdenServer-Logs werden nur nach stderr ausgegeben. stdout ist ausschließlich für das MCP-Protokoll reserviert
Available Tools
2 toolsexecuteA
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.
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | A single INSERT or UPDATE statement using ? placeholders. | |
| params | No | Positional parameters bound to ? placeholders. | |
| schema | No | Optional default schema for unqualified table names. |
TDQS
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.
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.
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.
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.
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.
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.
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | A single SELECT statement using ? placeholders for parameters. | |
| params | No | Positional parameters bound to ? placeholders. | |
| schema | No | Optional default schema for unqualified table names. |
TDQS
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.
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.
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.
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.
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.
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.
2 tool updates
v0.1.0- First observed
execute - First observed
query
TDQS
Scored across 2 tools
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.
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.
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.
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
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
- AlicenseNot gradedqualityDmaintenanceA 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 npm1MIT
- AlicenseNot gradedqualityDmaintenanceA MySQL MCP server for secure database interaction, enabling schema inspection, query execution, and RBAC via AI coding assistants.1,075 npm5MIT
- AlicenseNot gradedqualityDmaintenanceA read-only MCP server that enables Claude Code to access MySQL databases, allowing safe querying with SELECT, SHOW, DESCRIBE, and EXPLAIN.15 npmMIT
- AlicenseAqualityDmaintenanceA read-only MCP server that provides AI coding tools with database schema structure (tables, columns, keys, relationships) without exposing row data.3Apache 2.0