Skip to main content
Glama

local-mysql MCP Server

This is a local development MCP server that exposes FO MySQL databases to VSCode (and Copilot CLI). It provides two tools: query (SELECT only) and execute (INSERT / UPDATE only).

This server is for local development only. Do not deploy to production environments or connect to production databases.

Connection Settings

The default values are aligned with src/main/resources/application.yml.

Item

Default

Override via Env Var

host

localhost

FO_DB_HOST

port

3306

FO_DB_PORT

user

root

FO_DB_USER

password

admin

FO_DB_PASS

The connection pool is schema-agnostic and does not bind to a default database. Specify the schema using the schema parameter for each call, or use fully qualified names like oa.t_xxx. Allowed schemas: fo, oa, bo, cm, nepro.

Related MCP server: MySQL MCP Server

Installation and Build

cd mcp-server
npm install
npm run build

After building, restart your MCP client (VSCode / Copilot CLI) to reload the configuration.

For iterative development without rebuilding:

npm run dev

Tools

query — Read-only SELECT

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

Return value:

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

Constraints:

  • Single statement only (multiple statements are rejected)

  • Must start with SELECT (CTE / WITH is not supported in v1)

  • Result limit: 1000 rows. If truncated: true, it indicates that more rows exist.

execute — INSERT or UPDATE

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

Return value:

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

Constraints:

  • Single statement only

  • Must start with INSERT or UPDATE

  • DELETE, DROP, ALTER, CREATE, TRUNCATE, RENAME, GRANT, REVOKE, REPLACE, MERGE, CALL, LOAD, HANDLER, LOCK, UNLOCK, SET, USE, START, BEGIN, COMMIT, ROLLBACK, SAVEPOINT — all rejected

Integration

Clone this repository alongside the project that will use this server, and set up the directory structure as follows:

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

VSCode

Add .vscode/mcp.json to the root of your project. The root key is servers:

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

To override credentials per workspace, edit the env object. Example:

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

Also, ensure MCP discovery is enabled in .vscode/settings.json so that VSCode recognizes .vscode/mcp.json:

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

Copilot CLI

Add .mcp.json to the root of your project. The root key is mcpServers:

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

Security Notes

  • multipleStatements: false is set at the driver level (defense-in-depth added to the validator)

  • All queries are parameterized — values must always be passed via params and never embedded directly into the SQL string

  • Schema names are matched against a whitelist before being embedded into USE `...`

  • Server logs are output only to stderr. stdout is reserved exclusively for the MCP protocol frames

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.

Inputs: sql (required), params, schema.

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.

Inputs: sql (required), params, schema.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    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.

    Related MCP Connectors

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