Skip to main content
Glama
PraneethGoud04

ParcelPilot MCP Server

📦 ParcelPilot AI

基于 LangGraph、MCP、Agentic RAG 和 Streamlit 构建的智能客户支持运营智能体。

ParcelPilot AI 可以检索客户/账户/订单/工单信息,通过混合检索回答政策类问题,应用客户专属协议,并在状态改变操作执行前强制要求确认。

✨ 功能特性

  • 基于 LangGraph 的智能体编排

  • 基于 Streamable HTTP 的远程 FastMCP 服务器

  • 9 个面向客户支持运营的 MCP 工具

  • 使用 Chroma + BM25 的混合式 Agentic RAG

  • 客户专属协议检索

  • 来源权威性与文档优先级处理

  • 支持账户、订单和工单的结构化 Excel 数据

  • 模拟的基于角色的访问控制

  • 对升级和后续动作进行的人机协同确认

  • 用于与智能体互动的 Streamlit 界面

Related MCP server: Enterprise MCP Gateway

🏗️ 架构

                    ┌─────────────────────┐
                    │   Streamlit App     │
                    │      app.py         │
                    └──────────┬──────────┘
                               │
                               │ MCP / HTTP
                               ▼
                    ┌─────────────────────┐
                    │   FastMCP Server     │
                    │   mcp_server.py      │
                    └──────────┬──────────┘
                               │
              ┌────────────────┼────────────────┐
              │                │                │
              ▼                ▼                ▼
       Structured Data    Agentic RAG       Security
       Excel workbook    Chroma + BM25     Access checks
              │                │
              └────────────────┼────────────────┘
                               ▼
                    Grounded Tool Results
                               │
                               ▼
                         LangGraph Agent
                               │
                               ▼
                         Final Response

🔧 MCP 工具

MCP 服务器提供以下工具:

  1. get_account

  2. get_order

  3. get_ticket

  4. search_knowledge

  5. search_customer_agreement

  6. calculate_service_credit

  7. prepare_escalation

  8. execute_escalation

  9. create_followup

改变状态的操作在执行前需要经过一个确认步骤。

📚 Agentic RAG

检索流水线结合了以下内容:

User Query
    ↓
Chroma Semantic Retrieval
    +
BM25 Keyword Retrieval
    ↓
Source Authority
    ↓
Customer-Aware Ranking
    ↓
Conflict / Precedence Handling
    ↓
Grounded Evidence
    ↓
LLM Answer

文档优先级:

  1. 当前已签署的客户协议

  2. 当前有效的 ParcelPilot 政策/标准操作流程(SOP)

  3. 其他有效文档

已废弃文档具有较低优先级,不应覆盖当前有效来源。

📁 项目结构

ParcelPilot/
│
├── app.py
├── mcp_server.py
├── PARCELPILOT.ipynb
├── ParcelPilot_Assessment_Data.xlsx
│
├── 01_Support_Policy_v3_CURRENT.pdf
├── 02_Support_Policy_v2_DEPRECATED.pdf
├── 03_Cancellation_and_Service_Credit_SOP_v4.pdf
├── 04_Product_Operations_Guide_and_Known_Issues.pdf
├── 05_Northstar_Logistics_Enterprise_Agreement.pdf
├── 06_LumenWorks_Service_Agreement.pdf
│
├── pyproject.toml
└── README.md

⚙️ 设置

1. 克隆仓库

git clone <YOUR_GITHUB_REPOSITORY_URL>
cd ParcelPilot

2. 安装依赖

本项目使用 pyproject.toml。

使用 uv:

uv sync

或者,在你喜欢的 Python 环境中安装所需的依赖包。

3. 创建 .env

在项目根目录下创建 .env 文件:

OPENAI_API_KEY=your_openai_api_key
PARCELPILOT_USER=support_agent
MCP_HOST=0.0.0.0
MCP_PORT=8000

对于 Streamlit 客户端,设置 MCP URL:

