Skip to main content
Glama
pbpeter

Enterprise Support MCP Server

by pbpeter

Enterprise Support MCP 服务器

一个轻量级的 企业 AI 集成原型,演示如何通过 模型上下文协议(MCP) 将业务能力暴露给大语言模型。

该项目通过基于 Python 的 MCP 服务器提供客户和订单信息。一个 Mistral 驱动的 AI 助手 动态发现可用的 MCP 工具,并根据自然语言的支持请求决定调用哪些工具。

对于更复杂的请求,助手可以迭代执行多个工具调用,直到获取足够信息来生成最终响应。

本项目使用的所有客户和订单记录均为合成演示数据。


主要功能

  • 模型上下文协议(MCP)服务器和客户端

  • 动态 MCP 工具发现

  • 使用 Mistral AI 实现的 LLM 驱动工具选择

  • 多步骤工具调用工作流

  • 与企业数据的自然语言交互

  • 客户和订单查询

  • Pydantic 数据模型

  • SQLite 持久化

  • 结构化错误处理

  • MCP、持久化和 AI 集成层的分离


Related MCP server: E-commerce MCP Server

架构

flowchart TD
    U[User] --> L[Mistral LLM]
    L --> C[MCP Client]
    C --> S[Enterprise Support MCP Server]
    S --> D[(SQLite Customer / Order Database)]
    D --> S
    S --> C
    C --> L
    L --> U

LLM 不直接访问数据库。

相反,企业能力通过标准化的 MCP 工具暴露。MCP 客户端动态发现这些工具,并将其模式提供给 LLM。

然后 LLM 根据用户请求决定需要哪个工具。


示例工作流

用户输入:

Show me customer 1001.

应用程序执行以下工作流:

User request
    ↓
Mistral LLM
    ↓
Selects get_customer
    ↓
MCP Client
    ↓
Enterprise Support MCP Server
    ↓
SQLite
    ↓
Customer data
    ↓
MCP Client
    ↓
Mistral LLM
    ↓
Natural-language response

示例结果:

Here is the information for customer 1001:

- Name: Anna Schmidt
- Email: anna@example.com
- Status: ACTIVE

应用程序代码并未硬编码 get_customer 的选择。
LLM 根据用户自然语言请求选择合适的 MCP 工具。


可用的 MCP 工具

get_customer

通过客户 ID 检索客户信息。

示例输入:

{
  "customer_id": 1001
}

get_customer_orders

检索属于某个客户的所有订单。

示例输入:

{
  "customer_id": 1001
}

get_order_status

检索订单的当前状态和跟踪信息。

示例输入:

{
  "order_id": 5002
}

技术栈

  • Python

  • 模型上下文协议(MCP)Python SDK

  • Mistral AI

  • Pydantic

  • SQLite

  • asyncio

  • python-dotenv

  • uv


开始使用

前提条件

项目需要:

  • Python 3.11+

  • pip

  • uv

  • 一个 Mistral API 密钥

验证 Python 安装:

python --version

验证 uv

uv --version

1. 克隆仓库

git clone https://github.com/YOUR-USERNAME/enterprise-support-mcp-server.git
cd enterprise-support-mcp-server

YOUR-USERNAME 替换为你的 GitHub 用户名。


2. 创建虚拟环境

python -m venv .venv

Windows PowerShell

.venv\Scripts\Activate.ps1

Linux / macOS

source .venv/bin/activate

3. 安装依赖

pip install -r requirements.txt

主要依赖包括:

mcp[cli]
mistralai
pydantic
python-dotenv

4. 配置 Mistral API 密钥

在项目根目录创建一个 .env 文件。

你可以使用 .env.example 作为模板:

MISTRAL_API_KEY=your_mistral_api_key

切勿将实际的 .env 文件或 API 密钥提交到 Git。


5. 初始化演示数据库

运行:

python init_db.py

这将创建包含 MCP 工具使用的合成客户和订单记录的本地 SQLite 数据库。


测试

项目可以在多个层面进行测试。

测试 1 – 数据库访问

在涉及 MCP 之前,可以独立测试数据库函数。

验证演示数据库已初始化:

python init_db.py

数据库层提供以下操作:

get_customer
get_customer_orders
get_order_status

这验证了持久化层与 MCP 和 LLM 的独立性。


测试 2 – 启动 MCP 服务器

运行:

python server.py

