MCP MySQL App

MIT License
  • Apple
  • Linux

Integrations

  • Supports configuration of database connection details through environment variables in .env files

  • Enables AI assistants to interact with MySQL databases by executing SQL queries and checking database connectivity

MCP MySQL 앱

MCP(모델 컨텍스트 프로토콜)는 AI 인터페이스를 통해 MySQL 데이터베이스와 상호 작용하기 위한 도구 서버 구현입니다.

개요

이 프로젝트는 AI 시스템이 모델 컨텍스트 프로토콜(Model Context Protocol)을 통해 MySQL 데이터베이스에 연결하고 쿼리할 수 있도록 하는 도구 세트를 제공합니다. 이를 통해 AI 비서가 SQL 쿼리를 실행하고 데이터베이스 연결을 확인할 수 있습니다.

특징

  • 간단하지만 강력한 MySQL 도구 통합
  • 유형 안전 도구 정의
  • 향상된 오류 처리
  • 요청 중단 신호 처리 지원
  • 세션 인식

설치

  1. 이 저장소를 복제하세요
  2. 종속성 설치:

지엑스피1

도구 사용 방법

1. 초기 설정

이 저장소를 복제하세요:

git clone <repository-url> cd mcp-mysql-app

종속성 설치:

npm install

루트 디렉토리에 .env 파일을 만듭니다.

MYSQL_HOST=your_mysql_host MYSQL_USER=your_mysql_username MYSQL_PASSWORD=your_mysql_password MYSQL_DATABASE=your_database_name MYSQL_PORT=3306

프로젝트를 빌드하세요:

npm run build

이제 dist 폴더는 다양한 AI 플랫폼에서 구성하는 데 사용할 수 있습니다.

2. 커서 구성

커서 MCP 구성 파일을 찾으세요.

  • Windows: C:\Users\<username>\.cursor\mcp.json
  • macOS: ~/.cursor/mcp.json
  • 리눅스: ~/.cursor/mcp.json

MySQL MCP 서버 구성을 추가하려면 파일을 편집하세요.

{ "mcpServers": { "mysql": { "command": "<path-to-node>", "args": [ "<path-to-project>/dist/index.js" ], "env": { "MYSQL_HOST": "your_mysql_host", "MYSQL_USER": "your_mysql_username", "MYSQL_PASSWORD": "your_mysql_password", "MYSQL_DATABASE": "your_database_name", "MYSQL_PORT": "3306" } } } }

자리 표시자를 교체하세요:

  • <path-to-node> : Node.js 실행 파일의 경로
  • <path-to-project> : MCP MySQL 앱 프로젝트 디렉토리의 절대 경로
  • 실제 데이터베이스 연결 세부 정보가 포함된 MySQL 환경 변수

구성 예:

{ "mcpServers": { "mysql": { "command": "C:\\nvm4w\\nodejs\\node.exe", "args": [ "H:\\mcp\\my-mysql\\dist\\index.js" ], "env": { "MYSQL_HOST": "localhost", "MYSQL_USER": "root", "MYSQL_PASSWORD": "password123", "MYSQL_DATABASE": "todo_app", "MYSQL_PORT": "3306" } } } }

파일을 저장하고 Cursor를 다시 시작하여 변경 사항을 적용하세요.

3. 클로드 구성

Claude에서 MCP MySQL 도구를 사용하려면 Claude 설정 파일에 구성을 추가해야 합니다. 다음 단계를 따르세요.

  1. Claude AI 데스크톱 앱 설정 열기
  2. "개발자" 섹션으로 이동하세요
  3. "도구" 구성 섹션을 찾으세요
  4. 다음과 같이 MySQL MCP에 대한 구성을 추가합니다.
{ "tools": { "mysql": { "command": "<path-to-node>", "args": [ "<path-to-project>/dist/index.js" ], "env": { "MYSQL_HOST": "your_mysql_host", "MYSQL_USER": "your_mysql_username", "MYSQL_PASSWORD": "your_mysql_password", "MYSQL_DATABASE": "your_database_name", "MYSQL_PORT": "3306" } } } }

자리 표시자를 교체하세요:

  • <path-to-node> : Node.js 실행 파일의 경로
  • <path-to-project> : MCP MySQL 앱 프로젝트 디렉토리의 절대 경로
  • 실제 데이터베이스 연결 세부 정보가 포함된 MySQL 환경 변수

구성 예:

{ "tools": { "mysql": { "command": "/usr/local/bin/node", "args": [ "/Users/username/projects/mcp-mysql-app/dist/index.js" ], "env": { "MYSQL_HOST": "localhost", "MYSQL_USER": "root", "MYSQL_PASSWORD": "password123", "MYSQL_DATABASE": "todo_app", "MYSQL_PORT": "3306" } } } }

4. 다른 플랫폼에서의 구성

MCP를 지원하는 다른 AI 플랫폼의 기본 원칙은 동일합니다.

  1. 외부 도구 또는 MCP에 대한 구성 영역 찾기
  2. 이 저장소의 dist/index.js 파일로 Node.js를 실행하도록 구성합니다.
  3. 환경 구성에 MySQL 연결 세부 정보를 포함합니다.

사용 가능한 도구

