Skip to content

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:

cc-weixin workflow diagram
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ 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).

Architecture overview
┌─────────────────────────────────────────────────────────────────┐
│ 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:

  1. No firewall configuration - No ports to open, no NAT traversal needed
  2. No attack surface - External services can’t probe your machine
  3. 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.

Authentication flow
1. Generate pairing code: cc-weixin pair
2. Send code to your WeChat bot
3. Bot verifies and establishes secure connection
4. Only whitelisted users can send commands

Getting 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

Install cc-weixin globally
npm install -g cc-weixin

Step 2: Configure the MCP Server

Create a configuration file in your Claude Code settings:

claude-settings.json
{
"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

Generate pairing code
cc-weixin pair
# Output:
# Your pairing code: 867-5309
# Scan the QR code in WeChat or send this code to your bot

Step 4: Connect from WeChat

Open WeChat, find your iLink Bot, and send the pairing code. You’ll see a confirmation message:

WeChat confirmation
✅ Connected to Claude Code
Machine: my-dev-machine
Working directory: /home/user/projects
Ready 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:

Send from WeChat
Fix the login validation in src/auth/login.ts - it's not checking for expired tokens properly

Claude Code receives this, opens the file, analyzes the code, makes the fix, and sends back:

Response from Claude Code
✅ 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 validation

Example 2: Code Review Request

You’re reviewing a PR on your phone and want Claude to analyze it:

Send from WeChat
Review the code in PR #234 - focus on security issues in the payment module

Claude 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:

  1. Take a screenshot of an error message
  2. Send it via WeChat to your bot
  3. 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:

Voice message transcription
"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:

Custom commands configuration
{
"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:

Using custom commands
daily

Rate Limiting

To prevent accidental overload, cc-weixin includes built-in rate limiting:

Rate limiting configuration
{
"rateLimit": {
"maxRequests": 10,
"windowMinutes": 5,
"cooldownMinutes": 15
}
}

Session Management

cc-weixin maintains context across messages, so you can have a conversation:

Conversation example
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:

Check connection status
cc-weixin status
# If disconnected, re-pair:
cc-weixin pair --force

Message Not Received

Messages should arrive within seconds. If not:

  1. Check your machine is awake and cc-weixin is running
  2. Verify your WeChat bot is online (check WeChat Open Platform)
  3. Check logs: cc-weixin logs --tail 50

Permission Denied

If Claude Code can’t access files:

Check permissions
ls -la /path/to/your/project
# Ensure your user owns the files

Conclusion: 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