
Deploy MCP Toolbox for Databases
Google's MCP server for databases: PostgreSQL tools behind a bearer token
MCP Toolbox
Just deployed
Just deployed
/var/lib/postgresql/data
Deploy and Host MCP Toolbox for Databases on Railway
MCP Toolbox for Databases is Google's open-source (Apache-2.0) MCP server for databases. It gives AI agents and MCP clients such as Claude, Cursor, VS Code or Gemini CLI ready-made, configurable tools to explore schemas, run SQL and check the health of PostgreSQL, MySQL, SQL Server, SQLite, BigQuery and more.
About Hosting MCP Toolbox for Databases
This template runs MCP Toolbox 1.18.0 (official image, pinned by digest) as a remote MCP server over streamable HTTP, with its 29 prebuilt PostgreSQL tools connected to a private Railway PostgreSQL database. Toolbox has no login of its own, so a small Caddy gate in the same container is the only thing on the public port: every request must send Authorization: Bearer MCP_AUTH_TOKEN, a 48-character token generated at deploy time, and anything else gets 401. There is nothing to fill in. After deploy, copy the service's domain and its MCP_AUTH_TOKEN variable into your MCP client.
Common Use Cases
- Let Claude Code, Cursor, VS Code or another MCP client explore, query and explain a PostgreSQL database
- Give an AI agent schema discovery and SQL tools on a scratch database for prototyping
- Check slow queries, locks, bloat, indexes and settings of a PostgreSQL database through MCP
Dependencies for MCP Toolbox for Databases Hosting
- MCP Toolbox (built from aalfath/mcp-toolbox-railway-template): Toolbox 1.18.0 plus the bearer-token gate, public URL, health check at
/healthz, no state of its own - Postgres (Railway PostgreSQL): the working example database, on its own volume, reached over Railway's private network
Deployment Dependencies
- MCP Toolbox for Databases on GitHub and its 1.18.0 release
- Toolbox documentation
- An MCP client that can send an
Authorization: Bearerheader
Implementation Details
Connect a client (Claude Code):
claude mcp add --transport http toolbox https://YOUR-DOMAIN/mcp --header "Authorization: Bearer YOUR-MCP-AUTH-TOKEN"
Or in a JSON client config:
{ "mcpServers": { "toolbox": { "type": "http", "url": "https://YOUR-DOMAIN/mcp", "headers": { "Authorization": "Bearer YOUR-MCP-AUTH-TOKEN" } } } }
Whoever holds the token can run any SQL the database role allows (the prebuilt set includes execute_sql, one statement per call), so keep it secret. To serve your own PostgreSQL instead, change the POSTGRES_* variables on the MCP Toolbox service, ideally to a read-only role. Optional: TOOLBOX_PREBUILT loads other prebuilt tool sets (for example mysql or mssql, each with its own connection variables), and TOOLS_YAML or TOOLS_YAML_BASE64 replaces them with your own tools.yaml.
The service uses about 45 MB of RAM idle and about 240 MB while returning a 200,000-row result, so it fits Railway's Free plan (0.5 GB); add LIMIT to very large queries. If Toolbox or the gate stops, the container exits non-zero and Railway restarts it.
Updates: the service builds from the GitHub repo above. When we test a new Toolbox release, we bump the pinned image and note it in CHANGELOG.md, and Railway shows an "update available" notice on your project, which you apply when you choose.
Why Deploy MCP Toolbox for Databases 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 MCP Toolbox for Databases 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

