How to Control Claude Code Remotely via WeChat with cc-weixin
The Problem: You’re Away From Your Desk, But Your Code Needs Attention
Picture this: You’re at dinner with friends, and suddenly you remember a critical bug that needs fixing. Or you’re on the subway, and inspiration strikes for a feature you’ve been stuck on. Your development environment is on your powerful desktop machine at home, miles away.
What do you do? Do you excuse yourself, rush home, and fire up your computer? Do you try to SSH in on a tiny phone screen?
I’ve been there. And I built something to solve it: cc-weixin, a WeChat plugin that lets you control Claude Code remotely from your phone.
What is cc-weixin?
cc-weixin is an open-source plugin that bridges WeChat and Claude Code. It allows you to:
- Send messages to Claude Code from your phone via WeChat
- Receive code execution results directly in WeChat
- Send images, files, and voice messages for context
- Execute prompts remotely without exposing any network ports
The core workflow is elegantly simple:
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐│ WeChat App │ │ cc-weixin │ │ Claude Code ││ (Mobile) │ │ MCP Server │ │ (Desktop) │└────────┬────────┘ └────────┬────────┘ └────────┬────────┘ │ │ │ │ 1. Send message │ │ │──────────────────────>│ │ │ │ │ │ │ 2. Forward to Claude │ │ │──────────────────────>│ │ │ │ │ │ 3. Execute & respond│ │ │<──────────────────────│ │ │ │ │ 4. Return results │ │ │<──────────────────────│ │ │ │ │Why WeChat? Why Not Just Use a Web Interface?
Good question. Here’s my reasoning:
WeChat is already on your phone. No need to install another app, remember another password, or manage another session. It’s the most used app for many developers in China and increasingly worldwide.
WeChat’s iLink Bot API is official and compliant. This isn’t a hacky workaround or a third-party relay. WeChat provides an official API (using the ClawBot protocol) for bot developers. Your integration is secure, stable, and won’t get shut down overnight.
Push notifications are built-in. When Claude Code finishes a task, you get notified immediately. No polling, no refreshing, no background battery drain from a web app.
How It Works: Architecture Deep Dive
The architecture is designed around one key principle: security through simplicity.
MCP Server via stdio
Unlike typical remote access solutions, cc-weixin doesn’t expose any network ports. The MCP (Model Context Protocol) Server runs locally and communicates via stdio (standard input/output).
┌─────────────────────────────────────────────────────────────────┐│ Your Local Machine ││ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ││ │ cc-weixin │ stdio│ MCP Server │ API │ Claude Code │ ││ │ Plugin │<────>│ (local) │<────>│ CLI/SDK │ ││ └──────────────┘ └──────────────┘ └──────────────┘ ││ │ ││ │ WeChat iLink Bot API (official) ││ │ (HTTPS/Cloud) │└─────────│───────────────────────────────────────────────────────┘ │ │ ┌─────┴─────┐ │ WeChat │ │ Cloud │ └───────────┘This means:
- No firewall configuration - No ports to open, no NAT traversal needed
- No attack surface - External services can’t probe your machine
- No VPN required - Works from anywhere WeChat is available
Pairing Code Authentication
Security is built-in. When you first set up cc-weixin, you get a pairing code. Only devices with this code can connect. Additionally, you can configure a whitelist of trusted WeChat IDs.
1. Generate pairing code: cc-weixin pair2. Send code to your WeChat bot3. Bot verifies and establishes secure connection4. Only whitelisted users can send commandsGetting Started: Installation and Setup
Let me walk you through setting this up on your machine.
Prerequisites
- Node.js 18 or higher
- Claude Code CLI installed
- A WeChat account (obviously)
- A registered WeChat iLink Bot (see WeChat Open Platform)
Step 1: Install cc-weixin
npm install -g cc-weixinStep 2: Configure the MCP Server
Create a configuration file in your Claude Code settings:
{ "mcpServers": { "cc-weixin": { "command": "cc-weixin-mcp", "args": ["--stdio"], "env": { "WECHAT_BOT_TOKEN": "your-bot-token-here", "ALLOWED_USERS": "wxid_abc123,wxid_def456" } } }}Step 3: Generate Pairing Code
cc-weixin pair
# Output:# Your pairing code: 867-5309# Scan the QR code in WeChat or send this code to your botStep 4: Connect from WeChat
Open WeChat, find your iLink Bot, and send the pairing code. You’ll see a confirmation message:
✅ Connected to Claude Code
Machine: my-dev-machineWorking directory: /home/user/projectsReady to accept commands!Using cc-weixin: Practical Examples
Now the fun part. Let’s look at some real use cases.
Example 1: Quick Bug Fix
You’re at a coffee shop and remember a bug in your authentication logic:
Fix the login validation in src/auth/login.ts - it's not checking for expired tokens properlyClaude Code receives this, opens the file, analyzes the code, makes the fix, and sends back:
✅ Fixed token expiration check in src/auth/login.ts
Changes made:- Added isTokenExpired() validation before processing- Added proper error message for expired tokens- Added unit test for the new validation
Commit created: fix(auth): add token expiration validationExample 2: Code Review Request
You’re reviewing a PR on your phone and want Claude to analyze it:
Review the code in PR #234 - focus on security issues in the payment moduleClaude Code pulls the PR, analyzes the code, and responds with a detailed review.
Example 3: Send Context with Images
Sometimes you need visual context. With cc-weixin, you can:
- Take a screenshot of an error message
- Send it via WeChat to your bot
- Add a caption: “Why is this failing? Check the logs”
Claude Code receives the image, analyzes it, checks your logs, and provides an explanation.
Example 4: Voice Messages
Too much typing? Just send a voice message:
"Create a new API endpoint for user profile updates, include validation for email and phone number, and add rate limiting"Claude Code transcribes and executes your request.
Advanced Configuration
Custom Commands
You can define custom commands for frequently used tasks:
{ "commands": { "daily": "Generate a summary of today's commits and create a changelog entry", "test": "Run the test suite and report any failures", "deploy": "Build and deploy to staging environment" }}Now you can send simple messages like:
dailyRate Limiting
To prevent accidental overload, cc-weixin includes built-in rate limiting:
{ "rateLimit": { "maxRequests": 10, "windowMinutes": 5, "cooldownMinutes": 15 }}Session Management
cc-weixin maintains context across messages, so you can have a conversation:
You: "Find all uses of deprecated function oldProcess()"Claude: "Found 12 uses across 5 files. Main locations: ..."
You: "Replace them with newProcess()"Claude: "✅ Replaced all 12 occurrences. Files modified: ..."Security Considerations
I want to be transparent about security, because giving remote access to your development environment is serious.
What cc-weixin Does Well
- End-to-end encryption via WeChat’s iLink Bot API
- Local-only execution - No cloud relay, no third-party servers
- Whitelist authentication - Only approved WeChat IDs can connect
- Pairing codes - One-time setup prevents unauthorized access
- No port exposure - stdio communication eliminates network attack surface
What You Should Know
- WeChat sees your messages - This is a trade-off of using WeChat’s platform. If you’re working on highly sensitive code, consider this carefully.
- Your machine must be on - cc-weixin can’t wake your computer from sleep.
- Session timeout - For security, connections expire after a configurable period (default: 24 hours).
Platform Decoupling: It’s Not Just WeChat
One design goal was platform decoupling. While WeChat is the current frontend, the MCP Server architecture means you could theoretically build clients for:
- Telegram bots
- Discord bots
- Slack integrations
- Custom mobile apps
- Even SMS gateways
The MCP protocol abstracts the messaging layer, making cc-weixin a blueprint for any remote Claude Code interface.
Real-World Use Cases
Here’s how I actually use this in my workflow:
On the Go Debugging
During my commute, I often think of fixes for problems I was stuck on yesterday. A quick WeChat message to Claude Code, and by the time I’m at my desk, the fix is ready to review.
Weekend Inspiration
Ideas don’t respect work hours. When inspiration strikes on a Saturday, I can prototype without leaving the couch.
Team Coordination
I’ve set up a shared cc-weixin instance for my team. We can all send tasks to our CI/CD pipeline via WeChat, and everyone sees the results.
Troubleshooting Common Issues
Connection Drops
If your connection drops, it’s usually one of these causes:
cc-weixin status
# If disconnected, re-pair:cc-weixin pair --forceMessage Not Received
Messages should arrive within seconds. If not:
- Check your machine is awake and cc-weixin is running
- Verify your WeChat bot is online (check WeChat Open Platform)
- Check logs:
cc-weixin logs --tail 50
Permission Denied
If Claude Code can’t access files:
ls -la /path/to/your/project# Ensure your user owns the filesConclusion: The Future of Remote Development
cc-weixin represents a new pattern in development tooling: AI-mediated remote access. Instead of traditional remote desktop or SSH, we’re using AI as an intermediary that understands context, can make intelligent decisions, and executes safely.
This is more than just remote control—it’s remote collaboration. You’re not typing commands into a terminal; you’re having a conversation with an AI that happens to live on your development machine.
The combination of WeChat’s ubiquity (for those who use it) and Claude Code’s capabilities creates a powerful workflow. No more “I’ll fix it when I get home.” No more pulling out a laptop on the subway. Just open WeChat, send a message, and let Claude handle the rest.
If you’re interested in trying cc-weixin, check out the GitHub repository for the latest updates and documentation. And if you build something cool with it, I’d love to hear about it.
Final Words + More Resources
My intention with this article was to help others share my knowledge and experience. If you want to contact me, you can contact by email: Email me
Here are also the most important links from this article along with some further resources that will help you in this scope:
Oh, and if you found these resources useful, don’t forget to support me by starring the repo on GitHub!
Comments