银行操作服务器

一个基于FastAPI构建的安全银行操作服务器,提供账户管理、存款、取款等银行工具,适用于AI代理和MCP兼容客户端。

  • by lakshayknows
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 lakshayknows/banking-operations-mcp-server

使用说明

🏦 MCP银行服务器

安全 模型上下文协议(MCP) 使用FastAPI构建的服务器,提供银行业务。该服务器公开了可供Claude、GPT和其他MCP兼容客户端等AI代理使用的银行工具。

🌟 特性

工具 说明
create_account 创建一个新的银行账户,包括姓名、电子邮件和可选的初始存款
deposit 将资金存入现有账户
withdraw 通过余额验证提取资金
get_balance 检查活期账户余额
get_transactions 查看带有分页的交易历史记录
list_accounts 列出所有活动帐户

🛠️ 技术栈

  • 快速API -高性能web框架
  • SQLite -轻量级嵌入式数据库
  • MCP协议 -原生JSON-RPC支持
  • 安全 -API密钥验证

🚀 快速开始

先决条件

  • Python 3.9或更高版本
  • pip包管理器

安装

# Clone the repository
git clone https://github.com/lakshayknows/banking-operations-mcp-server.git
cd banking-operations-mcp-server

# Install dependencies
pip install -r requirements.txt

运行服务器

# Run with default API key (mcp-demo-key)
python app.py

# Or set a custom API key
export API_KEY="your-secret-key"
python app.py

服务器将在 http://localhost:7860

🔐 安全

此服务器受API密钥身份验证保护。

  • 头球 X-API-Key
  • 默认密钥: mcp-demo-key

ArmorIQ扫描

此服务器符合ArmorIQ安全标准。

  • ✅ 未检测到漏洞
  • ✅ 已启用身份验证
  • ✅ 输入验证

📖 API 参考

REST端点

  • GET / -登录页面
  • GET /docs -Swagger用户界面文档
  • GET /health -健康检查

MCP协议端点

  • POST /mcp -JSON-RPC端点(初始化、工具/列表、工具/调用)
  • GET /mcp/tools -列出可用工具
  • POST /mcp/tools/call -执行工具

🧪 测试

使用curl

# List tools
curl -X GET http://localhost:7860/mcp/tools \
  -H "X-API-Key: mcp-demo-key"

# Call a tool
curl -X POST http://localhost:7860/mcp/tools/call \
  -H "Content-Type: application/json" \
  -H "X-API-Key: mcp-demo-key" \
  -d '{
    "name": "create_account",
    "arguments": {
      "name": "John Doe",
      "email": "john@example.com"
    }
  }'

🐳 Docker部署

# Build the image
docker build -t mcp-banking-server .

# Run the container
docker run -p 7860:7860 -e API_KEY=your-secret-key mcp-banking-server

☁️ 云部署

拥抱面部空间

  1. 在上创建新空间 拥抱脸
  2. 选择“Docker”作为SDK
  3. 上传存储库文件
  4. 服务器将在您的共享空间URL上可用

📝 许可证

麻省理工学院许可证-您可以自由使用此项目进行学习和发展。