MCP Mysql Server logo

MCP Mysql Server

Community
f4ww4z

A Model Context Protocol server for MySQL database operations

Publisherf4ww4z
Repositorymcp-mysql-server
LanguageJavaScript
Forks
37
Stars
168
Available tools
5
Transport typestdio
Categories
LicenseMIT
Links
  • Connect tools to AI workflows

    MCP Mysql Server exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 5 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    168 stars and 37 forks from the linked repository.

@f4ww4z/mcp-mysql-server

Trust Score smithery badge

A Model Context Protocol server that provides MySQL database operations. This server enables AI models to interact with MySQL databases through a standardized interface.

Installation

Installing via Smithery

To install MySQL Server for Claude Desktop automatically via Smithery:

bash
npx -y @smithery/cli install @f4ww4z/mcp-mysql-server --client claude

Manual Installation

bash
npx @f4ww4z/mcp-mysql-server

Configuration

The server requires the following environment variables to be set in your MCP settings configuration file:

recommended use

json
{
  "mcpServers": {
    "mysql": {
      "command": "npx",
      "args": ["-y", "@f4ww4z/mcp-mysql-server", "mysql://user:password@localhost:port/database"],
    }
  }
}
json
{
  "mcpServers": {
    "mysql": {
      "command": "npx",
      "args": ["-y", "@f4ww4z/mcp-mysql-server"],
      "env": {
        "MYSQL_HOST": "your_host",
        "MYSQL_USER": "your_user",
        "MYSQL_PASSWORD": "your_password",
        "MYSQL_DATABASE": "your_database"
      }
    }
  }
}

codex

mac

在 ~/.codex/config.toml

toml
[mcp_servers.mcp-mysql-server]
command = "npx"
args = [
  "-y",
  "@f4ww4z/mcp-mysql-server",
  "mysql://user:password@127.0.0.1:3306/database"
]

windows

在 %USERPROFILE%\.codex\config.toml

toml
[mcp_servers.mcp-mysql-server]
command = "npx"
args = [
  "-y",
  "@f4ww4z/mcp-mysql-server",
  "mysql://user:password@127.0.0.1:3306/database"
]

Running evals

The evals package loads an mcp client that then runs the index.ts file, so there is no need to rebuild between tests. You can load environment variables by prefixing the npx command. Full documentation can be found here.

bash
OPENAI_API_KEY=your-key  npx mcp-eval src/evals/evals.ts src/index.ts

Available Tools

1. connect_db

Establish connection to MySQL database using provided credentials.

typescript
use_mcp_tool({
  server_name: "mysql",
  tool_name: "connect_db",
  arguments: {
    host: "localhost",
    user: "your_user",
    password: "your_password",
    database: "your_database"
  }
});

2. query

Execute SELECT queries with optional prepared statement parameters.

typescript
use_mcp_tool({
  server_name: "mysql",
  tool_name: "query",
  arguments: {
    sql: "SELECT * FROM users WHERE id = ?",
    params: [1]
  }
});

3. execute

Execute INSERT, UPDATE, or DELETE queries with optional prepared statement parameters.

typescript
use_mcp_tool({
  server_name: "mysql",
  tool_name: "execute",
  arguments: {
    sql: "INSERT INTO users (name, email) VALUES (?, ?)",
    params: ["John Doe", "john@example.com"]
  }
});

4. list_tables

List all tables in the connected database.

typescript
use_mcp_tool({
  server_name: "mysql",
  tool_name: "list_tables",
  arguments: {}
});

5. describe_table

Get the structure of a specific table.

typescript
use_mcp_tool({
  server_name: "mysql",
  tool_name: "describe_table",
  arguments: {
    table: "users"
  }
});

Features

  • Secure connection handling with automatic cleanup
  • Prepared statement support for query parameters
  • Comprehensive error handling and validation
  • TypeScript support
  • Automatic connection management

Security

  • Uses prepared statements to prevent SQL injection
  • Supports secure password handling through environment variables
  • Validates queries before execution
  • Automatically closes connections when done

Error Handling

The server provides detailed error messages for common issues:

  • Connection failures
  • Invalid queries
  • Missing parameters
  • Database errors

Contributing

Contributions are welcome! Please feel free to submit a Pull Request to https://github.com/f4ww4z/mcp-mysql-server

License

MIT

Installation

TypingMind
{
  "mcpServers": {
    "mcp-mysql-server": {
      "command": "npx",
      "args": [
        "-y",
        "@f4ww4z/mcp-mysql-server"
      ],
      "env": {
        "MYSQL_HOST": "<MYSQL_HOST>",
        "MYSQL_USER": "<MYSQL_USER>",
        "MYSQL_PASSWORD": "<MYSQL_PASSWORD>",
        "MYSQL_DATABASE": "<MYSQL_DATABASE>"
      }
    }
  }
}

Available Tools

  • connect_db

    Connect to MySQL database

  • query

    Execute a SELECT query

  • execute

    Execute an INSERT, UPDATE, or DELETE query

  • list_tables

    List all tables in the database

  • describe_table

    Get table structure

Use MCP Mysql Server MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once MCP Mysql Server is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add MCP Mysql Server as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the MCP Mysql Server MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "mcp-mysql-server": {
      "command": "npx",
      "args": [
        "-y",
        "@f4ww4z/mcp-mysql-server"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the MCP Mysql Server MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the MCP Mysql Server MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use MCP Mysql Server to help me with this task?
MCP Mysql Server
Sure. I read it.
Here is what I found using MCP Mysql Server.

Frequently asked questions

What is the MCP Mysql Server MCP server used for?

MCP Mysql Server is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use MCP Mysql Server MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use MCP Mysql Server with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use MCP Mysql Server MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With MCP Mysql Server connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect MCP Mysql Server MCP to TypingMind?

MCP Mysql Server runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does MCP Mysql Server MCP provide in TypingMind?

MCP Mysql Server exposes 5 MCP tools that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use MCP Mysql Server MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If MCP Mysql Server requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