Provides comprehensive MySQL database management capabilities including querying table structures, retrieving column and index information, searching data across single or multiple tables with joins, and accessing database connection details.
MySQL MCP Server
MySQL 데이터베이스 관리를 위한 MCP(Model Context Protocol) 서버입니다. FastMCP를 사용하여 개발되었으며, MySQL 데이터베이스의 테이블, 컬럼, 인덱스 정보를 조회하고 데이터를 검색할 수 있습니다.
🚀 주요 기능
📋 테이블 관리
- 테이블 목록 조회: 현재 데이터베이스의 모든 테이블 정보를 표 형태로 표시
- 컬럼 정보 조회: 특정 테이블의 컬럼 상세 정보를 표 형태로 표시
- 인덱스 정보 조회: 테이블에 설정된 인덱스 정보를 표 형태로 표시
🔍 데이터 검색
- 단일 테이블 검색: 특정 테이블에서 조건에 맞는 데이터 검색
- 다중 테이블 검색: 여러 테이블을 조인하여 복합 검색 수행
- 검색 결과 제한: 기본적으로 상위 10개 결과만 표시하여 성능 최적화
⚙️ 시스템 정보
- 데이터베이스 연결 정보: 서버 버전, 현재 데이터베이스, 연결 상태 등
- 환경 변수 기반 설정: 안전한 연결 정보 관리
📦 설치 방법
1. 필요한 모듈 설치
2. 환경 변수 설정
.env
파일을 생성하거나 환경 변수를 설정합니다:
또는 env_example.txt
파일을 참고하여 설정하세요.
🎯 사용 방법
1. MCP 서버 실행
2. 사용 가능한 도구들
테이블 목록 조회
현재 데이터베이스의 모든 테이블을 표 형태로 표시합니다.
테이블 컬럼 정보 조회
지정된 테이블의 컬럼 상세 정보를 표 형태로 표시합니다.
테이블 데이터 검색
예시:
search_table("users")
- 전체 데이터 조회search_table("users", "age > 25")
- 조건에 맞는 데이터 검색search_table("users", "name = 'John'")
- 특정 값 검색
다중 테이블 검색
예시:
search_multiple_tables(["users", "orders"], "users.id = orders.user_id")
search_multiple_tables(["users", "orders"], "users.id = orders.user_id", "orders.amount > 100")
인덱스 정보 조회
지정된 테이블의 인덱스 정보를 표 형태로 표시합니다.
데이터베이스 정보 조회
현재 연결된 데이터베이스의 서버 정보와 연결 상태를 표시합니다.
🧪 테스트
기능 테스트를 위해 다음 명령어를 실행하세요:
테스트는 다음 항목들을 확인합니다:
- 환경 변수 설정 상태
- FastMCP 모듈 import
- MySQL Connector 모듈 import
- MCP 서버 생성
- MySQL 연결 상태
🔧 기술 스택
- Python 3.7+: 메인 프로그래밍 언어
- FastMCP: MCP 서버 프레임워크
- MySQL Connector/Python: MySQL 데이터베이스 연결
- Environment Variables: 설정 관리
📁 파일 구조
🚨 주의사항
- 보안: 데이터베이스 비밀번호를 코드에 하드코딩하지 마세요.
- 권한: MCP 서버가 실행되는 사용자가 MySQL에 접근할 수 있는 권한을 가지고 있어야 합니다.
- 연결: MySQL 서버가 실행 중이어야 합니다.
- 데이터베이스:
MYSQL_DATABASE
환경 변수를 설정하여 사용할 데이터베이스를 지정하세요.
🐛 문제 해결
연결 오류
- MySQL 서버가 실행 중인지 확인
- 호스트, 포트, 사용자명, 비밀번호가 올바른지 확인
- 방화벽 설정 확인
권한 오류
- MySQL 사용자가 해당 데이터베이스에 접근 권한을 가지고 있는지 확인
GRANT
명령어로 권한 부여
모듈 오류
pip install -r requirements.txt
실행- Python 버전이 3.7 이상인지 확인
📝 라이선스
이 프로젝트는 MIT 라이선스 하에 배포됩니다.
🤝 기여
버그 리포트나 기능 제안은 이슈로 등록해주세요. 풀 리퀘스트도 환영합니다.
MySQL MCP Server - MySQL 데이터베이스 관리를 위한 강력한 MCP 도구
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Enables interaction with MySQL databases through MCP tools for querying table structures, searching data across single or multiple tables, and managing database information. Built with FastMCP framework for secure database operations using environment-based configuration.
Related MCP Servers
- -securityAlicense-qualityAn MCP server that integrates with MySQL databases, enabling secure read and write operations through LLM-driven interfaces with support for transaction handling and performance monitoring.Last updated -10716MIT License
- -securityFlicense-qualityAn MCP server that allows working with MySQL databases by providing tools for executing read-only SQL queries, getting table schemas, and listing database tables.Last updated -5093
- -securityFlicense-qualityA FastMCP-based server that enables interaction with MySQL databases, supporting client-server communication for querying and analyzing MySQL data.Last updated -
- -securityFlicense-qualityProvides MySQL database integration for AI assistants and other MCP clients, allowing them to list tables, read table data, and execute SQL queries.Last updated -