weixin-mcp
微信公众号 MCP Server
Documentation
微信公众号 MCP 服务器 (Go 版本)
这是基于 Go 语言重新实现的微信公众号 Model Context Protocol (MCP) 服务器,使用 mark3labs/mcp-go 框架开发。
✨ 特性
- 🚀 高性能: Go 语言实现,启动速度快,内存占用低
- 📦 容器化: 完整的 Docker 支持,一键部署
- 🔧 简单部署: 单二进制文件,无依赖
- 🛡️ 类型安全: 编译时错误检查
- 🔄 完全兼容: 与 Python 版本 API 完全兼容
- 📊 结构化日志: 便于调试和监控
📋 功能列表
支持5个核心的微信公众号管理工具:
1. WeChat_get_access_token - 获取微信公众号 access_token
2. WeChat_create_draft - 创建图文消息草稿
3. WeChat_publish_draft - 发布草稿到公众号
4. WeChat_del_draft - 删除未发布的草稿
5. WeChat_del_material - 删除永久素材
🚀 快速开始
方式一:使用 Docker (推荐)
# 1. 构建并运行
make docker-run
# 2. 查看日志
docker logs wechat-oa-mcp-server方式二:本地构建
# 1. 安装依赖
make deps
# 2. 构建
make build
# 3. 运行
make run🐳 Docker 使用
构建镜像
docker build -t wechat-oa-mcp-go:latest .运行容器
docker run -it --name wechat-oa-mcp-server wechat-oa-mcp-go:latest使用 docker-compose
# 启动服务
docker-compose up -d
# 查看日志
docker-compose logs -f
# 停止服务
docker-compose down🎛️ 在 Cursor 中配置
将以下配置添加到 Cursor 的 MCP 设置中:
{
"mcpServers": {
"wechat-oa-mcp-go": {
"command": "/path/to/wechat-oa-mcp-go/bin/wechat-oa-mcp",
"env": {
"LOG_LEVEL": "info"
}
}
}
}或者使用 Docker 方式:
{
"mcpServers": {
"wechat-oa-mcp-go": {
"command": "docker",
"args": ["run", "-i", "--rm", "wechat-oa-mcp-go:latest"]
}
}
}🔧 开发说明
项目结构
wechat-oa-mcp-go/
├── cmd/main.go # 主程序入口
├── internal/handlers/ # MCP 工具处理器
├── pkg/wechat/ # 微信 API 客户端
├── Dockerfile # 容器构建文件
├── Makefile # 构建脚本
├── go.mod # Go 模块依赖
└── README.md # 本文档添加新工具
1. 在 `pkg/wechat/` 中添加 API 客户端函数
2. 在 `internal/handlers/` 中实现 MCP 工具处理器
3. 在 `cmd/main.go` 中注册新工具
构建命令
# 查看所有可用命令
make help
# 构建二进制文件
make build
# 运行测试
make test
# 清理构建文件
make clean
# 下载依赖
make deps
# Docker 相关
make docker-build # 构建镜像
make docker-run # 运行容器
make docker-clean # 清理容器和镜像🌟 性能优势
相比 Python 版本:
- 启动速度: 快 20-30 倍
- 内存占用: 减少 60-70%
- 响应时间: 快 2-4 倍
- 部署简单: 单文件二进制,无运行时依赖
�� API 兼容性
Go 版本完全兼容 Python 版本的 API:
- 相同的工具名称和参数
- 相同的响应格式
- 相同的错误处理方式
可以无缝替换现有的 Python 实现。
🔍 调试和日志
服务器启动时会在 stderr 输出详细的日志信息,包括:
- 工具注册状态
- 请求处理过程
- 错误信息和调用堆栈
设置环境变量 `LOG_LEVEL=debug` 可以获得更详细的调试信息。
📄 许可证
本项目基于与原 Python 版本相同的许可证。
�� 贡献
欢迎提交 Issue 和 Pull Request!
📞 支持
如有问题,请查看:
- `IMPLEMENTATION.md` - 详细的实现说明
- `README-GO.md` - Go 版本专用文档
Frequently asked questions
What is weixin-mcp?
weixin-mcp is 微信公众号 MCP Server
How do I install weixin-mcp?
Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.
Is weixin-mcp open source?
Yes — it is hosted on GitHub at https://github.com/tc6-01/weixin-mcp and has 9 stars.
Related MCP tools
eBPF-powered network observability for Kubernetes. Indexes L4/L7 traffic with full K8s context, decrypts TLS without keys. Queryable by AI agents via MCP and humans via dashboard.
GOWA - WhatsApp REST API with support for UI, Multi Account, Webhooks, and MCP, and Chatwoot. Built with Golang for efficient memory use.
The missing open-source Kubernetes UI with a built-in MCP server for AI agents. See what's broken, why, and what changed. Issues, Topology, event timeline, Helm, GitOps, live service traffic, and cluster audits - all in one Go binary.
mcp-language-server gives MCP enabled clients access semantic tools like get definition, references, rename, and diagnostics.
The Terraform MCP Server provides seamless integration with Terraform ecosystem, enabling advanced automation and interaction capabilities for Infrastructure as Code (IaC) development.
Run MATLAB® using AI applications with the official MATLAB MCP Server from MathWorks®. This MCP server for MATLAB supports a wide range of coding agents like Claude Code® and Visual Studio® Code.
Run your own MCP server? See who uses it and what to fix.
Measure it with TrackMCP