mcp-mysql-connector
mcp-mysql-connector
MySQL 데이터베이스 기능을 LLM 에이전트용 도구로 제공하는 MCP 서버입니다.
mcp-name: io.github.daedalus/mcp-mysql-connector
개요
mcp-mysql-connector는 MySQL 데이터베이스 작업을 LLM 에이전트용 도구로 제공하는 Model Context Protocol (MCP) 서버입니다. 표준화된 프로토콜을 통해 AI 어시스턴트가 MySQL 데이터베이스와 상호작용할 수 있게 하며, 다음과 같은 기능을 지원합니다:
데이터베이스 및 테이블 관리
쿼리 실행
사용자 인증 및 권한 관리
스키마 조회
트랜잭션 제어
Related MCP server: MCP Server MySQL
설치
pip install mcp-mysql-connector빠른 시작
서버 실행
# Run with stdio transport (default)
mcp-mysql-connector
# Or run programmatically
python -c "from mcp_mysql import mcp; mcp.run()"설정
connect 도구를 사용하여 MySQL에 연결합니다:
{
"host": "localhost",
"port": 3306,
"user": "root",
"password": "your_password",
"database": "your_database"
}MCP 도구
연결 관리
도구 | 설명 |
| MySQL 데이터베이스에 연결 |
| MySQL 연결 해제 |
| 연결 상태 확인 |
| 현재 트랜잭션 커밋 |
| 현재 트랜잭션 롤백 |
쿼리 실행
도구 | 설명 |
| 원시 SQL 쿼리를 실행하고 결과 반환 |
데이터베이스 작업
도구 | 설명 |
| 서버의 모든 데이터베이스 나열 |
| 새 데이터베이스 생성 |
| 데이터베이스 삭제 |
| 데이터베이스 존재 여부 확인 |
테이블 작업
도구 | 설명 |
| 데이터베이스의 테이블 나열 |
| 테이블 스키마 조회 |
| 새 테이블 생성 |
| 테이블 삭제 |
| 테이블 존재 여부 확인 |
컬럼 및 인덱스 작업
도구 | 설명 |
| 컬럼 세부 정보 표시 |
| 인덱스 세부 정보 표시 |
| 인덱스 생성 |
| 인덱스 삭제 |
사용자 관리
도구 | 설명 |
| MySQL 사용자 생성 |
| MySQL 사용자 삭제 |
| 사용자에게 권한 부여 |
| 사용자 권한 회수 |
| 사용자 권한 표시 |
서버 정보
도구 | 설명 |
| MySQL 서버 상태 확인 |
MCP 리소스
서버는 데이터베이스 및 테이블 메타데이터에 대한 동적 리소스를 제공합니다:
database://{name}- 테이블 목록을 포함한 데이터베이스 메타데이터table://{db}/{table}- 스키마, 컬럼, 인덱스를 포함한 테이블 메타데이터
사용 예시
연결 및 쿼리
# First, connect to database
connect(host="localhost", user="root", password="secret", database="mydb")
# Execute a query
execute_query(sql="SELECT * FROM users WHERE active = true")
# List all tables
list_tables(database="mydb")데이터베이스 및 테이블 생성
# Create a database
create_database(name="newapp")
# Create a table
create_table(name="users", schema="id INT PRIMARY KEY AUTO_INCREMENT, name VARCHAR(255), email VARCHAR(255) UNIQUE")사용자 관리
# Create a new user with password
create_user(username="app_user", host="localhost", password="secure_password")
# Grant privileges
grant_privileges(privileges="SELECT,INSERT,UPDATE,DELETE", on="newapp.*", username="app_user", host="localhost")트랜잭션 제어
# Start transaction
execute_query(sql="BEGIN")
# Execute operations
execute_query(sql="INSERT INTO accounts (balance) VALUES (100)")
# Commit or rollback
commit() # or rollback()환경 변수
서버는 환경 변수를 통한 설정을 지원합니다:
export MYSQL_HOST=localhost
export MYSQL_PORT=3306
export MYSQL_USER=root
export MYSQL_PASSWORD=secret
export MYSQL_DATABASE=mydb개발
# Clone repository
git clone https://github.com/daedalus/mcp-mysql-connector.git
cd mcp-mysql-connector
# Create virtual environment
python -m venv venv
source venv/bin/activate
# Install dependencies
pip install -e ".[test]"
# Run tests
pytest
# Format code
ruff format src/ tests/
# Lint
ruff check src/ tests/
# Type check
mypy src/아키텍처
mcp-mysql-connector/
├── src/mcp_mysql/
│ ├── core/models.py # Data models (QueryResult, TableSchema, etc.)
│ ├── adapters/mysql.py # MySQL connection & pooling
│ ├── services/connection.py # Connection manager
│ ├── tools/mysql_tools.py # MCP tool implementations
│ └── mcp.py # FastMCP server setup
└── tests/ # Test suite요구 사항
Python 3.11+
fastmcp >= 2.0.0
pymysql >= 1.1.0
sqlparse >= 0.4.0
라이선스
MIT License - 자세한 내용은 LICENSE를 참조하세요.
This server cannot be deployed
Maintenance
Related MCP Connectors
- dataOAuthco.thinair
PostgreSQL, MySQL, and SQL Server in one session. 26 read-only MCP tools for AI agents.
PostgreSQL, MySQL, OpenAPI/Swagger, and shared Agent Memory with scoped access.
Astra DB tools for agents: schema, find, vector search, guarded writes, and interactive views.
Query Postgres, MySQL, SQL Server, Oracle, BigQuery, ClickHouse and Redshift from your AI client.
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables AI models to perform MySQL database operations through a standardized interface, supporting secure connections, query execution, and comprehensive schema management.7218 npm33MIT
- AlicenseAqualityCmaintenanceEnables LLMs to interact with MySQL databases through standardized protocol, supporting database management, table operations, data queries, and modifications with configurable permission controls.1539 npm1MIT
- AlicenseAqualityDmaintenanceEnables AI agents to safely interact with MySQL/MariaDB databases, supporting read-only queries by default with optional write operations and access control.8MIT
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to interact with a MySQL database using natural language, automating SQL tasks like querying, inserting, updating, and deleting data.1-