对于基于 stdio 的 MCP 服务器,不会打开 HTTP 端口或浏览器。

该进程等待 MCP 客户端通过标准输入/输出进行通信。

使用以下命令停止服务器:

Ctrl+C

测试 3 – 不带 LLM 的 MCP 客户端

运行:

python client.py

客户端连接到 MCP 服务器并发现可用的工具。

预期的工具发现结果:

Available tools:
- get_customer
- get_customer_orders
- get_order_status

然后客户端可以直接调用 MCP 工具。

此测试验证:

MCP Client
    ↓
MCP protocol
    ↓
MCP Server
    ↓
SQLite
    ↓
MCP result

此测试不需要大语言模型。


测试 4 – LLM 驱动的 MCP 工具选择

运行:

python llm_client.py

应用程序应首先显示从服务器发现的 MCP 工具:

Available MCP tools:
- get_customer
- get_customer_orders
- get_order_status

然后你可以输入自然语言请求。

客户查询

Show me customer 1001.

预期行为:

Mistral
    ↓
get_customer
    ↓
customer_id = 1001

最终响应应包含客户 1001 的信息。


客户订单

尝试:

Show me all orders for customer 1001.

预期工具:

get_customer_orders

订单状态

尝试:

What is the status of order 5002?

预期工具:

get_order_status

不含企业数据的请求

尝试:

What can you help me with?

LLM 应能在不访问客户或订单数据的情况下回答此请求。

这演示了工具执行是动态选择的,而不是为每个请求都执行。


测试 5 – 多步骤工具调用

LLM 客户端支持迭代工具执行。

尝试更复杂的请求,例如:

Customer 1001 says that one of her orders has not arrived.
Can you investigate?

对于复杂请求,助手可以在生成最终响应之前使用多个 MCP 工具。

概念上:

User
    ↓
Mistral
    ↓
MCP Tool
    ↓
Tool Result
    ↓
Mistral
    ↓
Another tool required?
    ├── Yes → MCP Tool → Result → Mistral
    └── No  → Final Response

工具调用循环有最大迭代次数,以防止意外无限执行。


错误处理测试

MCP 服务器也处理未知业务实体。

例如:

Show me customer 9999.

相应的 MCP 工具返回错误结果,而不是编造客户信息。

这对于基于 AI 的企业集成尤其重要:事实性的客户和订单信息必须来自连接的企业系统,而不是 LLM。


项目结构

enterprise-support-mcp-server/
│
├── server.py
│   └── MCP server and tool definitions
│
├── client.py
│   └── MCP client for direct tool testing
│
├── llm_client.py
│   └── Mistral integration and agentic tool-calling workflow
│
├── database.py
│   └── Database access layer
│
├── models.py
│   └── Pydantic domain models
│
├── init_db.py
│   └── Creates synthetic demo data
│
├── requirements.txt
├── .env.example
├── .gitignore
└── README.md

为什么选择 MCP?

LLM 也可以直接调用应用程序特定的函数。

MCP 在 AI 应用程序和外部能力之间引入了标准化的接口。

在这个项目中:

Mistral
   ↓
Tool Calling
   ↓
MCP Client
   ↓
Standardized MCP interface
   ↓
Enterprise Support MCP Server
   ↓
Enterprise capabilities

LLM 负责决定 需要哪种能力

MCP 负责通过 标准化协议 暴露这些能力。

这种分离意味着企业后端不需要专门为某个 LLM 提供商设计。


项目目的

项目故意保持较小规模,专注于一个架构问题:

如何通过标准化的集成层将现有企业能力提供给 AI 助手?

它演示了以下内容的组合:

  • 企业系统集成

  • 模型上下文协议

  • LLM 工具调用

  • 代理工作流

  • 结构化业务数据

  • 关注点分离

该项目作为将 AI 助手与现有企业应用程序集成的实用原型。


安全提示

此仓库仅包含合成演示数据。

请勿通过源代码或提交的 .env 文件暴露 API 密钥、凭据、客户数据或其他敏感信息。

F
license - not found
-
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

View all related MCP servers

Related MCP Connectors

  • The grounded data layer for any LLM: governed SQL, metrics, lineage and catalog over your data.

  • A Model Context Protocol server for Wix AI tools

  • Analytical memory for AI agents: a real Postgres queried in plain English over MCP. One command.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/pbpeter/enterprise-support-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server