Deploy treg
Self-hosted tools registry for MCP/AI agents.
treg
Just deployed
Deploy and Host treg on Railway
OpenRouter for agent tools — one base URL and one token to reach a catalog of thousands of priced API endpoints (SEO, social, enrichment, ads, scraping, image/video generation), plus your own tools and team keys. No provider signups required.
Full reference (catalog, treg CLI usage, provider and skill docs,
architecture) lives in the app README on GitHub:
github.com/mc9max/treg/blob/master/README.md.
About Hosting
treg is a single service: a Python/uvicorn API (serving the web dashboard and
JSON API on one port) plus your frontend assets baked into the image. The
container healthcheck probes GET /meta. All durable state lives under
/app/data — the bundled SQLite database, the Fernet encryption key (minted
on first boot), and any uploaded assets. A Railway volume named treg-data
mounted at /app/data (declared in railway.json) keeps all of this
durable; without it the app still boots but resets on each redeploy.
Startup is two stages in the image's entrypoint.sh: an idempotent
treg upgrade (catalog + schema migration) first, then uvicorn. On Railway
the PORT env var wins over the image default (8080 is the practical
default for a fresh deploy), and the public domain routes to that port.
Why Deploy treg
- One token, one base URL for your agent to reach hundreds of upstream services. No per-provider signups, no per-provider keys in your agent config, no per-provider bill.
- Own keys always win. A teammate's Reseller, Stripe, or Apollo credential beats treg's catalog for calls made under their token; the credential never leaves the server, and those calls are not metered by treg.
- Bring your own tools. Register a
SKILL.md, a CLI wrapper (stripe,gh), or an arbitrarybase_urlwith its own OAuth/secret bindings — and every teammate with a token in the same org can call it through the same proxy. - Priced per call, at cost. The catalog routes to a wide set of vendors under treg's own account and bills each agent at the per-call cost of the upstream (fractions of cent) — no markup.
Common Use Cases
- An agent stack (your LLM provider + agent framework) that needs real-world
actions — backlinks, social posts, company records, ad data, images,
video — behind one
Authorization: Bearerheader. - A shared team dashboard to grant each teammate their own treg token, their own balance / own keys, and their own set of visible tools.
- A self-hosted "tools-as-HTTP" gateway in front of any LLM, so the LLM never has to learn a per-vendor SDK.
Dependencies for treg on Railway
Deployment Dependencies
Everything treg needs to run is either baked into the image or auto-populated by the deploy form — no sidecar service is required:
- Postgres (optional, recommended for production) —
TREG_DATABASE_URLdefaults to the bundled SQLite on the persistent volume. Point this at a Postgres service when you want multi-replica durability. - A public domain —
TREG_PUBLIC_URLis pre-filled from the deployment's domain via theRAILWAY_PUBLIC_DOMAINsystem reference (the*.up.railway.appURL by default); override it if you front treg with a custom domain. This value anchors the OAuth callback (https://YOUR-DEPLOYMENT-DOMAIN/auth/github/callback) and is what a fresh installer hits from their agent.
No other required services. The optional integrations (each a variable on the deploy form; leaving them blank just disables that door — the deploy still succeeds):
- Email OTP via Resend —
TREG_RESEND_API_KEY+ a Resend-verified sending domain (SPF/DKIM), with theTREG_EMAIL_FROMheader set to that domain. One-time codes arrive by email. - Telemetry —
TREG_TELEMETRY_DISABLE=truestops your instance phoning treg.to from the agent-side; leave unset only if you want the hosted catalog kept in sync upstream.
GitHub OAuth is the only identity door configured in this template's form
(TREG_GITHUB_CLIENT_ID + TREG_GITHUB_CLIENT_SECRET); Google OAuth is
available in the codebase but is not exposed as a form variable here, and
self-hosted SMTP is likewise available in code but not surfaced as form
variables. If you want either, extend template-vars.json with the
TREG_GOOGLE_* / TREG_SMTP_* keys and re-publish — the image already
supports them.
Notes
- First login needs at least one identity provider configured — the app intentionally refuses no-login mode when a public domain is in front of it, so pick one door in the deploy form before your first sign-in. GitHub OAuth is the zero-credential path: it only needs your own GitHub OAuth App, not a mail vendor or a Resend key.
- The
treg-datavolume is mandatory for durable state — without it the app boots and serves, but your SQLite database + Fernet key re-mint on every redeploy and your previous data is gone. - Port: on Railway the public domain always routes to
8080(Railway's injected default for the service), not the image default18790. The app readsPORTat runtime, sohttp://SERVICE.railway.internal:8080is the port for local health checks.
Template Content
treg
mc9max/tregTREG_EMAIL_FROM
Optional — From header for transactional email (e.g. treg no-reply@your-domain.com). Defaults to tools-registry no-reply@treg.to if left blank.
TREG_PUBLIC_URL
Public URL this instance is reachable at (e.g. https://treg-abc123.up.railway.app). MUST be set to the Railway deployment domain before first login — it anchors the GitHub OAuth callback. Leave blank during deploy; update it after the first deploy once you know the domain, then redeploy.
TREG_RESEND_API_KEY
Optional — Resend API key for email OTP login. Requires a Resend-verified sending domain (SPF/DKIM).
TREG_GITHUB_CLIENT_ID
GitHub OAuth App Client ID (recommended login door). Create at github.com/settings/developers. The callback URL to register is: https://YOUR-DEPLOYMENT-DOMAIN/auth/github/callback
TREG_GITHUB_CLIENT_SECRET
GitHub OAuth App Client Secret (pair with TREG_GITHUB_CLIENT_ID). Required for the GitHub login door to work. At least one identity provider must be configured before first sign-in.
