# Deploy an MCP Server

> Deploy any NPM/stdio MCP server to the Aerostack edge. Convert to a Cloudflare Worker in one command — permanent HTTPS URL, no tunnels needed.

Convert any NPM/stdio MCP server to a Cloudflare Worker and host it on Aerostack's edge. No local process, no ngrok tunnels — just a permanent HTTP URL.

## Why deploy to Aerostack?

Standard MCP servers run as local stdio processes. This means:
- Only accessible from your local machine
- Requires the process to be running
- Can't share with teammates

Hosting on Aerostack gives you a persistent HTTP endpoint accessible from any LLM tool.

## Convert and deploy

### From an NPM package

```bash
aerostack mcp convert --package @notionhq/notion-mcp-server --deploy --slug notion-mcp
```

### From GitHub

```bash
aerostack mcp convert --github https://github.com/user/my-mcp-server --deploy --slug my-mcp
```

### From a local directory

```bash
aerostack mcp convert --dir ./my-mcp-server --slug my-mcp
aerostack deploy mcp
```

---

## What the conversion does

1. Downloads the MCP server source
2. Analyzes tool definitions and extracts required env vars
3. Generates a Cloudflare Worker wrapper that translates HTTP SSE ↔ stdio
4. Flags any incompatible Node.js APIs (file system, child processes, etc.)

---

## Set required secrets

After conversion, set the environment variables your MCP server needs:

```bash
aerostack secrets set NOTION_API_KEY secret_... --env production
aerostack secrets set GITHUB_TOKEN ghp_... --env production
```

---

## Add to a workspace

```bash
# After deploying, add to your workspace
aerostack workspace use work
aerostack skill install --mcp notion-mcp
```

The MCP server's tools are namespaced as `notion-mcp__<tool-name>` in your workspace.

---

## Manual deploy

If you converted without `--deploy`:

```bash
cd my-mcp-worker
aerostack deploy mcp dist/index.js --slug my-notion-mcp --env production
```

Deployed MCP servers run at the edge — low latency, globally distributed, and scale to zero when idle.
