mcp -weixin
MCP server from CorgiBoyG/mcp-server-weixin
claude mcp add --transport stdio corgiboyg-mcp-server-weixin java -jar target/mcp-server-weixin-app.jar
How to use
This MCP server implements a WeiXin (WeChat) template message notifier built on the Spring AI MCP Server framework. It exposes a tool for AI to send WeChat template messages to users via the WeiXinNotice service. The server authenticates with WeChat using an Access Token (cached for 2 hours) and formats messages according to the configured template. It supports two operation modes: a standard SSE-based streaming mode and a stdio mode. When running in the default SSE mode, the server starts and serves at http://localhost:8102, ready to accept tool calls from the MCP protocol. The core tool exposed for AI usage is weixinNotice, which accepts parameters such as platform (e.g., CSDN, Jinri), subject, and description to compose and dispatch a template message to a specified WeChat user.
How to install
Prerequisites:
- JDK 17+ installed
- Maven 3.6+ installed
- (Optional) Docker if you prefer container deployment
Installation steps:
- Clone the repository or download the source code.
- Build the project with Maven: mvn clean package
- Run the server locally (standard SSE mode): java -jar target/mcp-server-weixin-app.jar The server will start on http://localhost:8102 by default.
If you prefer stdio mode for testing:
- Edit src/main/resources/application.yml and set web-application-type: none.
- Run the same jar: java -jar target/mcp-server-weixin-app.jar Access the stdio-based behavior as configured.
Additional notes
Notes and tips:
- Configure WeChat parameters in application.yml under weixin.api: original_id, app-id, app-secret, template_id, touser.
- Access Token caching uses a 2-hour TTL to minimize WeChat API calls.
- Ensure the WeChat template is correctly configured and the user OpenID is valid and reachable (Need user authorization to receive messages).
- If running in Docker, expose port 8102 and mount a data directory for logs and data persistence.
- Logs are stored at data/log/mcp-server-weixin.log; adjust logging in application.yml if needed.
- For adding new tools, extend WeiXinNoticeService with additional @Tool methods and update IWeiXiPort and IWeixinApiService accordingly.