监管运营助理
一个强大的CLI工具,将Claude AI与模型上下文协议(MCP)服务器集成在一起,用于监管合规查询。具有智能工具调用、对话历史和漂亮的彩色终端界面。
特性
✨ 智能MCP集成 -通过MCP将Claude与监管数据无缝连接\ 🎨 彩色终端 -易于阅读的颜色编码输出\ 🔄 对话历史 -跨查询维护上下文\ 🛠️ 灵活配置 -配置路径和设置的多种方法\ ⚡ 交互式和批处理模式 -交互式使用或用于单个查询\ 🔍 内置工具 -检查法规、搜索指南、分析产品
快速开始
先决条件
- Python 3.8或更高版本(推荐3.12)
- 无烟煤API键
- MCP服务器脚本(
server.py)
安装
# Clone the repository
cd ~/projects/regulatory-mcp/server
# Copy files
# - regulatory_assistant.py
# - setup.py
# - config_template.py (optional)
# Run setup
python3.12 setup.py
# This will:
# ✓ Detect your Python executable
# ✓ Find your server.py
# ✓ Create config.py
# ✓ Test the configuration用法
交互模式:
python3.12 regulatory_assistant.py
You: Is FX NDF reportable to CFTC?
You: What are EMIR requirements for CFDs?
You: quit单个查询:
python3.12 regulatory_assistant.py -q "Is CFD reportable to CFTC?"使用选项:
python3.12 regulatory_assistant.py \
-s /path/to/server.py \
--python /path/to/python3 \
--no-color配置
选项1:自动设置(推荐)
python3.12 setup.py选项2:手动config.py
创建 config.py 从 config_template.py:
import sys
from pathlib import Path
PYTHON_EXECUTABLE = sys.executable
PROJECT_ROOT = Path(__file__).parent.absolute()
SERVER_SCRIPT = PROJECT_ROOT / "server.py"
ANTHROPIC_API_KEY = None # Uses env var选项3:环境变量
export ANTHROPIC_API_KEY="sk-ant-..."
python3.12 regulatory_assistant.py选项4:命令行
python3.12 regulatory_assistant.py \
--python /usr/local/bin/python3.12 \
-s ~/projects/server.py配色方案
助手使用颜色来提高可读性:
- 🔵 蓝色(粗体) -您的问题
- 🟢 绿色(粗体) -助理答复
- 🟣 品红 -MCP工具调用
- ⚪ 格雷 -系统消息
- 🔴 红 -错误消息
- 🟡 黄色 -帮助/警告
- 🔷 青色 -标题
预览颜色:
python3 color_preview.py禁用颜色:
python3.12 regulatory_assistant.py --no-color项目结构
regulatory-mcp/
├── server.py # MCP server (your implementation)
├── regulatory_assistant.py # Main CLI wrapper
├── config.py # Auto-generated config (gitignored)
├── config_template.py # Config template
├── setup.py # Easy setup script
├── color_preview.py # Color scheme preview
├── configure_python.sh # Shell config helper
├── run_assistant.sh # Bash launcher
├── README.md # This file
├── QUICKSTART.md # Quick start guide
├── SETUP_GUIDE.md # Detailed setup guide
├── COLOR_GUIDE.md # Color customization
├── UPDATES.md # Changelog
├── .gitignore # Git ignore rules
└── requirements.txt # Python dependencies命令
交互模式
quit或exit-退出助手clear-清除对话历史记录help-显示示例查询
命令行选项
-s, --server PATH Path to MCP server script
-q, --query "TEXT" Single query mode
--python PATH Python executable for MCP server
--no-color Disable colored output
--help Show help messageMCP工具
该助手与以下MCP工具集成:
- check_regulation -检查产品是否符合法规要求
- 搜索指南 -跨产品/法规搜索监管指导
- get_product_regulations -获取适用于产品的所有法规
例子
检查可报告性
You: Is interest rate swap reportable to EMIR?搜索指南
You: What are the CFTC requirements for FX forwards?产品分析
You: Show me all regulations for equity swaps复杂查询
You: Compare EMIR and CFTC reporting requirements for CFDs故障排除
找不到Python
错误: FileNotFoundError: 'python'
解决方案:
# Option 1: Run setup
python3.12 setup.py
# Option 2: Use --python flag
python3.12 regulatory_assistant.py --python $(which python3.12)
# Option 3: Set up .zshrc alias
echo "alias python3='/path/to/python3.12'" >> ~/.zshrc
source ~/.zshrc找不到服务器
错误: FileNotFoundError: server.py not found
解决方案:
# Option 1: Run from server directory
cd ~/projects/regulatory-mcp/server
python3.12 regulatory_assistant.py
# Option 2: Use -s flag
python3.12 regulatory_assistant.py -s /path/to/server.py
# Option 3: Run setup
python3.12 setup.py丢失的包裹
错误: ModuleNotFoundError: No module named 'mcp'
解决方案:
pip install -r requirements.txt
# Or individually
pip install mcp anthropic --break-system-packages检查配置
# View current config
python3 config.py
# Test connection
python3.12 regulatory_assistant.py -q "test"发展
运行测试
# Test basic functionality
python3.12 regulatory_assistant.py -q "test query"
# Test colors
python3 color_preview.py
# Verify config
python3 config.py调试模式
# See detailed output
python3.12 -u regulatory_assistant.py环境设置
适用于macOS/Linux
# Set Python path in .zshrc
echo 'alias python3="/usr/local/bin/python3.12"' >> ~/.zshrc
source ~/.zshrc
# Set API key
echo 'export ANTHROPIC_API_KEY="sk-ant-..."' >> ~/.zshrc
source ~/.zshrc用于虚拟环境
# Create venv
python3.12 -m venv venv
# Activate
source venv/bin/activate # macOS/Linux
venv\Scripts\activate # Windows
# Install dependencies
pip install -r requirements.txt
# Run
python regulatory_assistant.py贡献
- 复刻仓库
- 创建要素分支(
git checkout -b feature/amazing-feature) - 提交您的更改(
git commit -m 'Add amazing feature') - 推到分支(
git push origin feature/amazing-feature) - 打开拉取请求
许可证
\[在此处指定您的许可证\]
支持
对于问题、疑问或贡献:
- 在GitHub上打开一个问题
- 查看故障排除指南
- 查看安装文档
致谢
- 内置于 安thropic克劳德
- 用途 模型上下文协议(MCP)
- 通过ANSI转义码显示终端颜色
______________________________________________________________________
版本: 1.0.0\ 最后更新时间: 2024年12月\ python 3.8+(推荐3.12)
