Python MySQL MCP

Python MySQL MCP

A FastMCP-based server that enables interaction with MySQL databases, supporting client-server communication for querying and analyzing MySQL data.

Category
Visit Server

README

pymcp

pymcp는 FastMCP를 기반으로 한 Python 프로젝트로, MySQL 데이터베이스와 상호작용할 수 있는 도구를 제공합니다. 이 프로젝트는 서버와 클라이언트 간의 통신을 지원하며, 다양한 도구를 통해 데이터를 조회하고 분석할 수 있습니다.

프로젝트 구조

pymcp/
├── client.py          # 클라이언트 코드
├── main.py            # 서버 실행 코드
├── src/
│   ├── env.py         # 로컬 환경 설정
│   ├── env_dev.py     # 개발 환경 설정
│   ├── mcp_instance.py # MCP 인스턴스 초기화
│   ├── mysql_tool.py  # MySQL 관련 도구 정의
├── pyproject.toml     # 프로젝트 메타데이터 및 의존성
├── requirements.txt   # 의존성 목록
└── README.md          # 프로젝트 설명

설치 및 실행

1. 의존성 설치

Python 3.13 이상이 필요합니다. 의존성을 설치하려면 아래 명령어를 실행하세요:

pip install -r requirements.txt

2. 서버 실행

서버를 실행하려면 main.py를 실행하세요:

python main.py

서버는 기본적으로 0.0.0.0:8080에서 실행됩니다.

3. 클라이언트 실행

클라이언트를 실행하려면 client.py를 실행하세요:

python client.py

클라이언트는 서버와 통신하여 MySQL 쿼리를 실행하거나 도구 목록을 조회할 수 있습니다.

환경 설정

환경에 따라 MySQL 설정이 다르게 적용됩니다:

  • 로컬 환경: src/env.py
  • 개발 환경: src/env_dev.py

환경은 APP_ENV 환경 변수를 통해 설정할 수 있습니다. 기본값은 local입니다.

export APP_ENV=dev  # 개발 환경 설정

제공 도구

서버에서 제공하는 도구는 다음과 같습니다:

  1. describe_tools
    사용 가능한 도구 목록과 사용법을 설명합니다.

  2. query_mysql(sql: str)
    주어진 SQL 쿼리를 실행하고 결과를 반환합니다.
    예시: query_mysql("SELECT * FROM users LIMIT 10;")

주요 파일 설명

main.py

서버를 실행하는 진입점입니다. MCP 인스턴스를 초기화하고 도구를 등록한 뒤 서버를 실행합니다.

client.py

서버와 상호작용하는 클라이언트 코드입니다. 서버에 연결하여 도구를 호출할 수 있습니다.

src/mysql_tool.py

MySQL 관련 도구를 정의한 파일입니다. query_mysql와 같은 도구를 통해 SQL 쿼리를 실행할 수 있습니다.

src/env.pysrc/env_dev.py

MySQL 연결 설정을 포함한 환경 변수 파일입니다. 환경에 따라 적절한 설정을 로드합니다.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured