Skip to main content
Glama

@longlonga/mysql

A Model Context Protocol (MCP) server for interacting with MySQL databases. Provides tools for querying, inspecting, and modifying MySQL databases directly from Claude.

Installation

claude mcp add --scope user mysql \
  -e MYSQL_HOST=your-host \
  -e MYSQL_PORT=3306 \
  -e MYSQL_USER=your-user \
  -e MYSQL_PASSWORD=your-password \
  -e MYSQL_DATABASE=your-database \
  -- npx -y @longlonga/mysql

Via claude_desktop_config.json

{
  "mcpServers": {
    "mysql": {
      "command": "npx",
      "args": ["-y", "@longlonga/mysql"],
      "env": {
        "MYSQL_HOST": "your-host",
        "MYSQL_PORT": "3306",
        "MYSQL_USER": "your-user",
        "MYSQL_PASSWORD": "your-password",
        "MYSQL_DATABASE": "your-database"
      }
    }
  }
}

Related MCP server: MCP MySQL App

Configuration

Environment Variable

Required

Default

Description

MYSQL_HOST

Yes

MySQL server hostname or IP

MYSQL_PORT

No

3306

MySQL server port

MYSQL_USER

Yes

MySQL username

MYSQL_PASSWORD

Yes

MySQL password

MYSQL_DATABASE

No

Default database (can be overridden per tool call)

Tools

Tool

Description

mysql_list_databases

List all databases the user has access to

mysql_list_tables

List all tables in a database

mysql_describe_table

Get column definitions for a table

mysql_show_create_table

Get the full CREATE TABLE DDL statement

mysql_query

Execute a read-only SELECT/SHOW/EXPLAIN query

mysql_execute

Execute a write SQL statement (INSERT/UPDATE/DELETE/DDL)

mysql_table_stats

Get row count and size statistics for tables

Usage Examples

Once connected, you can ask Claude things like:

  • "List all tables in my database"

  • "Describe the structure of the users table"

  • "Query the last 10 orders"

  • "How many rows are in each table?"

License

MIT

Available Tools

7 tools
mysql_describe_tableDescribe Table StructureA
Read-onlyIdempotent

Get column definitions for a MySQL table (equivalent to DESCRIBE or SHOW COLUMNS).

Args:

  • table (string, required): Table name

  • database (string, optional): Database name. Uses MYSQL_DATABASE if omitted.

  • response_format ('markdown' | 'json'): Output format (default: 'markdown')

Returns column info: Field, Type, Null, Key, Default, Extra

ParametersJSON Schema
NameRequiredDescriptionDefault
tableYesTable name to describe
databaseNoDatabase name (uses MYSQL_DATABASE env var if omitted)
response_formatNoOutput format: 'markdown' or 'json'markdown

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already provide readOnlyHint, destructiveHint, idempotentHint, openWorldHint. Description adds return column fields, output format options, and database fallback behavior, giving useful context beyond annotations.

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?

Three sentences plus a list of return columns, front-loaded with purpose. Every sentence is essential and no fluff.

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

Completeness5/5

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

Given comprehensive annotations, full parameter documentation, and clear return information, the description is complete for a read-only introspection tool.

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

Parameters5/5

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

Schema coverage is 100%, but description adds meaning by explaining the database parameter's env var fallback, response_format default, and lists return columns. Each parameter is clearly described.

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?

Description clearly states 'Get column definitions for a MySQL table' and equates to DESCRIBE/SHOW COLUMNS, distinguishing it from siblings like mysql_show_create_table (which shows CREATE TABLE) and mysql_table_stats (statistics).

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

Usage Guidelines3/5

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

Description explains parameters and default behavior for database, but does not explicitly mention when to use this tool vs alternatives. Usage is implied but not contrasted with sibling tools.

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

mysql_executeExecute Write SQLA
Destructive

Execute a write SQL statement (INSERT, UPDATE, DELETE, DDL).

WARNING: This tool modifies data. Use with caution.

