Deploy MCP Toolbox for Databases
Remote MCP server with PostgreSQL tools behind a bearer-token gateway
Gateway
MCP Gateway
Just deployed
MCP Toolbox
MCP Toolbox
Just deployed
Database
Just deployed
/var/lib/postgresql/data
Deploy and Host MCP Toolbox for Databases on Railway
MCP Toolbox for Databases is Google's open-source MCP server for databases. It gives AI agents and MCP clients ready-made tools to explore schemas, run SQL and inspect database health.
About Hosting MCP Toolbox for Databases
This template runs MCP Toolbox 1.17.0 as a remote MCP endpoint with its 29 prebuilt PostgreSQL tools, connected over TLS to a private Railway PostgreSQL 17 database. A small Caddy gateway is the only public service: every MCP request must carry Authorization: Bearer YOUR_MCP_AUTH_TOKEN, a 48-character token generated at deploy time, and anything else gets 401. Toolbox and PostgreSQL stay on Railway's private network.
After deployment, copy the gateway's domain and its MCP_AUTH_TOKEN variable, then point your MCP client at https://YOUR-GATEWAY-DOMAIN/mcp with that bearer token. To serve your own PostgreSQL database instead, change the Toolbox service's POSTGRES_* variables.
Why Deploy MCP Toolbox for Databases on Railway
Toolbox has no built-in static-token login, so exposing it directly would hand your database to anyone who finds the URL. This template adds the missing access boundary, pins every image by digest, and wires the database credentials through Railway references, so you get a working, protected remote MCP server in one click.
Common Use Cases
- Let Claude Code, Cursor, VS Code or another MCP client query and explain a PostgreSQL database.
- Give an AI agent schema discovery and SQL tools on a scratch database for prototyping.
- Inspect slow queries, locks, bloat and settings of a PostgreSQL database through MCP.
Dependencies for MCP Toolbox for Databases Hosting
The deployment uses MCP Toolbox for Databases, PostgreSQL 17 and Caddy.
Deployment Dependencies
- One public Railway domain, on the Caddy gateway only
- A 5 GB volume for PostgreSQL
- Generated PostgreSQL password and MCP bearer token
- An MCP client that can send an
Authorization: Bearerheader
Whoever holds the token can run any SQL the configured database role allows. Use a least-privilege role when you connect production data. Source: googleapis/mcp-toolbox, docs: mcp-toolbox.dev.
Template Content