PARCELPILOT_MCP_URL=http://127.0.0.1:8000/mcp

请不要将 .env 文件或 API 密钥提交到 GitHub。

▶️ 运行 MCP 服务器

先启动 MCP 服务器:

uv run python mcp_server.py

服务器运行于:

http://127.0.0.1:8000/mcp

你应该会在终端中看到 ParcelPilot MCP 服务器的启动信息。

▶️ 运行 Streamlit

在另一个终端中:

uv run streamlit run app.py

打开终端中显示的 Streamlit 地址,通常是:

http://localhost:8501

🔐 原型访问控制

本提交包含模拟的已认证用户上下文,用于演示授权行为。

支持的原型用户包括:

support_agent
customer_acct_002
customer_acct_003
admin

服务器通过 PARCELPILOT_USER 来选择当前的原型用户。

在生产系统中,这部分将替换为真实的认证与授权机制,例如身份提供商签发的令牌、租户/账户声明以及服务端权限检查。

🧑💼 人工参与环节(Human-in-the-Loop)

对于改变状态的操作,智能体会先准备该操作。

例如:

User
  ↓
prepare_escalation
  ↓
Preview
  ↓
Explicit confirmation
  ↓
execute_escalation

该原型在执行过程中不会修改持久化的运营数据。

🧪 示例查询

可在 Streamlit 应用中尝试以下查询:

What is the current status of ORD-1001?

Show me the account details for ACCT-001.

What is the cancellation fee for a BOOKED shipment?

Can Northstar Logistics cancel a BOOKED shipment without a fee?

What is Northstar Logistics' P1 response target?

What are the failed-pickup service-credit rules for LumenWorks?

What is the current Enterprise P1 response target?

Escalate ticket TKT-501 because the customer needs urgent assistance.

在升级(escalation)示例中,智能体应准备升级内容,并在执行前请求确认。

🎯 产品决策

该方案着重在降低客服人员工作量的同时,保持运营操作的可控性。

关键决策:

  • 使用 MCP 将智能体与运营工具分离。

  • 将检索能力保留在 MCP 服务器内部,而不是在 UI 中重复实现。

  • 将结构化数据检索与文档检索结合起来。

  • 客户协议高于通用政策的优先级。

  • 要求对执行状态变更的操作进行明确确认。

  • 在工具层实施权限检查,而不是仅依赖 UI。

🚀 未来改进

如果继续开发,我会优先考虑以下方面:

  1. 生产环境的认证与多租户隔离

  2. 为所有工具调用和操作持久化审计日志

  3. 通过链路 API 进行真实的工单/订单更新

  4. 强化检索评估与自动化 RAG 测试

  5. 对延迟、工具故障及答案质量的可观测性

  6. 面向高风险操作的审批流程

  7. 支持分析与客户风险检测

📊 成功指标

一个主要的产品指标是:

每张工单的支持解决时间

目标是降低平均解决时间,同时保持高准确性,并防止未经授权或错误的运营操作。

📌 提交

演示视频

https://drive.google.com/file/d/1gTZlT4bx4oSflD68SWqcN6-uHPtcaT8l/view?usp=sharing


作为 ParcelPilot 评估原型构建。

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables AI agents to securely access and act on CRM, order, support, and automation systems through the Model Context Protocol, with authentication, authorization, audit logging, and guardrails.
    MIT
  • F
    license
    Not graded
    quality
    C
    maintenance
    Enables AI agents to securely call enterprise MCP tools with tenant-scoped RBAC, human approvals, audit logging, and multi-tool workflows across customer, order, document, and ticket data.
    -
  • A
    license
    A
    quality
    B
    maintenance
    Enables AI agents to securely query, search, and modify Salesforce data through standard Salesforce APIs, including record CRUD, SOQL/SOSL search, Bulk API 2.0 operations, composite calls, object discovery, and custom Apex REST endpoints.
    15
    MIT