Deploy MCPHub MCP Server Hub + Postgres
Self-hosted MCP server hub with Postgres, admin and bearer key generated
MCPHub
Just deployed
Postgres
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/$smartsearches 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:
- Wait until MCPHub and Postgres are green.
- Open the MCPHub domain and sign in as
adminwithADMIN_PASSWORDfrom the MCPHub service variables. - Add a server under Servers, or install one from the Market, then create a group.
- Connect a client to
https:///mcp(or/mcp/) with the headerAuthorization: Bearer. - 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
MCPHub
samanhappy/mcphub:1.2.6Postgres
pgvector/pgvector:pg17
