mysql-mcp-server-sse
MySQL query server based on the MCP sse.Multi-level SQL risk control & injection protection Docker support for quick deployment
GitHub Stars
78
User Rating
Not Rated
Favorites
0
Views
19
Forks
22
Issues
5
Installation
Difficulty
IntermediateEstimated Time
10-20 minutes
Requirements
Python 3.6以上Docker 最新版Installation
Installation
Prerequisites
Python: 3.6 or higher
Docker: Latest version
Installation Steps
1. Pull Docker Image
bash
Pull the image
docker pull mangooer/mysql-mcp-server-sse:latest
2. Run the Container
bash
docker run -d \
--name mysql-mcp-server-sse \
-e HOST=0.0.0.0 \
-e PORT=3000 \
-e MYSQL_HOST=your_mysql_host \
-e MYSQL_PORT=3306 \
-e MYSQL_USER=your_mysql_user \
-e MYSQL_PASSWORD=your_mysql_password \
-e MYSQL_DATABASE=your_database \
-p 3000:3000 \
mangooer/mysql-mcp-server-sse:latest
3. Install from Source Code
#### Install Dependenciesbash
pip install -r requirements.txt
.env.example to .env and modify as needed.
#### Start the Server
bash
python -m src.server
Troubleshooting
Issue: Server won't start Solution: Check Docker settings and ensure necessary environment variables are set correctly.Configuration
Configuration
Environment Variables
Set the following environment variables as needed:bash
export MYSQL_HOST="your_mysql_host"
export MYSQL_PORT="3306"
export MYSQL_USER="your_mysql_user"
export MYSQL_PASSWORD="your_mysql_password"
export MYSQL_DATABASE="your_database"
Configuration Example
json
{
"mcpServers": {
"mysql-mcp-server-sse": {
"command": "python",
"args": ["-m", "src.server"],
"env": {
"HOST": "0.0.0.0",
"PORT": "3000"
}
}
}
}
Examples
Examples
Basic Usage
Programmatic Usage
python
import requests
def call_mcp_tool(tool_name, params):
response = requests.post(
'http://localhost:3000/mcp/call',
json={
'tool': tool_name,
'parameters': params
}
)
return response.json()
Usage example
result = call_mcp_tool('analyze', {
'input': 'sample data',
'options': {'format': 'json'}
})
Use Cases
Real-time database access for data analytics
Database connection management for high-traffic web applications
Database operations in environments with strict security requirements
Rapid deployment and testing in development environments