Args:

  • sql (string, required): SQL statement. Use ? placeholders for parameters.

  • params (array, optional): Bind parameters corresponding to ? placeholders.

  • database (string, optional): Database name. Uses MYSQL_DATABASE if omitted.

Returns: { affectedRows: number, insertId: number, changedRows: number }

Examples:

  • sql: "UPDATE biz_exhaust_hy SET DELETE_FLAG = 'DELETED' WHERE ID = ?", params: [123]

  • sql: "INSERT INTO my_table (name) VALUES (?)", params: ["test"]

ParametersJSON Schema
NameRequiredDescriptionDefault
sqlYesWrite SQL statement. Use ? for bind parameters.
paramsNoBind parameters for ? placeholders
databaseNoDatabase name (uses MYSQL_DATABASE env var if omitted)

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already mark destructiveHint=true and readOnlyHint=false. The description adds a clear warning, return format details (affectedRows, insertId, changedRows), and examples. This fully discloses behavioral traits beyond annotations.

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 concise with a clear structure: purpose line, warning, args, returns, and examples. No superfluous text; every element adds value.

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

Completeness5/5

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

No output schema exists, so the description must explain return values. It does so with the exact return object shape and concrete examples. Combined with annotations and input schema, the description is fully adequate for the tool's complexity.

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

Parameters5/5

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

Schema coverage is 100%. The description adds usage semantics: using ? placeholders, optional bind params, and database fallback to env variable. This provides meaning beyond the schema's property 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 explicitly states 'Execute a write SQL statement (INSERT, UPDATE, DELETE, DDL).' The verb 'Execute' and resource 'write SQL statement' are clear, and listing specific SQL types distinguishes it from read-only sibling tools like mysql_query.

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

Usage Guidelines4/5

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

The description warns 'This tool modifies data. Use with caution.' and implicitly separates its write-only purpose from read siblings. However, it lacks explicit guidance on when not to use or direct alternatives, so it's not a full 5.

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

mysql_list_databasesList MySQL DatabasesA
Read-onlyIdempotent

List all databases on the MySQL server.

Returns database names the current user has access to.

Returns:

  • markdown: formatted list

  • json: { databases: string[] }

ParametersJSON Schema
NameRequiredDescriptionDefault
response_formatNoOutput format: 'markdown' or 'json'markdown

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare readOnly, destructive, and idempotent hints. The description adds behavioral context by specifying that only databases the user has access to are returned and detailing output formats, which is valuable beyond the annotations.

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 extremely concise with three short lines, each providing essential information without redundancy. It is front-loaded with the primary purpose.

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

Completeness5/5

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

Given the tool's simplicity (one optional parameter, no output schema), the description sufficiently covers functionality, access scope, and return types, leaving no significant gaps.

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 coverage is 100% with the 'response_format' parameter fully described. The description links the parameter to output formats and shows example return structures, adding concrete meaning beyond the enum definition.

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 tool lists all databases on the MySQL server, specifically those the current user has access to, which distinguishes it from sibling tools focused on tables or queries.

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

Usage Guidelines3/5

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

While the tool's purpose is clear, there is no explicit guidance on when to use this tool versus alternatives like mysql_list_tables, nor any when-not or exclusion criteria.

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

mysql_list_tablesList Tables in DatabaseA
Read-onlyIdempotent

List all tables in a MySQL database.

Args:

  • database (string, optional): Database name. Uses MYSQL_DATABASE if omitted.

  • response_format ('markdown' | 'json'): Output format (default: 'markdown')

Returns:

  • markdown: formatted table list

  • json: { database: string, tables: string[], count: number }

ParametersJSON Schema
NameRequiredDescriptionDefault
databaseNoDatabase name (uses MYSQL_DATABASE env var if omitted)
response_formatNoOutput format: 'markdown' or 'json'markdown

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already confirm read-only, non-destructive, idempotent behavior. The description adds context about optional database with env var fallback and return format details, which enrich transparency beyond annotations.

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 concise with two sentences and a structured args/returns list, front-loading the purpose with no 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?

