ECS Contract Management MCP Server
Project description
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:安裝前置需求
-
安裝 uv(Python 套件管理器)
# 使用 PowerShell(管理員權限) irm https://astral.sh/uv/install.ps1 | iex
或
pip install uv
-
安裝 ODBC Driver 18 for SQL Server
- 下載連結:https://go.microsoft.com/fwlink/?linkid=2249006
- 執行安裝程式,使用預設選項即可
步驟 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:安裝前置需求
-
安裝 uv
curl -LsSf https://astral.sh/uv/install.sh | sh
或
brew install uv
-
安裝 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/ # 工具函數
文件
授權
本專案為內部使用。
連結
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ecs_contract_mcp-0.1.2.tar.gz.
File metadata
- Download URL: ecs_contract_mcp-0.1.2.tar.gz
- Upload date:
- Size: 245.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a5393f7bdf51ec4e98ccef9946f6c0aa9384935e522341eef3fbfe8f3854d6a
|
|
| MD5 |
f80292d500ea724fc73206104f28e65c
|
|
| BLAKE2b-256 |
85e8b019afc89f2cc9b676ff60ec72b721615aa1f3227d9377da10ec0badef28
|
File details
Details for the file ecs_contract_mcp-0.1.2-py3-none-any.whl.
File metadata
- Download URL: ecs_contract_mcp-0.1.2-py3-none-any.whl
- Upload date:
- Size: 34.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fcd70f2788b6476555fd88c73fc9765012f2562cb8b5ef052e712d38b79e8278
|
|
| MD5 |
58a1831e15356d65cb2214d2bc824e5b
|
|
| BLAKE2b-256 |
2aa04047dd09ae3be19f49f2d97662e7c2a3390a54e467624c4dfb5464d6860c
|