Skip to main content
Glama
Abhinav-pyth

Banking Model Context Protocol Server

by Abhinav-pyth

集成 MCP 的银行聊天机器人

一个复杂的银行聊天机器人应用程序,使用 Azure OpenAI 和模型上下文协议 (MCP) 实现安全高效的消息处理。

特征

  • 人工智能银行助手:使用 Azure OpenAI 为银行查询提供智能响应

  • 模型上下文协议(MCP) :实现安全消息通信协议

  • 实时聊天界面:现代、响应式的用户界面,可实现无缝的用户交互

  • 全面的日志记录:用于监控和调试的详细日志系统

  • 银行信息集成:动态显示银行详细信息和服务

  • Markdown 支持:响应的富文本格式

Related MCP server: agent-messaging

项目结构

.
├── app.py                  # Main Flask application
├── mcp_server.py          # MCP server implementation
├── mcp_client.py          # MCP client implementation
├── requirements.txt       # Python dependencies
├── .env                   # Environment variables
├── templates/             # HTML templates
│   └── index.html        # Chat interface
└── logs/                 # Log files
    ├── client_messages.log
    ├── mcp_client.log
    └── mcp_server.log

先决条件

  • Python 3.8 或更高版本

  • Azure OpenAI API 访问

  • 所需的 Python 包(请参阅 requirements.txt)

安装

  1. 克隆存储库:

    git clone <repository-url>
    cd banking-chatbot
  2. 创建并激活虚拟环境:

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  3. 安装依赖项:

    pip install -r requirements.txt
  4. 使用您的凭证创建一个.env文件:

    ENDPOINT_URL=your_azure_endpoint
    AZURE_OPENAI_API_KEY=your_api_key
    DEPLOYMENT_NAME=your_deployment_name

用法

  1. 启动 MCP 服务器:

    python mcp_server.py
  2. 在新的终端中,启动 Flask 应用程序:

    python app.py
  3. 访问聊天机器人界面http://localhost:5000

MCP 协议

模型上下文协议 (MCP) 用于处理聊天机器人与服务器之间的消息通信。它提供:

  • 安全消息传输

  • 消息队列和可靠性

  • 详细日志记录

  • 实时消息处理

消息类型

  • 聊天消息:用户查询和 AI 响应

  • 系统消息:管理和控制消息

日志记录

应用程序在logs目录中维护详细日志:

  • client_messages.log :聊天消息历史记录

  • mcp_client.log :客户端连接和操作日志

  • mcp_server.log :服务器操作日志

银行信息

该聊天机器人配置了全面的银行信息,包括:

  • 营业时间

  • 分支机构

  • 可用服务

  • 联系信息

  • 支持渠道

发展

添加新功能

  1. 更新app.py中的BANK_INFO字典以获取新的银行信息

  2. 修改SYSTEM_MESSAGE以更新 AI 行为

  3. 在mcp_client.py中添加新的消息处理程序以获得附加功能

测试

运行测试客户端来验证 MCP 功能:

python test_client.py

清除测试日志:

python clear_logs.py

安全

  • API 密钥和敏感信息存储在.env中

  • MCP 提供安全的消息传输

  • 实现输入验证和错误处理

贡献

  1. 分叉存储库

  2. 创建功能分支

  3. 提交你的更改

  4. 推送到分支

  5. 创建拉取请求

执照

该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅 LICENSE 文件。

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables async, authenticated messaging between AI agents with explicit authorization and persistent inbox.
    3 npm
    MIT
  • A
    license
    Not graded
    quality
    F
    maintenance
    Enables asynchronous messaging between AI agents, including sending messages, proposals, and managing threaded conversations using the Model Context Protocol.
    1
    MIT
  • A
    license
    Not graded
    quality
    A
    maintenance
    A threaded message relay for ChatGPT and local coding agents, enabling message exchange and file sharing via MCP and REST APIs.
    2 npm
    1
    Apache 2.0
  • A
    license
    Not graded
    quality
    A
    maintenance
    Enables bidirectional messaging between Claude Code and Codex Desktop through a SQLite-backed bus, so messages sent from either side appear in the other's chat pane, with acknowledgement and redelivery semantics.
    16 npm
    MIT