Skip to main content

Add your description here

Project description

MySQL + Feishu MCP Tool

This package provides a Model Context Protocol (MCP) server with:

  • Read-only MySQL query capability.
  • Feishu remote MCP connection capability.

Features

  • Read-only Access: Only allows SELECT and SHOW statements for SQL safety.
  • MySQL SSL Support: Supports SSL connections for cloud databases.
  • Feishu Remote MCP: Supports initialize, tools/list, and tools/call against Feishu MCP endpoint.
  • Feishu Sheets Read/Write: Supports reading and writing Feishu Sheets via Open API.
  • Feishu Bitable Read/Write: Supports reading and batch writing Feishu Bitable with optional table clear.
  • Env-based Config: Uses .env for all credentials and endpoint settings.

Installation

  1. Clone this repository.
  2. Install dependencies:
    uv sync
    

Configuration

  1. Copy .env.example to .env:

    cp .env.example .env
    
  2. Edit .env with your MySQL and Feishu credentials:

    MYSQL_HOST=localhost
    MYSQL_PORT=3306
    MYSQL_USER=your_username
    MYSQL_PASSWORD=your_password
    MYSQL_DATABASE=your_database
    
    # Optional: MySQL SSL
    MYSQL_USE_SSL=false
    MYSQL_SSL_CA=/path/to/ca-cert.pem
    
    # Feishu MCP
    FEISHU_MCP_URL=https://mcp.feishu.cn/mcp
    FEISHU_OPEN_API_URL=https://open.feishu.cn/open-apis
    FEISHU_MCP_APP_ID=cli_xxx
    FEISHU_MCP_APP_SECRET=xxx
    FEISHU_MCP_ALLOWED_TOOLS=search-doc,fetch-doc,create-doc,update-doc
    

FEISHU_MCP_APP_ID and FEISHU_MCP_APP_SECRET are used to request tenant access token dynamically before each Feishu MCP call.

Usage

Run the MCP server:

mcp-tm

Tools

read_sql

Executes a SQL query and returns the results as JSON.

  • Arguments:
    • query_sql (string): The SQL query to execute (e.g., "SELECT * FROM users LIMIT 10").
  • Returns:
    • JSON string of the query results.

feishu_list_tools

Lists available Feishu MCP tools under the configured credentials and allowed tool set.

  • Arguments:
    • allowed_tools (string, optional): Comma-separated tool names for this call only.
  • Returns:
    • JSON-RPC response string from Feishu MCP.

feishu_call_tool

Calls a specific Feishu MCP tool.

  • Arguments:
    • tool_name (string): Tool name to call, for example fetch-doc.
    • arguments_json (string): JSON object string for tool arguments.
    • allowed_tools (string, optional): Comma-separated tool names for this call only.
  • Returns:
    • JSON-RPC response string from Feishu MCP.

feishu_read_sheet

Reads data from a Feishu Sheet range.

  • Arguments:
    • spreadsheet_token (string): Spreadsheet token in URL.
    • sheet_id (string): Sheet ID in URL.
    • range_ref (string, optional): Range part for API path. Empty means reading by sheet_id.
  • Returns:
    • Open API JSON response string.

feishu_write_sheet

Writes data to a Feishu Sheet.

  • Arguments:
    • spreadsheet_token (string): Spreadsheet token in URL.
    • sheet_id (string): Sheet ID in URL.
    • values_json (string): JSON string of either 2D array or object array.
    • start_cell (string, optional): Start cell like A1.
    • clear_sheet (bool, optional): Clear existing used range before write.
  • Returns:
    • JSON string with write result and write range.

feishu_read_bitable

Reads records from a Feishu Bitable table.

  • Arguments:
    • app_token (string): Bitable app token.
    • table_id (string): Bitable table ID.
    • page_size (int, optional): Page size (max 500).
  • Returns:
    • JSON string containing all fetched records.

feishu_write_bitable

Batch writes records into a Feishu Bitable table.

  • Arguments:
    • app_token (string): Bitable app token.
    • table_id (string): Bitable table ID.
    • records_json (string): JSON object array. Keys should match field names.
    • clear_table (bool, optional): Delete existing records before write.
  • Returns:
    • JSON string with summary including written records and ignored fields.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_tm-0.2.1.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_tm-0.2.1-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file mcp_tm-0.2.1.tar.gz.

File metadata

  • Download URL: mcp_tm-0.2.1.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for mcp_tm-0.2.1.tar.gz
Algorithm Hash digest
SHA256 f51bfc4effb53cdebcec78e313696c3b4517f6bee2504c03b8773f2d2c24b5c9
MD5 5770edbf6e29b6b6e054d76392e60b2a
BLAKE2b-256 d3e1dff7ccdc196cf8c069ca43b241072e3d062b4e5793306890f7fbd3a6171f

See more details on using hashes here.

File details

Details for the file mcp_tm-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: mcp_tm-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for mcp_tm-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5650568b45586438e8172322d94d1bf621b5a74819065276f96298e71cf013fe
MD5 bb538df05e29cf5289c7c25d2a7f1a77
BLAKE2b-256 9763d0435b881b86c36e4495619015f8afb72207a8013a2733626ec3657d6792

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page