x

xjxjin

@xjxjin/fx-mcp
0 Stars 8 次浏览 xjxjin 更新于 2026-08-23
该服务暂未提供标准配置,请参考 README 手动接入

服务介绍

FastMCP PostgreSQL Query Service

This is a PostgreSQL database query service built using FastMCP, supporting queries on two tables: Chery Exeed Cars FAQ (cheery_exeedcars_faq) and System Menu (sys_menu).

Features

  • Supports querying FAQ data by question keywords, ticket type, and issue category.
  • Supports querying menu data by menu name, parent ID, menu type, and disabled status.
  • Provides functionality to query statistics for FAQs and menus.
  • Based on Docker containerization, including the PostgreSQL database and FastMCP application.
  • Automatically initializes the database table structure and sample data.
  • Supports multiple MCP connection methods: STDIO, Streamable HTTP, and SSE.

Quick Start

Prerequisites

  • Install Docker and Docker Compose
  • Ensure that ports 5432 and 8080 are not in use

Deployment Steps

  1. Clone this repository

bash
git clone
cd

  1. Start the services

bash
docker-compose up -d

  1. Verify the services

The FastMCP service will run on port 8080, and the PostgreSQL database will run on port 5432. You can access the MCP service via the following URLs:

  • HTTP endpoint: http://localhost:8080/mcp
  • SSE endpoint: http://localhost:8080/mcp/sse

Configuration Instructions

Custom configurations can be made by modifying the environment variables in the .env file or docker-compose.yml:

  • Database configuration:

    • DB_USER: Database username
    • DB_PASSWORD: Database password
    • DB_HOST: Database hostname
    • DB_PORT: Database port
    • DB_NAME: Database name
  • Server configuration:

    • TRANSPORT_MODE: Transport mode, with options being stdio or http (default)
    • HOST: Server hostname, default is 0.0.0.0
    • PORT: Server port, default is 8080

Available Tools

The FastMCP service provides the following tools:

  1. query_faq - Query Chery Exeed Cars FAQ data
  2. query_menu - Query system menu data
  3. get_faq_statistics - Get FAQ data statistics
  4. get_menu_statistics - Get menu data statistics

Database Table Structure

cheery_exeedcars_faq (Chery Exeed Cars FAQ)

Column Name Type Description
id int4 Primary key ID
question text Question
answer text Answer
ticket_type varchar(255) Ticket type
issue_module varchar(255) Issue category
create_at timestamp(6) Creation time

sys_menu (System Menu Table)

Column Name Type Description
menu_id int8 Menu ID (primary key)
parent_id int8 Parent menu ID, 0 if no parent
menu_name varchar(100) Menu name
menu_icon varchar(255) Menu icon
menu_url varchar(255) Menu route
menu_type varchar(255) Type 0-Application 1-Menu 2-Button
is_outside char(1) Whether it's an external link 0-Internal 1-External
is_disable char(1) Whether it's disabled 0-Not disabled 1-Disabled
create_time timestamp(6) Creation time
create_user int8 Creator
last_edit_time timestamp(6) Last edit time
last_edit_user int8 Last editor
sort int2 Sort order

Usage Examples

Client Connection Methods

Depending on the client's requirements, there are several ways to connect:

1. Python Client

python
from fastmcp import Client

async def main():
# STDIO connection (command-line tool)
async with Client("./app.py") as client:
result = await client.call_tool("query_faq", {"question": "tire"})

# HTTP connection (web service)
async with Client("http://localhost:8080/mcp") as client:
    result = await client.call_tool("query_menu", {"parent_id": 1})

# SSE connection (web service)
async with Client("http://localhost:8080/mcp/sse") as client:
    result = await client.call_tool("get_faq_statistics")

2. Dify Integration

In Dify, when configuring the MCP tool connection, you can use the following URLs:

  • HTTP mode: http://server IP:8080/mcp
  • SSE mode: http://server IP:8080/mcp/sse

Tool Invocation Examples

Querying FAQ Data

python

Query FAQs containing the keyword "tire"

result = await client.call_tool("query_faq", {"question": "tire"})

Query FAQs with ticket type "Technical Support"

result = await client.call_tool("query_faq", {"ticket_type": "Technical Support"})

Query FAQs with issue module "Intelligent System", limit to 5 results

result = await client.call_tool("query_faq", {"issue_module": "Intelligent System", "limit": 5})#### Query Menu Data

python

Query menus with parent ID 1

result = await client.call_tool("query_menu", {"parent_id": 1})

Query menus where the menu name contains "管理"

result = await client.call_tool("query_menu", {"menu_name": "管理"})

Query menus of type "1" that are not disabled

result = await client.call_tool("query_menu", {"menu_type": "1", "is_disable": "0"})

Get Statistics Information

python

Get FAQ statistics

faq_stats = await client.call_tool("get_faq_statistics")

Get menu statistics

menu_stats = await client.call_tool("get_menu_statistics")

相关 MCP 服务