mysql-mcp-server

ravindra-gs/mysql-mcp-server

3.2

If you are the rightful owner of mysql-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

A Model Context Protocol (MCP) server that provides a single interface to execute MySQL queries against a database running in Docker.

Tools
1
Resources
0
Prompts
0

MySQL MCP Server

A Model Context Protocol (MCP) server that provides a single interface to execute MySQL queries against a database

Installation

  • Clone this repository

  • Copy .env.example to .env and update values.

  • Install dependencies:

    npm install
    
  • Build the project:

    npm run build
    

Environment Variables

VariableDefaultDescription
MYSQL_HOSTlocalhostMySQL server host
MYSQL_PORT3306MySQL server port
MYSQL_USERrootMySQL username
MYSQL_PASSWORD``MySQL password
MYSQL_DATABASE``MySQL database name
MYSQL_BASIC_WRITE_PROTECTIONtrueEnable basic write protection (read-only mode)

2. Run the MCP Server

./build/index.js

The server will start and listen for MCP requests on stdio.

Example queries:

Write queries are only rejected in the write protection mode.

  • SELECT * FROM users LIMIT 10
  • INSERT INTO products (name, price) VALUES ('Widget', 19.99)
  • UPDATE users SET status = 'active' WHERE id = 1
  • DELETE FROM temp_table WHERE created_at < NOW() - INTERVAL 1 DAY

Start the server

  • Default (stdio): npm run build && ./build/index.js
  • HTTP transport: npm run build && ./build/index.js --http