---
title: "Deploy MCP Toolbox for Databases"
description: "Google's MCP server for databases: PostgreSQL tools behind a bearer token"
category: "AI/ML"
url: https://railway.com/deploy/mcp-toolbox-for-da-1
---

# Deploy MCP Toolbox for Databases

Google's MCP server for databases: PostgreSQL tools behind a bearer token

**[Deploy MCP Toolbox for Databases on Railway](https://railway.com/template/mcp-toolbox-for-da-1)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/mcp-toolbox-for-da-1/manifest.json

- **Creator:** Agaz Self-Host
- **Category:** AI/ML

## Template content

### MCP Toolbox https://raw.githubusercontent.com/googleapis/mcp-toolbox/v1.18.0/logo.png

- **Source:** https://github.com/aalfath/mcp-toolbox-railway-template
- **Health check:** /healthz
- **Public domain:** Yes

### Postgres https://devicons.railway.app/i/postgresql.svg

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:18

## Documentation

# 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](https://github.com/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](https://github.com/googleapis/mcp-toolbox) and its [1.18.0 release](https://github.com/googleapis/mcp-toolbox/releases/tag/v1.18.0)
* [Toolbox documentation](https://mcp-toolbox.dev)
* An MCP client that can send an `Authorization: Bearer` header

### 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:

```json
{ "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.



## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [Weaviate](https://railway.com/deploy/weaviate-1) — Vector database with hybrid search and an API key-protected API
- [Möbius Personal AI OS](https://railway.com/deploy/mobius-v01-personal-ai-os) — Self-hosted AI agent that builds and runs apps for you, with memory.

Open this page in a browser: https://railway.com/deploy/mcp-toolbox-for-da-1
