Skip to main content
Glama
mcp-mysql-server

mcp-mysql-server

by f4ww4z

@f4ww4z/mcp-mysql-서버

대장간 배지

MySQL 데이터베이스 작업을 제공하는 모델 컨텍스트 프로토콜 서버입니다. 이 서버를 통해 AI 모델은 표준화된 인터페이스를 통해 MySQL 데이터베이스와 상호 작용할 수 있습니다.

설치

Smithery를 통해 설치

Smithery를 통해 Claude Desktop에 MySQL 서버를 자동으로 설치하려면:

지엑스피1

수동 설치

npx @f4ww4z/mcp-mysql-server

Related MCP server: MCP MySQL Server

구성

서버를 사용하려면 MCP 설정 구성 파일에 다음 환경 변수를 설정해야 합니다.

권장 사용

{
  "mcpServers": {
    "mysql": {
      "command": "npx",
      "args": ["-y", "@f4ww4z/mcp-mysql-server", "mysql://user:password@localhost:port/database"],
    }
  }
}
{
  "mcpServers": {
    "mysql": {
      "command": "npx",
      "args": ["-y", "@f4ww4z/mcp-mysql-server"],
      "env": {
        "MYSQL_HOST": "your_host",
        "MYSQL_USER": "your_user",
        "MYSQL_PASSWORD": "your_password",
        "MYSQL_DATABASE": "your_database"
      }
    }
  }
}

실행 평가

evals 패키지는 index.ts 파일을 실행하는 mcp 클라이언트를 로드하므로 테스트 사이에 다시 빌드할 필요가 없습니다. npx 명령 앞에 접두사를 붙여 환경 변수를 로드할 수 있습니다. 전체 문서는 여기에서 확인할 수 있습니다.

OPENAI_API_KEY=your-key  npx mcp-eval src/evals/evals.ts src/index.ts

사용 가능한 도구

1. 연결_DB

제공된 자격 증명을 사용하여 MySQL 데이터베이스에 대한 연결을 설정합니다.

use_mcp_tool({
  server_name: "mysql",
  tool_name: "connect_db",
  arguments: {
    host: "localhost",
    user: "your_user",
    password: "your_password",
    database: "your_database"
  }
});

2. 질의

선택적으로 준비된 명령문 매개변수를 사용하여 SELECT 쿼리를 실행합니다.

use_mcp_tool({
  server_name: "mysql",
  tool_name: "query",
  arguments: {
    sql: "SELECT * FROM users WHERE id = ?",
    params: [1]
  }
});

3. 실행하다

선택적으로 준비된 명령문 매개변수를 사용하여 INSERT, UPDATE 또는 DELETE 쿼리를 실행합니다.

use_mcp_tool({
  server_name: "mysql",
  tool_name: "execute",
  arguments: {
    sql: "INSERT INTO users (name, email) VALUES (?, ?)",
    params: ["John Doe", "john@example.com"]
  }
});

4. 리스트_테이블

연결된 데이터베이스에 있는 모든 테이블을 나열합니다.

use_mcp_tool({
  server_name: "mysql",
  tool_name: "list_tables",
  arguments: {}
});

5. 설명_테이블

특정 테이블의 구조를 가져옵니다.

use_mcp_tool({
  server_name: "mysql",
  tool_name: "describe_table",
  arguments: {
    table: "users"
  }
});

특징

  • 자동 정리를 통한 안전한 연결 처리

  • 쿼리 매개변수에 대한 준비된 명령문 지원

  • 포괄적인 오류 처리 및 검증

  • TypeScript 지원

  • 자동 연결 관리

보안

  • SQL 주입을 방지하기 위해 준비된 명령문을 사용합니다.

  • 환경 변수를 통해 안전한 암호 처리를 지원합니다.

  • 실행 전에 쿼리를 검증합니다.

  • 완료되면 자동으로 연결을 닫습니다.

오류 처리

서버는 일반적인 문제에 대한 자세한 오류 메시지를 제공합니다.

  • 연결 실패

  • 잘못된 쿼리

  • 매개변수가 누락되었습니다

  • 데이터베이스 오류

기여하다

기여를 환영합니다! https://github.com/f4ww4z/mcp-mysql-server 에 풀 리퀘스트를 제출해 주세요.

특허

MIT

Available Tools

4 tools
describe_tableB

Get table structure

Inputs: table (required).

executeB

Execute an INSERT, UPDATE, or DELETE query

Inputs: sql (required), params.

list_tablesB

List all tables in the database

Inputs: no named parameters.

queryB

Execute a SELECT query

Inputs: sql (required), params.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 4 tools

    Disambiguation5/5

    Each tool serves a distinct purpose: describe_table shows schema, execute handles writes, list_tables lists tables, and query handles reads. No overlap or ambiguity.

    Naming Consistency2/5

    Naming is inconsistent: 'describe_table' and 'list_tables' follow verb_noun, while 'execute' is a bare verb and 'query' is a noun. No uniform pattern.

    Tool Count4/5

    Four tools is reasonable for basic database operations, covering schema inspection, reads, and writes. Could be slightly expanded, but not under- or over-scoped.

    Completeness3/5

    Covers essential CRUD and schema listing, but misses DDL operations like create/alter/drop table, which are common needs. Notable gap for schema modification.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      A server that enables AI models to interact with MySQL databases through a Model Control Protocol, providing tools for table creation, schema inspection, query execution, and data retrieval.
      28
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      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.
      5
      290 npm
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      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.
      7
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      A Model Context Protocol server that enables AI models to interact with MySQL databases through natural language, supporting SQL queries, table creation, and schema exploration.
      3
      -