The description covers purpose, parameters, and return format well for a simple tool. Lacks guidance on when to use alternatives, but otherwise complete given annotations and schema.

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 coverage is 100%, but description adds value by specifying the return structure for both markdown and json formats, which is not present in the schema (no output schema).

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 'List all tables in a MySQL database,' using a specific verb and resource that distinguishes it from sibling tools like mysql_describe_table or mysql_query.

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

Usage Guidelines3/5

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

The description implies usage for listing tables but does not explicitly state when to use this tool versus alternatives, such as when to use mysql_describe_table for details.

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

mysql_queryExecute SELECT QueryA
Read-only

Execute a read-only SELECT query against MySQL.

Only SELECT and SHOW/EXPLAIN statements are permitted. Use mysql_execute for write operations.

Args:

  • sql (string, required): SQL SELECT statement. Use ? placeholders for params.

  • params (array, optional): Bind parameters corresponding to ? placeholders.

  • database (string, optional): Database name. Uses MYSQL_DATABASE if omitted.

  • limit (number, optional): Max rows to return (default: 100, max: 1000).

  • response_format ('markdown' | 'json'): Output format (default: 'json')

Returns:

  • json: { rows: object[], count: number, has_more: boolean }

  • markdown: formatted table

Examples:

  • sql: "SELECT * FROM biz_exhaust_yg WHERE jcrq = ? LIMIT 10", params: ["2026-03"]

  • sql: "SELECT COUNT(*) as cnt FROM biz_exhaust_hy"

ParametersJSON Schema
NameRequiredDescriptionDefault
sqlYesSELECT SQL statement. Use ? for bind parameters.
paramsNoBind parameters for ? placeholders
databaseNoDatabase name (uses MYSQL_DATABASE env var if omitted)
limitNoMaximum rows to return (default 100)
response_formatNoOutput format: 'markdown' or 'json'json

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already set readOnlyHint=true and destructiveHint=false. Description adds behavioral details: only SELECT/SHOW/EXPLAIN allowed, limit defaults (100, max 1000), optional database fallback, response formats (json/markdown) with has_more flag. No contradictions.

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?

Structured into clear sections (purpose, args, returns, examples). Each sentence is informative with no redundancy. Efficiently covers all necessary information.

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

Completeness5/5

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

Thoroughly covers all 5 parameters, return formats, and edge cases (defaults, optional params). Includes examples. No output schema needed as returns are described. Complete for a read-only query tool.

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 coverage is 100% with good descriptions. Description adds examples of ? placeholders, clarifies bind parameters, and notes default database from env var. Adds value beyond schema.

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?

Clearly states 'Execute a read-only SELECT query against MySQL' and explicitly lists permitted statements (SELECT, SHOW, EXPLAIN). Differentiates from sibling mysql_execute for write operations.

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

Usage Guidelines4/5

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

Provides explicit guidance: 'Use mysql_execute for write operations.' Includes parameter roles, defaults, and examples. Lacks explicit mention of when to use other siblings like mysql_describe_table, but the distinction is clear.

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

mysql_show_create_tableShow CREATE TABLE StatementA
Read-onlyIdempotent

Get the full CREATE TABLE DDL statement for a table.

Args:

  • table (string, required): Table name

  • database (string, optional): Database name. Uses MYSQL_DATABASE if omitted.

Returns the complete CREATE TABLE SQL with all indexes, constraints, and engine settings.

ParametersJSON Schema
NameRequiredDescriptionDefault
tableYesTable name
databaseNoDatabase name (uses MYSQL_DATABASE env var if omitted)

TDQS

A3.7/5.0
Behavior4/5

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

Annotations already indicate readOnlyHint, destructiveHint, and idempotentHint. The description adds useful context about the output (indexes, constraints, engine settings) and the default database fallback from environment variable, which is beyond the annotations.

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

Conciseness4/5

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

