local-mysql
local-mysql MCP 서버
MySQL 데이터베이스를 VSCode(및 Copilot CLI)에 노출하는 로컬 개발용 MCP 서버입니다. query(SELECT 전용)와 execute(INSERT / UPDATE 전용)라는 두 가지 도구를 제공합니다.
본 서버는 로컬 개발 전용입니다. 운영 환경에 배포하거나 운영 DB에 연결하지 마십시오.
연결 설정
기본값은 src/main/resources/application.yml과 동일합니다.
항목 | 기본값 | 환경 변수로 덮어쓰기 |
host |
|
|
port |
|
|
user |
|
|
password |
|
|
커넥션 풀은 스키마 독립적이며 기본 데이터베이스에 바인딩되지 않습니다. 호출 시마다 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" }또한 VSCode가 .vscode/mcp.json을 인식할 수 있도록 .vscode/settings.json에서 MCP 검색을 활성화해 두십시오:
{
"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 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