DE

Defang MCP Server for IDE Cloud Deployment

Deploy the MCP server from your IDE: seamless cloud deployment for Cursor, Windsurf, VS Code, VS Code Insiders, and Claude without leaving your editor.

Quick Install
npx -y defang@latest mcp serve

Overview

The Defang MCP server is a lightweight implementation of the Model Context Protocol (MCP) designed to be launched from your IDE and exposed to cloud IDE services. It provides a simple HTTP endpoint that implements the MCP contract so cloud features (Cursor, Windsurf, VS Code / VS Code Insiders integrations, and Claude) can treat your running environment as a model provider without leaving the editor.

For developers this means you can build, test, and deploy model-backed workflows directly from your local or cloud workspace. Instead of manually packaging services, updating remote configs, or switching tools, the MCP server lets you expose an MCP-compatible interface for editor integrations, making it straightforward to validate integrations, iterate on prompts, or run private model instances in environments that expect MCP.

Features

  • Minimal, single-binary server written for easy IDE/cloud deployment
  • Implements MCP-compatible HTTP endpoints for model/context operations
  • Lightweight configuration via environment variables or flags
  • Logs and health checks suitable for debugging from your editor
  • Works with Cursor, Windsurf, VS Code (including Insiders), and Claude integrations
  • Designed for local development and lightweight cloud deployment

Installation / Configuration

Clone the repository and run the server locally. Replace placeholders as needed.

Clone and run with Go:

git clone https://github.com/DefangLabs/defang.git
cd defang
# run the MCP server package (adjust path if repo layout changes)
go run ./src/pkg/mcp

Build a binary:

go build -o defang-mcp ./src/pkg/mcp
./defang-mcp

Run with environment variables (common options shown as examples):

# Bind address and port
MCP_ADDR="0.0.0.0:3000"

# Optional: log level (debug/info/warn)
MCP_LOG_LEVEL="info"

# Optional: authentication token for client integrations
MCP_AUTH_TOKEN="your-secret-token"

MCP_ADDR="$MCP_ADDR" MCP_LOG_LEVEL="$MCP_LOG_LEVEL" MCP_AUTH_TOKEN="$MCP_AUTH_TOKEN" ./defang-mcp

Docker (example Dockerfile snippet and run):

FROM golang:1.20 AS build
WORKDIR /src
COPY . .
RUN go build -o /bin/defang-mcp ./src/pkg/mcp

FROM debian:bookworm-slim
COPY --from=build /bin/defang-mcp /usr/local/bin/defang-mcp
EXPOSE 3000
ENTRYPOINT ["/usr/local/bin/defang-mcp"]

Run container:

docker build -t defang-mcp .
docker run -p 3000:3000 -e MCP_AUTH_TOKEN=your-secret-token defang-mcp

Configuration options are intentionally minimal; use environment variables or command-line flags to adapt address, logging, and auth. Check logs in your IDE terminal for runtime diagnostics.

Available Resources

Common endpoints and resources (example names — confirm exact routes in the implementation):

ResourcePurpose
/healthLiveness/health check for orchestration and quick status
/mcp/*MCP protocol endpoints for context/model operations
/metrics(Optional) Prometheus-style metrics if enabled
Logs (stdout)Use your editor terminal to inspect runtime logs and errors

Use curl or your editor-integrated HTTP client to verify:

curl -v "http://localhost:3000/health"
# or if auth is enabled:
curl -H "Authorization: Bearer your-secret-token" "http://localhost:3000/health"

Use Cases

  • Local testing for Cursor or Windsurf model integrations
    • Start the MCP server from VS Code terminal, configure Cursor to point at http://localhost:3000 (or your server address) as a custom model endpoint, and iterate on prompts without packaging or deployment steps.
  • Quick cloud deployment from IDE
    • Use the server binary or Docker container to deploy to a cloud workspace from your IDE (via built-in cloud deployment extensions). The running MCP endpoint is immediately available to hosted editor features such as code completions or conversational assistants.
  • Private model / data workflows
    • Run private or experimental model logic locally and expose it via MCP to tools like Claude that support custom MCP endpoints. This keeps sensitive code/data within your environment while still leveraging editor cloud features.
  • CI / integration testing
    • Spin up the MCP server in CI jobs to run integration tests against editor-driven flows that expect MCP-compatible responses. Use health and metrics endpoints for checks and observability.

Notes & Tips

  • When integrating with cloud IDEs, ensure the MCP server address is reachable from the cloud runtime (use tunneling, proper networking, or deploy to the cloud workspace).
  • If your editor or cloud product requires authentication, configure MCP_AUTH_TOKEN and supply matching credentials in the editor integration settings.
  • Keep logs visible in the IDE terminal for faster debugging during development cycles.

This server is intended to be a practical, simple bridge between your runtime and MCP-aware editor/cloud features. Use it to shorten the loop between development and interactive editor integrations.