The description is concise with three sentences and a structured args list. It front-loads the purpose. Minor room for improvement in formatting (e.g., using bullet points for args in the prose).

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?

Given no output schema, the description adequately covers the return value (complete SQL). For a simple read-only tool with two parameters, it is complete enough for an agent to understand its use. Missing error handling details is acceptable.

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?

Schema coverage is 100% with descriptions for both parameters. The description repeats the parameter info but does not add new meaning beyond what the schema already provides. The env var fallback is mentioned in both places.

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

Purpose4/5

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

Clearly states the tool gets the full CREATE TABLE DDL statement, specifying the verb 'Get' and the resource. However, it does not explicitly differentiate from the sibling tool mysql_describe_table, which also provides table structure but focuses on column details rather than full DDL.

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

Usage Guidelines3/5

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

The description implies the tool is for retrieving DDL statements but offers no explicit guidance on when to use this tool versus alternatives like mysql_describe_table or when to avoid it. Usage context is only implied.

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

mysql_table_statsGet Table StatisticsA
Read-onlyIdempotent

Get row count and size statistics for tables in a database.

Args:

  • database (string, optional): Database name. Uses MYSQL_DATABASE if omitted.

  • table (string, optional): Filter to a specific table. If omitted, returns all tables.

  • response_format ('markdown' | 'json'): Output format (default: 'markdown')

Returns per table: table_name, row_count, data_size_mb, index_size_mb, engine, create_time

ParametersJSON Schema
NameRequiredDescriptionDefault
databaseNoDatabase name (uses MYSQL_DATABASE env var if omitted)
tableNoOptional: filter to a specific table name
response_formatNoOutput format: 'markdown' or 'json'markdown

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already indicate read-only, non-destructive, and idempotent behavior. The description adds behavioral details such as the default database using MYSQL_DATABASE env var and the return format with markdown/json options. No contradictions.

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 concise: three short paragraphs covering purpose, args, and returns. No extra words. Every sentence adds value.

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

Completeness5/5

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

Given the tool has 3 optional parameters and no output schema, the description completely explains all parameters and the return fields (table_name, row_count, etc.). Sibling tools are distinct; no additional context needed.

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 coverage is 100%, so baseline is 3. The description adds value by explaining defaults for database and response_format, and the effect of omitting the table parameter (returns all tables).

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 'Get row count and size statistics for tables in a database,' which is a specific verb and resource. It distinguishes from sibling tools like mysql_describe_table or mysql_query, as none of those provide statistics.

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

Usage Guidelines4/5

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

The description explains when to use the tool: to obtain table statistics. It provides context for optional parameters and defaults but does not explicitly mention alternatives or when not to use it. Sibling tool names provide implicit guidance.

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

Each tool targets a distinct operation: reading, writing, describing schema, listing databases/tables, showing DDL, and table statistics. No ambiguity between tools.

Naming Consistency4/5

All tools share the 'mysql_' prefix and mostly follow verb_noun pattern (e.g., describe_table, list_databases). However, 'mysql_execute' and 'mysql_query' are verb-only, which slightly deviates from the pattern.

Tool Count5/5

With 7 tools, the server covers essential MySQL interactions without being bloated. Each tool serves a clear purpose, making it easy for an agent to navigate.

Completeness4/5

The set covers core CRUD, schema inspection, and metadata retrieval. DDL operations are handled via mysql_execute, so no major gaps are present. Minor missing features like server version are not critical.

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

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    A Model Context Protocol (MCP) server that enables AI assistants to interact with MySQL databases by executing SQL queries and checking database connectivity.
    MIT
  • A
    license
    B
    quality
    D
    maintenance
    A Model Context Protocol server that enables AI models to interact with MySQL databases, providing tools for querying, executing statements, listing tables, and describing table structures.
    5
    342
    MIT
  • F
    license
    B
    quality
    D
    maintenance
    A Model Context Protocol server that enables AI models to interact with MySQL databases through a standardized interface, providing tools for querying, executing commands, and managing database schemas.
    7

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/donald-ada/mysql'

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