구성 후 AI는 다음 MySQL 도구에 액세스할 수 있습니다.

  • sql_check_connection - MySQL 연결이 작동하는지 확인합니다.
  • sql_query - 연결된 데이터베이스에서 SQL 쿼리를 실행합니다.

AI 환경에서 MySQL 도구 사용

AI 환경에서 MySQL 도구를 구성하면 AI에 메시지를 표시하여 도구를 사용할 수 있습니다. 다음은 몇 가지 예입니다.

커서에서 MySQL 도구 사용

Cursor에서는 Claude에게 MySQL 관련 작업을 수행하도록 간단히 요청할 수 있습니다.

  • MySQL 연결이 작동하는지 확인하세요.
  • 서버에 있는 모든 데이터베이스를 보여주세요.
  • 현재 데이터베이스에서 모든 테이블을 가져옵니다.
  • 사용자 테이블에서 모든 사용자를 검색하는 쿼리를 실행합니다.
  • 제품 테이블의 레코드를 업데이트합니다.

예제 워크플로: 데이터 쿼리 및 조작

다음은 이러한 도구를 사용하는 방법을 보여주는 워크플로의 예입니다.

  1. 연결 확인:"MySQL 연결이 작동하는지 확인하세요."Claude는 sql_check_connection 도구를 사용하여 데이터베이스 연결을 확인합니다.
  2. 데이터베이스 보기:"이 MySQL 서버에 있는 모든 데이터베이스를 보여주세요."Claude는 SHOW DATABASES; 와 함께 sql_query 도구를 사용합니다.
  3. 테이블 탐색:"현재 데이터베이스의 모든 테이블을 나열합니다."Claude는 SHOW TABLES; 와 함께 sql_query 도구를 사용합니다.
  4. 데이터 쿼리:"users 테이블에서 처음 10개 레코드를 보여주세요."Claude는 SELECT * FROM users LIMIT 10; 과 함께 sql_query 도구를 사용합니다.
  5. 테이블 만들기:"id, name, price, description 열이 있는 'products'라는 이름의 새 테이블을 만듭니다."Claude는 sql_query 도구를 사용하여 적절한 CREATE TABLE 명령문으로 테이블을 생성합니다.
  6. 데이터 삽입:"이름이 '스마트폰'이고, 가격이 499.99이고, 설명이 '최신 모델'인 새 제품을 삽입하세요."Claude는 INSERT 문과 함께 sql_query 도구를 사용합니다.
  7. 기록 업데이트:"'스마트폰' 제품의 가격을 449.99로 업데이트해 주세요."Claude는 UPDATE 문과 함께 sql_query 도구를 사용합니다.

이러한 예는 도구를 적절히 구성하면 AI 어시스턴트를 통해 MySQL과 얼마나 자연스럽게 상호작용할 수 있는지 보여줍니다.

지원 및 도움말

이 도구를 사용하는 데 문제가 발생하면 다음을 수행하세요.

  • MySQL 연결 세부 정보가 올바른지 확인하세요
  • Node.js가 제대로 설치되었는지 확인하세요
  • AI 플랫폼에서 MCP 구성을 확인하세요
  • 나타날 수 있는 오류 메시지가 있는지 로그 파일을 확인하세요.
  • MySQL 서버에 대한 네트워크 연결을 확인하세요

특허

이 프로젝트는 MIT 라이선스에 따라 라이선스가 부여되었습니다. 자세한 내용은 라이선스 파일을 참조하세요.

-
security - not tested
A
license - permissive license
-
quality - not tested

local-only server

The server can only run on the client's local machine because it depends on local resources.

SQL 쿼리를 실행하고 데이터베이스 연결을 확인하여 AI 어시스턴트가 MySQL 데이터베이스와 상호 작용할 수 있도록 하는 MCP(Model Context Protocol) 서버입니다.

  1. Overview
    1. Features
      1. Installation
        1. How to Use the Tool
          1. 1. Initial Setup
          2. 2. Cursor Configuration
          3. 3. Claude Configuration
          4. 4. Configuration on Other Platforms
        2. Available Tools
          1. Using MySQL Tools in AI Environments
            1. Using MySQL Tools in Cursor
            2. Example Workflow: Querying and Manipulating Data
          2. Support and Help
            1. License

              Related MCP Servers

              • -
                security
                -
                license
                -
                quality
                A Model Context Protocol server that enables AI models to interact with MySQL databases, providing tools for querying, executing statements, listing tables, and describing table structures.
                Last updated -
                MIT License
              • -
                security
                -
                license
                -
                quality
                A Model Context Protocol server that enables AI models to interact with MySQL databases through a standardized interface, providing tools for querying, executing commands, and managing database schemas.
                Last updated -
                JavaScript
              • -
                security
                A
                license
                -
                quality
                The Multi DB MCP Server is a high-performance implementation of the Database Model Context Protocol designed to revolutionize how AI agents interact with databases. Currently supporting MySQL and PostgreSQL databases.
                Last updated -
                142
                Go
                MIT License
                • Linux
                • Apple
              • A
                security
                F
                license
                A
                quality
                A Model Context Protocol server that allows AI agents to execute SQL queries against a MySQL database, supporting operations like reading data, creating tables, inserting, updating, and deleting records.
                Last updated -
                6
                695
                1
                JavaScript
                • Apple

              View all related MCP servers

              ID: g85jbuf1l4