Deploy platform for MCP servers and sites built into the catalog
The author of Unyly, a catalog of MCP servers, has added a full deployment platform to it, allowing users to deploy GitHub repositories as websites or MCP servers on a subdomain. The system auto-generates Dockerfiles, runs containers with limitations, and handles routing, healthchecks, and auto-deploys via webhooks. The article details the architecture and shares pitfalls encountered during development.
The author previously built a catalog of MCP servers on Habr, aggregating 80 thousand entries from nine sources. Users asked where to run the servers, since many are GitHub repositories requiring setup and hosting. To address this, the author added a deployment section to Unyly, enabling users to connect a GitHub repository and get a live project at slug.unyly.org with auto-rebuild on push. It supports static sites, frontend builds, Next.js, and MCP servers on Node and Python. The deployment flow involves a GitHub webhook to a Next.js API with HMAC verification, enqueueing in SQLite, a worker that clones the repo, generates a Dockerfile based on project type, builds and runs the container with resource limits, and a reverse proxy on port 3900 routing by Host header. The proxy and worker are separate processes under pm2 to avoid blocking. Dockerfile generation includes recipes for Node MCP servers (wrapped in supergateway for HTTP), Python MCP servers, static sites, frontend builds, and Next.js. Containers run with memory, CPU, and process limits, and capabilities are dropped except for nginx sites. Healthchecks verify HTTP status for sites and perform a real JSON-RPC initialize for MCP servers. Routing uses a regex server_name with negative lookahead to exclude service subdomains. Auto-deploy includes pull request previews that are built and cleaned up automatically. The management console is at deploy.unyly.org, with free tier allowing one project and Pro ten. The author shares pitfalls: synchronous docker build blocking the event loop, printf in Dockerfile breaking nginx, wildcard subdomain capturing admin subdomains, cross-subdomain cookie issues solved with an SSO bridge, and the necessity of wrapping stdio servers because they cannot be accessed over HTTP without it.
- Abbreviations
- HMAC = Hash-based Message Authentication Code — код аутентификации сообщений на основе хеша
- HTTP = Hypertext Transfer Protocol — протокол передачи гипертекста
- JSON-RPC = JSON Remote Procedure Call — JSON удалённый вызов процедур
- MCP = Model Context Protocol — протокол контекста модели
- SPA = Single Page Application — одностраничное приложение
- SSO = Single Sign-On — единый вход
Source: Habr — хаб ИИ —
original
