
MCP Stdio Server (MySQL/MariaDB)
이 프로젝트는 Cursor IDE와 연동 가능한 Model Context Protocol (MCP) Stdio 서버입니다. MySQL 또는 MariaDB 데이터베이스의 테이블 구조와 관계를 반환합니다.
✅ 기능
- MCP 공식 Python SDK 기반
-
stdio
모드로 Cursor IDE 연동 -
.env
파일 기반 DB 설정 - 테이블 목록, 컬럼, 외래키 관계 반환
- 데이터 조회 및 분석 기능
- 쿼리 실행 및 최적화 기능
- 데이터베이스 모니터링 기능
- 성능 분석 및 최적화 제안
📦 설치
git clone <this-repo-url>
cd db-mcp-server
python -m venv venv
source venv/bin/activate # 또는 venv\Scripts\activate (Windows)
pip install -r requirements.txt
⚙️ .env 설정
루트에 .env
파일을 아래와 같이 작성하세요:
# Database connection settings for MCP Python server
DB_HOST=localhost
DB_USER=root
DB_PASSWORD=your_password
DB_NAME=your_db
DB_CHARSET=utf8mb4
🚀 실행
Cursor IDE에서 MCP Server
추가 > Transport: stdio
> Command: python main.py
📡 지원 메서드
스키마 조회
-
mysql.get_schema
: 모든 테이블 구조 + 외래키 반환
데이터 조회 및 분석
-
mysql.get_table_stats
: 테이블별 통계 정보 (행 수, NULL 값 비율, 고유값 수) -
mysql.get_sample_data
: 테이블의 샘플 데이터 조회 -
mysql.get_column_stats
: 특정 컬럼의 상세 통계 정보
쿼리 실행 및 최적화
-
mysql.execute_query
: 안전한 읽기 전용 쿼리 실행 -
mysql.explain_query
: 쿼리 실행 계획 분석 -
mysql.optimize_query
: 쿼리 최적화 제안
데이터베이스 모니터링
-
mysql.get_db_status
: 데이터베이스 상태 정보 (연결 수, 쿼리 통계 등) -
mysql.get_table_size
: 테이블별 크기 정보 -
mysql.get_index_usage
: 인덱스 사용 통계
성능 분석
-
mysql.analyze_performance
: 성능 병목 지점 분석 -
mysql.suggest_indexes
: 인덱스 생성 제안 -
mysql.optimize_tables
: 테이블 최적화 제안
📝 예시 결과
스키마 조회
{
"schema": {
"users": {
"columns": [...],
"foreign_keys": [...]
}
}
}
테이블 통계
{
"table_name": "users",
"total_rows": 1000,
"column_stats": {
"id": {
"total_rows": 1000,
"null_count": 0,
"null_ratio": 0.0,
"unique_values": 1000
}
}
}
쿼리 실행 계획
{
"explain_plan": [...],
"handler_stats": {...},
"suggestions": [
{
"type": "index",
"message": "정렬 작업이 발생하고 있습니다. ORDER BY 절에 사용된 컬럼에 대한 인덱스 추가를 고려하세요."
}
]
}
성능 분석
{
"slow_queries": 5,
"bottlenecks": [
{
"type": "large_table",
"table": "orders",
"rows": 1500000,
"message": "테이블 'orders'이(가) 1,500,000개의 행을 가지고 있습니다. 파티셔닝을 고려하세요."
}
],
"recommendations": [...]
}
✅ 요구사항
- Python 3.8+
- MySQL/MariaDB
相关推荐
I find academic articles and books for research and literature reviews.
Confidential guide on numerology and astrology, based of GG33 Public information
Converts Figma frames into front-end code for various mobile frameworks.
Advanced software engineer GPT that excels through nailing the basics.
Take an adjectivised noun, and create images making it progressively more adjective!
Siri Shortcut Finder – your go-to place for discovering amazing Siri Shortcuts with ease
Descubra la colección más completa y actualizada de servidores MCP en el mercado. Este repositorio sirve como un centro centralizado, que ofrece un extenso catálogo de servidores MCP de código abierto y propietarios, completos con características, enlaces de documentación y colaboradores.
Manipulación basada en Micrypthon I2C del expansor GPIO de la serie MCP, derivada de AdaFruit_MCP230xx
La aplicación AI de escritorio todo en uno y Docker con trapo incorporado, agentes de IA, creador de agentes sin código, compatibilidad de MCP y más.
Servidor MCP para obtener contenido de la página web con el navegador sin cabeza de dramaturgo.
Un poderoso complemento Neovim para administrar servidores MCP (protocolo de contexto del modelo)
Puente entre los servidores Ollama y MCP, lo que permite a LLM locales utilizar herramientas de protocolo de contexto del modelo
🧑🚀 全世界最好的 llM 资料总结(数据处理、模型训练、模型部署、 O1 模型、 MCP 、小语言模型、视觉语言模型) | Resumen de los mejores recursos del mundo.
Reviews

user_jVBD3WrT
As a dedicated user of db-mcp-server, I can confidently say this tool by zerogon1203 is a game-changer! It offers seamless integration and robust performance for managing your database needs. The user-friendly interface and comprehensive documentation make it incredibly easy to set up and use. Highly recommend checking it out on GitHub!