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.

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.

TDQS

A4.2/5.0
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

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

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

  • An MCP server that provides read access to your cloud storage providers, bank accounts and more.

  • The Grafbase MCP server sits in front of a GraphQL API and exposes an MCP protocol-compliant interface that allows AI agents and LLMs to explore and query GraphQL APIs using natural language. It provides tools to search schemas, introspect types and fields, and execute GraphQL queries while minimizing context bloat by returning only relevant schema subsets, with built-in support for authentication, authorization, and configurable access control.

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.
    454
    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,081
    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.
    34
    MIT
  • A
    license
    A
    quality
    C
    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

Latest Blog Posts

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/nhs-ayamura/mcp-local-mysql'

If you have feedback or need assistance with the MCP directory API, please join our Discord server