Labsco
bifrostinc logo

Code Sync MCP Server

β˜… 3

from bifrostinc

Hot reload remote containerized Python applications directly from your IDE.

πŸ”₯πŸ”₯πŸ”₯βœ“ VerifiedAccount requiredAdvanced setup

Code Sync MCP Server

Hot reload your remote containerized Python applications directly from your IDE using MCP (Model Context Protocol).

The Code Sync MCP architecture bridges the gap between local development and remote containers for interpreted languages - Python, Ruby, or other interpreted code in your local editor and instantly see changes reflected in containers running anywhere (staging, development clusters, cloud environments, or even production). No compilation step needed - changes take effect immediately.

What It Does

  • Instant remote sync: Changes in your local editor appear immediately in containers running anywhere
  • Multi-environment support: Each developer can target their own remote environment
  • Minimal container changes: Just wrap your existing entrypointβ€”no Dockerfile rewrites needed
  • IDE integration: Works through MCP tools in editors like Cursor
  • Secure remote access: API key authentication for production-safe remote connections

Demo

The included docker-compose.yaml runs everything locally with a demo app.

This demo shows introducing a bug in a health check, seeing it break immediately, then fixing it in real-time.

How It Works

When you make a code change in your editor:

  1. MCP tool call triggers from your editor (e.g., Cursor)
  2. Local rsync generates a patch of your changes
  3. Remote Proxy (running in your cloud/staging environment) receives the patch and routes to the appropriate deployment
  4. Sidecar (running alongside your app container) applies changes to a shared volume
  5. Your remote app gets restarted automatically with the new code

Architecture diagram

All components except the MCP server run in your remote environment

Architecture Deep Dive

The system has four main components:

code-sync-mcp-server (Local)

  • Runs locally in your editor
  • Exposes push_changes MCP tool
  • Uses rsync to efficiently detect and package changes
  • Respects .gitignore rules

code-sync-proxy (Remote)

  • Central websocket server (FastAPI-based) running your remote environment
  • Routes change batches to correct sidecar instances
  • Handles authentication and connection management
  • One instance serves all apps and developers

code-sync-sidecar (Remote)

  • Runs alongside each container in your remote environment
  • Receives change batches via websocket
  • Syncs files to shared volume with main app
  • Sends SIGHUP to trigger app restart

rsync-launcher.sh (Remote)

  • Wrapper script for your remote application
  • Syncs files from shared volume into app directory
  • Handles graceful restarts on file changes
  • Minimal modification to existing containers

Key Benefits for Remote Development

  • Eliminate the deploy-test cycle: No more waiting for CI/CD for simple changes
  • True remote development: Work with remote databases, services, and infrastructure
  • Multiple remote environments: Each developer can target their own remote staging
  • Production-like testing: Test in environments that match production exactly

Local Demo (For Testing)

Testing the Demo

  1. Make a code change in demo-app/app.py (try adding an Exception to the health check)

  2. Deploy your changes by typing in the Cursor chat window:

    deploy these changes

    Example:

    Cursor Demo Screenshot

  3. Observe the results:

    • Check the logs for deployment activity
    • Visit http://localhost:8080/health to see the updated service
    • Note any errors that may occur during deployment

Real Usage: In a real deployment, the proxy and sidecar components would run in your remote infrastructure rather than locally. This demo simulates that environment on your local machine for testing purposes.