Deploy MCPHub MCP Server Hub + Postgres

Self-hosted MCP server hub with Postgres, admin and bearer key generated

Deploy MCPHub MCP Server Hub + Postgres

Just deployed

Just deployed

Deploy and Host MCPHub MCP Server Hub on Railway

MCPHub is an open source hub for Model Context Protocol servers. You add MCP servers once (npx, uvx, or remote HTTP/SSE servers), organize them into groups, and every AI client connects to a single endpoint: /mcp for everything, /mcp/ for a curated set, or /mcp/$smart for vector search over all your tools.

About Hosting MCPHub

This template runs MCPHub 1.2.6 in database mode with PostgreSQL (pgvector), the upstream recommendation for production. It is locked down from the first second: the admin password, the MCP bearer key, the session secret and the credential encryption key are all generated at deploy time, so there is no default login and no open MCP endpoint. Self registration stays off.

Plan note: each stdio MCP server runs as its own child process. A few servers fit the Trial plan; plan on Hobby if you run many.

Common Use Cases

  • One endpoint for every client: point Claude, Cursor, Cline or any MCP client at one URL
  • Groups: expose only the tools a given agent should see at /mcp/
  • Smart Routing: with an OpenAI key, /mcp/$smart searches all tools by meaning
  • Keys and users: scoped bearer keys per client, OAuth for MCP clients that support it

Dependencies for MCPHub Hosting

  • PostgreSQL with pgvector: included
  • npm and PyPI access: used when a stdio server starts for the first time
  • OpenAI API key: optional, only for Smart Routing

Deployment Dependencies

Implementation Details

First steps after deploy:

  1. Wait until MCPHub and Postgres are green.
  2. Open the MCPHub domain and sign in as admin with ADMIN_PASSWORD from the MCPHub service variables.
  3. Add a server under Servers, or install one from the Market, then create a group.
  4. Connect a client to https:///mcp (or /mcp/) with the header Authorization: Bearer .
  5. Rotate or add scoped keys under Settings, Keys. Change the admin password under the user menu.

Key environment variables:

ADMIN_PASSWORD=${{secret(24)}}            # first boot only, username admin
MCP_BEARER_KEY=${{secret(48)}}            # seeded once as key railway-default
JWT_SECRET=${{secret(64,"abcdef0123456789")}}
MCPHUB_CREDENTIAL_ENCRYPTION_KEY=...      # generated 32 byte base64, never change
DB_URL=${{Postgres.DATABASE_URL}}
INSTALL_BASE_URL=https://${{RAILWAY_PUBLIC_DOMAIN}}
OPENAI_API_KEY=                           # optional, Smart Routing
SMART_ROUTING_ENABLED=                    # optional, set true

Why Deploy MCPHub on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying MCPHub on Railway, you are one step closer to supporting a complete full stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.


Template Content

More templates in this category

View Template
Chat Chat
Chat Chat, your own unified chat and search to AI platform.

okisdev
117
View Template
Weaviate
Vector database with hybrid search and an API key-protected API

GitHub Locker
1
View Template
Möbius Personal AI OS
Self-hosted AI agent that builds and runs apps for you, with memory.

bento
1