Skip to main content
Glama
irwantocrimson

MySQL MCP Server

MySQL MCP Server

A Model Context Protocol (MCP) server that provides MySQL database connectivity and tools.

Installation

npm install
npm run build

Related MCP server: MySQL Managing MCP

Usage

Configuration

The server can be configured using either environment variables or command-line arguments. Environment variables take precedence over command-line arguments.

Environment Variables

  • MYSQL_HOST: MySQL host (default: localhost)

  • MYSQL_PORT: MySQL port (default: 3306)

  • MYSQL_USER: MySQL user (default: root)

  • MYSQL_PASSWORD: MySQL password (default: empty)

  • MYSQL_DATABASE: MySQL database (default: test)

Command-Line Arguments

  • -h, --host: MySQL host (default: localhost)

  • -p, --port: MySQL port (default: 3306)

  • -u, --user: MySQL user (default: root)

  • -P, --password: MySQL password (default: empty)

  • -d, --database: MySQL database (default: test)

Examples

Basic usage with default settings:

crimson-mysql-mcp

Specify custom host and database:

crimson-mysql-mcp --host db.example.com --database myapp

Using short flags:

crimson-mysql-mcp -h 192.168.1.100 -u myuser -P mypass -d production

Claude Desktop Configuration

{
  "mcpServers": {
    "mysql": {
      "command": "npx",
      "args": [
        "-y",
        "crimson-mysql-mcp@1.0.2"
      ],
      "env": {
        "MYSQL_HOST": "your-mysql-host",
        "MYSQL_PORT": "3306",
        "MYSQL_USER": "your-username",
        "MYSQL_PASSWORD": "your-password",
        "MYSQL_DATABASE": "your-database"
      }
    }
  }
}

For local development:

{
  "mcpServers": {
    "mysql": {
      "command": "node",
      "args": [
        "/path/to/your/crimson-mysql-mcp/build/index.js"
      ],
      "env": {
        "MYSQL_HOST": "localhost",
        "MYSQL_USER": "root",
        "MYSQL_DATABASE": "test"
      }
    }
  }
}

Available Tools

  • get-schema: Get the schema/structure of a MySQL table

    • Parameters: schemaName (string) - The name of the table to describe

Development

# Install dependencies
npm install

# Run in development mode
npm run server:dev

# Build the project
npm run build

# Watch and rebuild on changes
npm run server:build:watch

# Run with MCP Inspector (for debugging)
npm run server:inspect

Publishing to npm

To make this package available via npx:

  1. Update the package.json with your npm account details

  2. Run:

    npm publish

License

ISC

Available Tools

1 tool
get-schemaA
Read-only

Get the schema of a table

ParametersJSON Schema
NameRequiredDescriptionDefault
schemaNameYesThe name of the schema

TDQS

A3.5/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true and destructiveHint=false, so the agent knows this is a safe read operation. The description adds no behavioral context beyond what annotations provide (e.g., no information about permissions, rate limits, or what happens if the schema doesn't exist). It doesn't contradict annotations, but offers minimal additional value.

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 a single, clear sentence with zero wasted words. It's front-loaded with the essential purpose and appropriately sized for a simple tool. Every word earns its place, making it highly efficient.

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

Completeness3/5

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

For a simple read-only tool with good annotations and full schema coverage, the description is minimally adequate. However, without an output schema, it doesn't explain what the return value looks like (e.g., structure of the schema object). Given the tool's simplicity, it's complete enough but leaves gaps about output format.

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 description coverage is 100%, so the input schema fully documents the single parameter 'schemaName'. The description adds no parameter-specific information beyond implying it's for a table schema. Baseline 3 is appropriate when the schema carries the full parameter documentation burden.

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?

The description clearly states the action ('Get') and resource ('schema of a table'), making the purpose immediately understandable. It's specific about what it retrieves, though it doesn't need to differentiate from siblings since there are none. The verb+resource combination is precise and unambiguous.

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 when needing table schema information, but provides no explicit guidance on when to use it versus alternatives or any prerequisites. With no sibling tools, the need for differentiation is minimal, but it lacks any context about typical use cases or limitations.

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.

  1. 1 tool update
    • First observedget-schema

TDQS

B3.4/5.0

Scored across 1 tool

Disambiguation5/5

With only one tool, there is no possibility of ambiguity or overlap between tools. The single tool has a clear, distinct purpose focused on retrieving table schema information.

Naming Consistency5/5

A single tool inherently has perfect naming consistency, as there are no other tools to compare against. The tool name 'get-schema' follows a clear verb-noun pattern and uses kebab-case consistently (though this is trivial with one tool).

Tool Count2/5

A MySQL server with only one tool is severely under-scoped for its domain. MySQL involves operations like querying, inserting, updating, deleting, managing connections, and handling transactions, so a single schema retrieval tool represents an extreme mismatch with the expected functionality.

Completeness1/5

The tool surface is severely incomplete for a MySQL server. It lacks basic CRUD operations (create, read, update, delete), query execution, connection management, and other essential database functions, making it impossible for agents to perform meaningful database interactions.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    Not graded
    maintenance
    Enables direct interaction with MySQL databases through SQL queries, table exploration, and schema inspection with support for prepared statements and connection pooling.
    -
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables interaction with MySQL databases through tools for listing tables, querying table schemas, executing queries, viewing indexes, and analyzing query execution plans.
    -
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables interaction with MySQL databases through connection management, SQL execution, and schema exploration. It features multi-connection support and a safety-focused 'dangerous mode' for write operations.
    20
    4
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables safe querying and optional writing to MySQL databases via MCP tools, with support for schema inspection, connection management, and read-only mode.
    7
    3
    MIT