cy-excel-mcp

cy-excel-mcp

Parses WeChat order messages, merges follow-up updates, and writes structured orders into a OneDrive Excel workbook through Microsoft Graph.

Category
访问服务器

README

cy-excel-mcp

MCP server for parsing WeChat order messages, merging follow-up updates, and writing structured orders into a OneDrive Excel workbook.

中文说明

Field mapping: docs/FIELD_MAPPING.md OpenClaw integration: docs/OPENCLAW_INTEGRATION.md Project roadmap: TODO.md

Overview

cy-excel-mcp is built for order-entry workflows where salespeople send order details through chat, sometimes as plain text, sometimes as follow-up updates after an image or partial draft.

The server converts those messages into structured JSON, merges updates into the same order, and writes the final result into a OneDrive Excel table through Microsoft Graph.

Typical Use Cases

  • A salesperson sends a full text order and it should be recorded directly
  • A salesperson sends part of an order first, then later sends the address, phone number, or payment info
  • An OpenClaw Agent needs a stable MCP endpoint instead of relying on free-form chat reasoning

Example Input

单号:26.3.13-7
测试客户A
示例产品2000支105元
收件人: 测试联系人
手机号码: 13800000000
收货地址:测试省测试市测试区示例路88号

Example Output

{
  "日期": "2026-03-13",
  "单号": "26.3.13-7",
  "销售员": "业务员A",
  "客户": "测试客户A",
  "货品名称": "示例产品",
  "数量": "2000",
  "数量单位": "支",
  "销售金额": "105",
  "总货款": "105",
  "已收": "105",
  "未收": "0",
  "收货联系人": "测试联系人",
  "收货人电话": "13800000000",
  "收货地址": "测试省测试市测试区示例路88号"
}

Flow

  1. OpenClaw sends chat text into ingest_order_message
  2. The server parses the text into a normalized order object
  3. If this is a follow-up message, it merges the update into the existing draft
  4. The final order is matched against recent Excel rows
  5. The server updates an existing row or creates a new one

Privacy Note

This repository should only contain desensitized sample text and JSON. Do not commit real customer names, phone numbers, addresses, order screenshots, or payment details.

Features

  • Parse order text from chat messages
  • Merge follow-up text into an existing draft order
  • Match recent orders by salesperson and customer from bottom to top
  • Standardize product names against a OneDrive product catalog with local caching
  • Write or update OneDrive Excel rows through Microsoft Graph
  • Expose tools over Streamable HTTP for OpenClaw

Tools

  • ingest_order_message
  • parse_wechat_order_message
  • merge_order_update
  • process_excel_order
  • check_product_catalog_status
  • refresh_product_catalog
  • resolve_product_name
  • analyze_product_catalog_patterns

Requirements

  • Python 3.10+
  • A Microsoft Azure app registration with OneDrive permission
  • An Excel workbook stored in OneDrive with a named table

Quick Start

git clone <your-repo-url> cy-excel-mcp
cd cy-excel-mcp
./bootstrap.sh
cp .env.example .env

Edit .env:

OC_OD_TENANT_ID=consumers
OC_OD_CLIENT_ID=your_microsoft_app_client_id
OC_OD_FILE_PATH=YourFolder/订单汇总.xlsx
OC_OD_TABLE_NAME=表1
OC_OD_CACHE_FILE=onedrive_token_cache.bin
OC_OD_PRODUCT_FILE_PATH=众一/2026诚亿报表.xlsx
OC_OD_PRODUCT_SHEET_NAME=产品明细
OC_OD_PRODUCT_CODE_COLUMN=A
OC_OD_PRODUCT_NAME_COLUMN=B
OC_OD_PRODUCT_CATEGORY_COLUMN=C
CY_PRODUCT_CACHE_FILE=product_catalog_cache.json
CY_PRODUCT_ALIAS_FILE=product_aliases.json

CY_EXCEL_MCP_HOST=127.0.0.1
CY_EXCEL_MCP_PORT=18061
CY_EXCEL_MCP_TRANSPORT=streamable-http

Start the server:

./start_cy_excel_mcp_http.sh

The default MCP endpoint is:

http://127.0.0.1:18061/mcp

Manual Installation

python3 -m venv .venv
. .venv/bin/activate
pip install --upgrade pip
pip install -e .

Or run directly after installation:

cy-excel-mcp --transport streamable-http --host 127.0.0.1 --port 18061

OpenClaw MCP Config

Example mcporter.json:

{
  "mcpServers": {
    "cy-excel-mcp": {
      "baseUrl": "http://127.0.0.1:18061/mcp"
    }
  },
  "imports": []
}

An example file is also included at config/mcporter.json.example.

Detailed runtime notes are available in docs/RUNNING.md. Chinese runtime notes are available in docs/RUNNING.zh-CN.md. OpenClaw integration notes are available in docs/OPENCLAW_INTEGRATION.md.

OpenClaw Agent Flow

  • Full text order: ingest_order_message
  • Follow-up text for an existing draft: ingest_order_message with existing_order
  • Parse only: parse_wechat_order_message
  • Merge only: merge_order_update
  • Write only: process_excel_order

Why This Project

  • Keeps Excel write logic outside prompt-only workflows
  • Makes OpenClaw behavior more stable through explicit MCP tools
  • Supports salesperson-first matching and bottom-up order updates
  • Works well for chat-driven order entry teams using OneDrive Excel

Matching Rules

  • Prefer matching within the same salesperson
  • Search from the bottom of Excel upwards
  • Match priority:
    1. 单号
    2. 客户
    3. 匹配客户别名

Repository Layout

  • cy_excel_mcp.py: MCP server implementation
  • start_cy_excel_mcp_http.sh: local HTTP startup script
  • bootstrap.sh: one-command local setup
  • .env.example: environment variable template
  • config/mcporter.json.example: OpenClaw MCP config template

Notes

  • Personal OneDrive has been validated with OC_OD_TENANT_ID=consumers.
  • OC_OD_FILE_PATH can include a nested folder path such as YourFolder/订单汇总.xlsx.
  • OC_OD_TABLE_NAME must be the Excel table object name, not the worksheet name.
  • Product name standardization reads the product-code, product-name, and category columns from OC_OD_PRODUCT_SHEET_NAME in OC_OD_PRODUCT_FILE_PATH.
  • When a product name is matched, the matched product code is written to the order row field 编号 if that column exists in the target order table.
  • Cup products use segmented matching for diameter, mold/series, oz, ml, color, and material before generic text similarity.
  • Before each order write, the server checks product workbook metadata and uses product_catalog_cache.json when the file has not changed.
  • The first Microsoft login may require device-flow authorization in the terminal.
  • After the first successful sign-in, the token is cached in onedrive_token_cache.bin and reused on later runs.
  • Empty values do not overwrite existing Excel values.
  • Keep .env and onedrive_token_cache.bin out of version control.
  • Temporary files such as swap files and __pycache__ are already ignored by .gitignore.

License

MIT. See LICENSE.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选