anhtuanluu

My MCP Server

Community anhtuanluu
Updated

My MCP Server

MCP Server xây dựng bằng FastMCP (Python ≥ 3.11), phục vụ domain banking / fintech.

Cấu trúc

server.py          — Entry point, mount sub-servers
tools/             — @tool: mỗi file là 1 sub-server FastMCP
resources/         — @resource: dữ liệu LLM đọc (read-only)
prompts/           — @prompt: prompt templates tái sử dụng
models/schemas.py  — Pydantic models chia sẻ
utils/helpers.py   — Decorator, sanitization, logging
tests/             — pytest-asyncio

Cài đặt

uv venv .venv && source .venv/bin/activate
uv pip install -r requirements-dev.txt
cp .env.example .env  # điền các biến môi trường cần thiết

Chạy

python server.py

Server mặc định tại http://0.0.0.0:8000 (cấu hình qua MCP_HOST, MCP_SERVER_PORT).

Kiểm tra tools

fastmcp dev server.py

Test & Lint

pytest
ruff check . && ruff format .
mypy .

Sub-servers

Namespace Mô tả
db Database queries
git Git read-only operations
deploy Deployment tools
config Configuration resources
prompts Prompt templates

Bảo mật

  • Secrets qua .env, không hardcode trong code
  • Mọi input qua sanitize_input() trước khi dùng
  • Không deploy tag latest lên production
  • Structured logging (JSON) — không log thông tin nhạy cảm

MCP Server · Populars

MCP Server · New