wemp-operator-mcp

wemp-operator-mcp

Enables to operate a WeChat Official Account via MCP tools, including searching and executing API workflows and uploading files.

Category
访问服务器

README

wemp-operator-mcp

Public HTTP MCP server and agent Skill for operating a WeChat Official Account.

The server is designed for public deployment behind HTTPS. It keeps WeChat credentials on the server, exchanges and caches access_token from a fixed egress IP, and exposes only two MCP tools to agents:

  • tool_search: discover the internal API/workflow catalog.
  • run_tool: execute one discovered internal tool.

The companion Skill configures a local agent to call your public MCP endpoint through mcporter.

Languages

Why One Repository

The MCP server and Skill are versioned together in this repository because the Skill documents the exact public contract exposed by the server. Keeping them together prevents schema drift between file upload handling, tool_search metadata, and run_tool examples.

Features

  • HTTP Streamable MCP endpoint at /mcp.
  • Bearer token authentication for every MCP and upload request.
  • Server-side WeChat access_token exchange using WEMP_WECHAT_APP_ID and WEMP_WECHAT_APP_SECRET.
  • Token cache with early refresh, single-flight refresh, and one retry after WeChat token-expired responses.
  • Temporary file upload endpoint at /uploads for remote MCP file tools.
  • HTTPS URL file source support with SSRF protections.
  • Dangerous tools are disabled by default, including publish/delete/mass-send and blacklist operations.
  • Local CLI remains available for development and local automation.

Architecture

Local Agent + Skill
        |
        | mcporter HTTP MCP
        v
HTTPS reverse proxy
        |
        v
wemp-operator-mcp container
        |
        | fixed public egress IP
        v
WeChat Official Account APIs

For public deployment, add your server's public egress IP to the WeChat Official Account API IP allowlist. Agents only need the MCP bearer token; they do not receive your WeChat AppSecret or access_token.

Public API

MCP

POST /mcp
Authorization: Bearer <WEMP_MCP_TOKEN>

Public MCP tools:

tool_search(query?: string, category?: string, limit?: number)
run_tool(name: string, arguments?: object)

Example:

mcporter call wemp-operator-mcp.tool_search \
  --args '{"query":"draft image","limit":10}' \
  --output json
mcporter call wemp-operator-mcp.run_tool \
  --args '{"name":"get_user_summary","arguments":{"date":"2026-06-21"}}' \
  --output json

File Upload

Remote MCP servers cannot read local paths from the caller machine. Upload the file first:

POST /uploads
Authorization: Bearer <WEMP_MCP_TOKEN>
Content-Type: multipart/form-data

The form must contain exactly one file field. Successful response:

{
  "uploadId": "cfa59bda-0d99-4ad7-9afe-77efb8b09c80",
  "filename": "cover.png",
  "mimeType": "image/png",
  "size": 123456,
  "expiresAt": "2026-06-21T12:00:00.000Z"
}

Use the returned uploadId with file tools:

mcporter call wemp-operator-mcp.run_tool \
  --args '{"name":"upload_article_image","arguments":{"source":{"uploadId":"cfa59bda-0d99-4ad7-9afe-77efb8b09c80"}}}' \
  --output json

Or pass a public HTTPS URL:

mcporter call wemp-operator-mcp.run_tool \
  --args '{"name":"upload_article_image","arguments":{"source":{"url":"https://example.com/image.png","filename":"image.png"}}}' \
  --output json

File source tools:

  • upload_temp_media
  • upload_permanent_media
  • upload_article_image
  • create_draft_from_file

MCP file tools intentionally do not accept filePath. Local CLI scripts may still use local paths.

Quick Start: Docker

  1. Clone the repository.
git clone https://github.com/xiaowangzhixiao/wemp-operator-mcp.git
cd wemp-operator-mcp
  1. Create an environment file.
cp .env.example .env

Edit .env:

WEMP_MCP_TOKEN=replace-with-a-random-token
WEMP_WECHAT_APP_ID=wx...
WEMP_WECHAT_APP_SECRET=replace-with-your-app-secret
WEMP_MCP_HOST=0.0.0.0
WEMP_MCP_PORT=3333
WEMP_MCP_ENABLE_DANGEROUS_TOOLS=0

Generate a token:

openssl rand -hex 32
  1. Run the server.
docker compose up -d --build
curl --fail http://127.0.0.1:3333/healthz
  1. Put Nginx or another HTTPS reverse proxy in front of the container.

Use deploy/nginx.example.conf as a starting point. Replace mcp.example.com with your own domain and set certificate paths for your certificate provider.

  1. Add your server public IP to the WeChat Official Account allowlist.

In the WeChat Official Account admin console, go to the developer settings and add the public egress IP of the server running this container.

Environment Variables

Required:

  • WEMP_MCP_TOKEN: bearer token for MCP and upload requests.
  • WEMP_WECHAT_APP_ID: WeChat Official Account AppID.
  • WEMP_WECHAT_APP_SECRET: WeChat Official Account AppSecret.

Optional:

  • WEMP_MCP_HOST: default 127.0.0.1; use 0.0.0.0 in containers.
  • WEMP_MCP_PORT: default 3333.
  • WEMP_WECHAT_TOKEN_REFRESH_SKEW_SECONDS: default 300.
  • WEMP_MCP_ENABLE_DANGEROUS_TOOLS: set 1 to enable dangerous tools.
  • WEMP_MCP_UPLOAD_MAX_BYTES: default 52428800 (50 MiB).
  • WEMP_MCP_UPLOAD_TOTAL_BYTES: default 524288000 (500 MiB).
  • WEMP_MCP_UPLOAD_TTL_SECONDS: default 900.

Do not log or commit .env, AppSecret, WeChat access_token, or MCP bearer tokens.

Install The Agent Skill

The Skill lives at:

skills/wemp-operator-mcp

For Codex-style local skills:

npm run skill:install

Configure the MCP endpoint:

cd skills/wemp-operator-mcp
WEMP_MCP_URL='https://mcp.example.com/mcp' \
WEMP_MCP_TOKEN='<your-mcp-token>' \
node scripts/setup.mjs

Verify:

mcporter list wemp-operator-mcp
mcporter call wemp-operator-mcp.tool_search --args '{"limit":10}' --output json

Upload a local file through the Skill helper:

WEMP_MCP_URL='https://mcp.example.com/mcp' \
WEMP_MCP_TOKEN='<your-mcp-token>' \
node scripts/upload-file.mjs /absolute/path/to/cover.png

Local Development

Use Node.js 20.12 or newer.

Install dependencies:

npm install

Run tests:

npm test

Start a local MCP server:

WEMP_MCP_TOKEN=dev-token \
WEMP_WECHAT_APP_ID=wx... \
WEMP_WECHAT_APP_SECRET=... \
npm run mcp:start

Local CLI mode can still use config/wemp.json through:

node scripts/init.mjs

That local config is not used in MCP context.

Deployment Guides

Security Defaults

  • MCP and upload routes require the same bearer token.
  • Only tool_search and run_tool are public MCP tools.
  • The server never exposes AppSecret or WeChat access_token through MCP.
  • Dangerous operations are disabled unless WEMP_MCP_ENABLE_DANGEROUS_TOOLS=1.
  • File uploads are temporary and are deleted after TTL.
  • Public URL fetching only allows HTTPS and rejects private, loopback, link-local, multicast, and cloud metadata network ranges.

License

MIT

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选