Skip to main content

ECS Contract MCP Server

ECS 合約管理系統的 MCP (Model Context Protocol) Server,讓 Claude Desktop 能夠安全地查詢合約資料庫。

安裝方式

方式一:使用 uvx(推薦)

最簡單的安裝方式,不需要手動管理 Python 環境。

uvx ecs-contract-mcp

方式二:使用 pip

pip install ecs-contract-mcp

Claude Desktop 配置

Windows 11

步驟 1:安裝前置需求

  1. 安裝 uv(Python 套件管理器)

    # 使用 PowerShell(管理員權限)
    irm https://astral.sh/uv/install.ps1 | iex
    

    或

    pip install uv
    
  2. 安裝 ODBC Driver 18 for SQL Server

步驟 2:配置 Claude Desktop

編輯配置檔(路徑:%APPDATA%\Claude\claude_desktop_config.json):

{
  "mcpServers": {
    "ecs": {
      "command": "C:\\Users\\你的使用者名稱\\.local\\bin\\uvx.exe",
      "args": ["ecs-contract-mcp"],
      "env": {
        "DB_SERVER": "your_server_address",
        "DB_NAME": "your_database_name",
        "DB_USER": "your_username",
        "DB_PASSWORD": "your_password"
      }
    }
  }
}

注意:請將 你的使用者名稱 替換為你的 Windows 使用者名稱。

步驟 3:重啟 Claude Desktop

關閉並重新開啟 Claude Desktop,即可使用。


macOS

步驟 1:安裝前置需求

  1. 安裝 uv

    curl -LsSf https://astral.sh/uv/install.sh | sh
    

    或

    brew install uv
    
  2. 安裝 ODBC Driver 18 for SQL Server

    # 安裝 Homebrew(如果還沒有)
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    
    # 加入 Microsoft 套件來源
    brew tap microsoft/mssql-release https://github.com/Microsoft/homebrew-mssql-release
    brew update
    
    # 安裝 ODBC Driver
    HOMEBREW_ACCEPT_EULA=Y brew install msodbcsql18
    

步驟 2:配置 Claude Desktop

編輯配置檔(路徑:~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "ecs": {
      "command": "uvx",
      "args": ["ecs-contract-mcp"],
      "env": {
        "DB_SERVER": "your_server_address",
        "DB_NAME": "your_database_name",
        "DB_USER": "your_username",
        "DB_PASSWORD": "your_password"
      }
    }
  }
}

步驟 3:重啟 Claude Desktop

關閉並重新開啟 Claude Desktop,即可使用。


環境變數說明

變數 必填 預設值 說明
DB_SERVER ✅ - SQL Server 主機位址
DB_NAME ✅ - 資料庫名稱
DB_USER ✅ - 資料庫使用者帳號
DB_PASSWORD ✅ - 資料庫密碼
DB_DRIVER ❌ ODBC Driver 18 for SQL Server ODBC 驅動程式名稱
LOG_LEVEL ❌ INFO 日誌等級(DEBUG/INFO/WARNING/ERROR)
MAX_ROWS ❌ 1000 查詢結果上限筆數

驗證安裝

在 Claude Desktop 中輸入:

請執行 health_check 確認 MCP Server 連線狀態

如果配置正確,會回傳資料庫連線狀態。


常見問題

Windows

問題 解決方案
uvx 指令找不到 重新開啟 PowerShell,或檢查 PATH 環境變數
ODBC Driver 找不到 確認已安裝 "ODBC Driver 18 for SQL Server"
連線逾時 確認防火牆允許連線到 SQL Server(預設 Port 1433)

macOS

問題 解決方案
uvx 指令找不到 執行 source ~/.zshrc 或重開終端機
ODBC Driver 安裝失敗 嘗試 brew update && brew upgrade 後重試
SSL 憑證錯誤 環境變數已設定 TrustServerCertificate=yes

開發者指南

本地開發

# Clone 專案
git clone https://github.com/your-org/ECS.git
cd ECS

# 建立虛擬環境
python -m venv .venv
source .venv/bin/activate  # macOS/Linux
# 或
.venv\Scripts\activate     # Windows

# 安裝開發依賴
pip install -e ".[dev]"

# 複製環境設定
cp .env.example .env
# 編輯 .env 填入資料庫連線資訊

# 執行測試
pytest

# 啟動 MCP Server
python -m mcp_server

專案結構

mcp_server/
├── server.py              # MCP Server 入口
├── config.py              # 環境變數配置
├── database/              # 資料庫連線與查詢
├── resources/             # MCP Resources(背景知識)
├── tools/                 # MCP Tools(查詢能力)
├── prompts/               # MCP Prompts(分析指引)
└── utils/                 # 工具函數

文件


授權

本專案為內部使用。


連結

Metadata

Release files for ecs-contract-mcp 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ecs-contract-mcp 0.1.2
File Size Uploaded Provenance
ecs_contract_mcp-0.1.2.tar.gz 245.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for ecs-contract-mcp 0.1.2
File Interpreter ABI Platform
ecs_contract_mcp-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 279.6 kB

Release files / ecs_contract_mcp-0.1.2.tar.gz

Download URL ecs_contract_mcp-0.1.2.tar.gz
Size 245.1 kB
Tags Source
SHA-256 checksum
How to use checksums
9a5393f7bdf51ec4e98ccef9946f6c0aa9384935e522341eef3fbfe8f3854d6a
BLAKE2b-256 checksum
How to use checksums
85e8b019afc89f2cc9b676ff60ec72b721615aa1f3227d9377da10ec0badef28
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.17

Release files / ecs_contract_mcp-0.1.2-py3-none-any.whl

Download URL ecs_contract_mcp-0.1.2-py3-none-any.whl
Size 34.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fcd70f2788b6476555fd88c73fc9765012f2562cb8b5ef052e712d38b79e8278
BLAKE2b-256 checksum
How to use checksums
2aa04047dd09ae3be19f49f2d97662e7c2a3390a54e467624c4dfb5464d6860c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.17

Security for ecs-contract-mcp 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page