---
title: "Deploy txtai"
description: "Embeddings database with semantic search, graph, RAG and an MCP server"
category: "AI/ML"
url: https://railway.com/deploy/txtai
---

# Deploy txtai

Embeddings database with semantic search, graph, RAG and an MCP server

**[Deploy txtai on Railway](https://railway.com/template/txtai)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/txtai/manifest.json

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

## Template content

### txtai https://raw.githubusercontent.com/neuml/txtai/v9.14.0/logo.png

- **Source:** https://github.com/aalfath/txtai-railway-template
- **Health check:** /docs
- **Public domain:** Yes

## Documentation

# Deploy and Host txtai on Railway

txtai is an open-source, all-in-one embeddings database from NeuML. It combines a vector index, a SQLite content store and a semantic graph in one service, and serves semantic search, graph queries, retrieval augmented generation (RAG) and a Model Context Protocol (MCP) server through a single REST API.

## About Hosting txtai

This template builds txtai 9.14.0 from the official `neuml/txtai-cpu` image, pinned by digest in a public GitHub repo, so you get an update notice when a new version is merged. It runs as one service with a volume at `/data` that holds the index, its content store and graph, and the downloaded embedding model, so restarts and redeploys keep your data. Upstream ships the API without authentication; here every route and the MCP endpoint need a bearer token that Railway generates at deploy, and the service refuses to start without one. Embeddings run on CPU inside the service, so indexing and search need no API key.

## Common Use Cases

* Semantic search API for your app, docs or support tickets, without a separate vector database or an embeddings bill
* Long-term memory and knowledge search for AI agents over MCP (Claude Code, Cursor and other MCP clients that can send a header)
* RAG backend that answers questions from your own documents with any LiteLLM-supported model
* Exploring how documents relate: graph search returns the matching documents and the links between them

## Dependencies for txtai Hosting

* txtai 9.14.0 (`neuml/txtai-cpu`), built from `aalfath/txtai-railway-template`
* A Railway volume at `/data` for the index and model cache
* Optional: an LLM provider key (OpenAI, Anthropic and others through LiteLLM) for `/rag`

### Deployment Dependencies

* txtai on GitHub: https://github.com/neuml/txtai
* txtai releases: https://github.com/neuml/txtai/releases
* API documentation: https://neuml.github.io/txtai/api/
* Configuration reference: https://neuml.github.io/txtai/api/configuration/
* Template repo: https://github.com/aalfath/txtai-railway-template

### Implementation Details

After the deploy, copy `API_TOKEN` from the txtai service's Variables tab and send it as a bearer token:

```bash
URL=https://YOUR-DOMAIN; AUTH="Authorization: Bearer YOUR-API-TOKEN"

# Add documents, then build and save the index on the volume
curl -X POST "$URL/add" -H "$AUTH" -H "Content-Type: application/json" \
  -d '[{"id": "ada", "text": "Ada Lovelace wrote the first program for the Analytical Engine."}]'
curl "$URL/upsert" -H "$AUTH"

# Semantic search, and the same search as a graph
curl -G "$URL/search" -d query=who+programmed+the+engine -d limit=3 -H "$AUTH"
curl -G "$URL/search" -d query=early+computers -d graph=true -H "$AUTH"
```

**MCP.** The endpoint is `https://YOUR-DOMAIN/mcp` (SSE transport) with the same header. In Claude Code: `claude mcp add --transport sse txtai https://YOUR-DOMAIN/mcp --header "Authorization: Bearer YOUR-API-TOKEN"`.

**RAG.** To turn on `GET /rag`, add `LLM_MODEL` (any LiteLLM model, for example `openai/gpt-4o-mini`) and the matching provider key (`OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, ...) to the service, then redeploy.

**Your own config.** Set `CONFIG` to a txtai YAML string to replace the generated configuration; keep `path:` under `/data`. `EMBEDDINGS_MODEL` picks the Hugging Face model; changing it after indexing means re-indexing. The interactive API docs are at `/docs`.

## Why Deploy txtai 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 txtai 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/txtai
