
MySQL
STDIOMySQL数据库操作与管理MCP服务器
MySQL数据库操作与管理MCP服务器
A Model Context Protocol (MCP) server for MySQL database operations. Provides 4 powerful tools for database interaction through any MCP-compatible client.
# Clone the repository git clone https://github.com/myheisenberg/mysql-mcp-server.git cd mysql-mcp-server # Install dependencies npm install # Build the project npm run build
The server uses environment variables for database configuration:
DB_HOST=localhost # MySQL host (default: localhost) DB_USER=root # MySQL username (default: root) DB_PASSWORD= # MySQL password (default: empty) DB_PORT=3306 # MySQL port (default: 3306)
Add to your claude_desktop_config.json
:
{ "mcpServers": { "mysql": { "command": "node", "args": ["path/to/mysql-mcp-server/dist/index.js"], "env": { "DB_HOST": "localhost", "DB_USER": "your_username", "DB_PASSWORD": "your_password", "DB_PORT": "3306" } } } }
Add to your MCP configuration:
{ "mcpServers": { "mysql": { "command": "node", "args": ["path/to/mysql-mcp-server/dist/index.js"], "env": { "DB_HOST": "localhost", "DB_USER": "your_username", "DB_PASSWORD": "your_password", "DB_PORT": "3306" } } } }
mysql_query
Execute any MySQL query and get formatted results.
Example: "Run a SELECT query on the users table"
mysql_databases
List all available databases on the MySQL server.
Example: "Show me all databases"
mysql_tables
List all tables in a specific database.
Example: "What tables are in the blog database?"
mysql_describe
Get detailed information about a table's structure.
Example: "Describe the structure of the users table"
# Install dependencies npm install # Development mode (watch for changes) npm run dev # Build for production npm run build # Start the server npm start
mysql-mcp-server/
├── src/
│ └── index.ts # Main MCP server implementation
├── dist/ # Compiled JavaScript (auto-generated)
├── package.json # Project dependencies and scripts
├── tsconfig.json # TypeScript configuration
├── .gitignore # Git ignore rules
└── README.md # This file
git checkout -b feature/amazing-feature
)git commit -m 'Add some amazing feature'
)git push origin feature/amazing-feature
)This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter any issues or have questions:
Made with ❤️ for the MCP community