Code Sync MCP Server

by bifrostinc

Not rated
GitHub

About

Hot reload remote containerized Python applications directly from your IDE.

Details

Author
bifrostinc
Categories
Developer Tools, Infrastructure, Other

1. Deploy the Proxy to your remote environment

The proxy is a central websocket server that routes code changes to the right containers.

You only needone proxyper remote environment for all your applications and developers.

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.

- 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

The includeddocker-compose.yamlruns 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.

When you make a code change in your editor:
- MCP tool calltriggers from your editor (e.g., Cursor)
- Local rsyncgenerates a patch of your changes
- Remote Proxy(running in your cloud/staging environment) receives the patch and routes to the appropriate deployment
- Sidecar(running alongside your app container) applies changes to a shared volume
- Your remote appgets restarted automatically with the new code

All components except the MCP server run in your remote environment

- Remote Docker/container environment (Kubernetes, Docker Swarm, cloud instances, etc.)
- Local editor with MCP support (like Cursor)
- An API key for securing remote connections

1. Deploy the Proxy to your remote environment

The proxy is a central websocket server that routes code changes to the right containers.

You only needone proxyper remote environment for all your applications and developers.

2. Configure Your Remote Application (Per App/Deployment)

For each app deployment, you need two changes:

Replace your existing entrypoint with this wrapper that waits for the sync system:

# Simple one-liner approach (recommended) sh -c "while [ ! -f /app-files/.sidecar/rsync-launcher.sh ]; do echo 'Waiting for sync...'; sleep 1; done && /app-files/.sidecar/rsync-launcher.sh 'YOUR_ORIGINAL_COMMAND_HERE'"

B) Add the sidecar container to your remote deployment

Deploycode-sync-sidecarcontainer alongside your app with these environment variables:

BIFROST_API_URL=http://your-proxy-url BIFROST_API_KEY=your-secret-key-here # Same as proxy BIFROST_APP_ID=my-app # Unique app identifier BIFROST_DEPLOYMENT_ID=dev-john # Unique deployment name

- Kubernetes: Add as a sidecar container in your pod spec
- Docker Compose: Add as an additional service with shared volumes
- ECS: Add as a sidecar container in your task definition

C) [If Required] Ensure you app has permissions for syncing (if not running as root)

RUN useradd -m appuser RUN chown -R appuser:appuser /app USER appuser

ForCursor, add this to yourlocalMCP settings pointing to yourremoteproxy:

{ "mcpServers": { "code-sync": { "command": "uvx code-sync-mcp", "env": { "BIFROST_API_KEY": "your-secret-key-here", "BIFROST_WS_API_URL": "ws://your-proxy-url", "BIFROST_API_URL": "http://your-proxy-url" } } } }

You'll see these tools become available:

Then you need to add a.bifrost.jsonfile to your app's root:

{ "app_id": "my-app", "deployment_id": "dev-john", "app_root": "absolute/path/to/code/root" }

Once set up, use thepush_changestool in your editor to sync your local code changes to any remote container. The system respects your.gitignorefile automatically.

- Edit a file locally in Cursor
- Use thepush_changesMCP tool
- See changes immediately reflected in your remote staging environment
- Debug, iterate, and test—all without leaving your local editor

- Runs locally in your editor
- Exposespush_changesMCP tool
- Usesrsyncto efficiently detect and package changes
- Respects.gitignorerules

- 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

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

- 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

- 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

Before running the local demo, ensure you have the following installed:

- MCP Client: InstallCursorfor this demo
- Rsync(version 3.4.1 or newer):

- macOS:brew install rsync && rsync --version
- Other platforms: Verify your version withrsync --versionand upgrade if needed

# Clone the repository git clone https://github.com/bifrostinc/code-sync-mcp.git # Start the local environment docker-compose up

Add the following configuration to your Cursor MCP settings:

{ "mcpServers": { "code-sync": { "command": "uvx code-sync-mcp", "env": { "UV_PYTHON": "3.13", "BIFROST_API_KEY": "test-secret-key", "BIFROST_WS_API_URL": "ws://localhost:8000", "BIFROST_API_URL": "http://localhost:8000" } } } }

-

Make a code changeindemo-app/app.py(try adding an Exception to the health check)

Deploy your changesby typing in the Cursor chat window:

- Check the logs for deployment activity
- Visit
http://localhost:8080/healthto 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.

This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.

Official Docker MCP Toolkit for discovering, configuring, and running containerized MCP servers through Docker Desktop and the Docker MCP gateway.

A secure, Docker-based server providing core execution capabilities for AI agents.

Manage DDEV projects, enabling LLM applications to interact with local development environments through the MCP protocol.

Manage DevContainer environments using natural language prompts in any MCP-compatible editor.

Integrates with the devcontainers CLI to manage development containers. Requires Docker.

MCP server that gives LLMs full control over local Kubernetes dev environments via k3d, kubectl, Tilt, Helm, and kustomize

A Ruby implementation of an MCP server for managing and using Docker

Manage Docker containers, volumes, and services using natural language commands.

Orchestration tool for managing multiple MCP servers with a Docker Compose-style interface and a unified HTTP proxy.

A reverse proxy gateway for managing and accessing multiple MCP servers through a single entry point, deployable via Docker.

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.