Ragstar MCP Server
Provides tools for interacting with a dbt project's knowledge base, enabling browsing and filtering of dbt models, semantic search for relevant models using natural language, retrieval of detailed model information including SQL and lineage, and an overview of connected dbt projects.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Ragstar MCP Servershow me the SQL and lineage for the orders model"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Ragstar β AI Data Analyst for dbt Projects
Ragstar is in public Ξ²eta. Expect rapid changes and occasional rough edges.
1. What is Ragstar?
Ragstar connects to your dbt project, builds a knowledge base from models & documentation, and lets everyone ask data-related questions in plain English via a beautiful web dashboard or Slack. Under the hood Ragstar combines:
PostgreSQL +
pgvectorfor fast similarity searchEmbeddings + LLMs (OpenAI, Anthropic, etc.) for reasoning
A modern Next.js frontend & Django backend
Screenshots
Dashboard

Integrations

Settings

Related MCP server: DataHub MCP Server
2. Quick start (π 2 commands)
# β clone & prepare env file
$ git clone https://github.com/pragunbhutani/ragstar.git && cd ragstar
$ cp .env.example .env && ${EDITOR:-vi} .env # β edit just the vars shown below
# β‘ build & run everything
$ docker compose up --build -dWhen the containers are healthy:
Frontend: http://localhost:3000 (Next.js)
API: http://localhost:8000 (Django/DRF)
Flower: http://localhost:5555 (background tasks)
Run first-time Django tasks:
# inside the running backend container
$ docker compose exec backend-django \
uv run python manage.py migrateπ That's it β open http://localhost:3000, sign up for a new account and you're ready to start using Ragstar.
3. Environment variables
Only a handful of variables are truly required for a local/dev install. The rest are advanced overrides.
Ragstar keeps the default stack as lightweight as possible.
For a local docker compose run you only need 3 variables β everything else has sane fall-backs.
3.1 Required for local/dev
Var | Example | Purpose |
|
| Secret used by next-auth to sign session cookies |
|
| Public URL where the frontend is reachable |
|
| Public URL of the Django API exposed to the browser |
Create a .env file in the repo root and paste the three lines above (adjust URLs if you changed the ports).
3.2 Common overrides (optional)
Var | Default | When you might set it |
|
| Only needed when the frontend talks to the backend across Docker networks or remote hosts. |
|
| Switch between |
| β | Extra hostname to append to Django |
| auto-generated by compose | Point the backend & worker to your own Postgres instance. |
|
| Use an external Redis / RabbitMQ instead of the bundled one. |
| not set | Only required when you disable LocalStack and want to store secrets in real AWS Parameter Store. |
3.3 LLM Provider API Keys
You need to provide API keys for all the LLM providers you plan on using.
LLM_OPENAI_API_KEY=...
LLM_ANTHROPIC_API_KEY=...
LLM_GOOGLE_API_KEY=...3.4 Postgres defaults (used by compose)
POSTGRES_DB=ragstar
POSTGRES_USER=user
POSTGRES_PASSWORD=password
POSTGRES_PORT=5432Set a single EXTERNAL_POSTGRES_URL=<url> to BYO Postgres (with the pgvector extension).
4. First-run onboarding
After logging into the dashboard you'll be guided through these steps:
Add a dbt project β Projects βΊ New (dbt Cloud recommended β just paste the service token). GitHub or local zip upload also supported.
Pick the dbt models you want to use for answering questions β choose which model to use for β questions β embeddings β SQL verification.
Configure Slack (optional)
Go to Integrations βΊ Slack.
Follow the inline manifest to create a Slack app.
Paste Bot Token, Signing Secret, App Token.
Ask questions! Use the chat on the dashboard or
/askin Slack.
Other integrations (Metabase, Snowflake, MCP) are available under Integrations but currently Ξ²eta / experimental. MCP server is temporarily disabled while we stabilise streaming support.
5 Managing the stack
Common operations are wrapped in one-liners:
# shell into backend or frontend
$ docker compose exec backend-django bash
$ docker compose exec frontend-nextjs sh
# tail logs
$ docker compose logs -f backend-django
# stop / remove containers
docker compose down # keep volumes
docker compose down -v # destroy DB6. Local dev without Docker (advanced)
Install Python 3.10+, Node 18+, uv, pnpm, and Postgres16+ with
pgvector.uv venv && source .venv/bin/activate && uv pip install -e backend_django/pnpm install --filter frontend_nextjsStart services in two terminals:
Backend β
cd backend_django && uv run python manage.py runserver 0.0.0.0:8000Frontend β
cd frontend_nextjs && pnpm dev
Export the same env vars listed above.
Docker is strongly recommended unless you're hacking on the codebase itself.
7. Contributing
We π community PRs. Please file an issue first for major changes. Make sure ruff, black, mypy, and eslint pass before opening a pull request.
8. MCP Server Integration (Self-Hosted Only)
Ragstar includes a Model Context Protocol (MCP) server that allows LLM clients like Claude.ai to directly access your dbt knowledge base. The MCP server provides secure, OAuth-authenticated access to your dbt models and project information.
β οΈ Important: The MCP server can only be used with self-hosted/open source deployments of Ragstar. This is due to the 1:1 relationship between an MCP client and server β each client needs its own dedicated server instance.
8.1 What is the MCP Server?
The MCP server acts as a bridge between LLM clients (like Claude.ai) and your Ragstar knowledge base. It provides:
Secure OAuth 2.0 authentication with PKCE
Organization-scoped access to dbt models and projects
Real-time data access without manual imports
Semantic search capabilities across your dbt documentation
Detailed model information including SQL, lineage, and metadata
8.2 Available MCP Tools
The MCP server exposes these tools to LLM clients:
list_dbt_modelsβ Browse and filter dbt models by project, schema, or materializationsearch_dbt_modelsβ Semantic search for relevant models using natural languageget_model_detailsβ Get detailed information about specific models including SQL and lineageget_project_summaryβ Overview of connected dbt projects and their structure
8.3 Setting Up the MCP Server
Prerequisites
Self-hosted Ragstar running with Docker Compose
dbt project connected and models loaded in your knowledge base
LLM client that supports MCP (e.g., Claude.ai, ChatGPT with MCP support)
Configuration
The MCP server runs on port 8080 by default. Add these environment variables to your .env file:
# MCP Server Configuration
MCP_AUTHORIZATION_BASE_URL=http://localhost:8000 # Your Django backend URL
DJANGO_BACKEND_URL=http://localhost:8000 # Backend URL for MCP server
ALLOWED_ORIGINS=* # Or specific origins for securityStarting the MCP Server
The MCP server is included in the Docker Compose stack:
# Start all services including MCP server
docker compose up -d
# Check MCP server health
curl http://localhost:8080/health8.4 OAuth 2.0 Flow Explanation
The MCP server implements a complete OAuth 2.0 authorization flow with organization-scoped access. Here's how it works:
Flow Overview
sequenceDiagram
participant Claude as Claude.ai
participant MCP as MCP Server
participant Django as Django Backend
participant User as User Browser
Claude->>MCP: 1. Request OAuth metadata
MCP->>Django: 2. Proxy metadata request
Django->>MCP: 3. Return OAuth configuration
MCP->>Claude: 4. OAuth server metadata
Claude->>MCP: 5. Authorization request (with PKCE)
MCP->>Django: 6. Proxy authorization request
Django->>User: 7. Redirect to frontend login
User->>Django: 8. Authenticate via Next.js
Django->>MCP: 9. Authorization code
MCP->>Claude: 10. Return authorization code
Claude->>MCP: 11. Exchange code for tokens
MCP->>Django: 12. Validate and exchange
Django->>MCP: 13. Access & refresh tokens
MCP->>Claude: 14. JWT tokens
Claude->>MCP: 15. API calls with Bearer token
MCP->>Django: 16. Validate token & get user context
Django->>MCP: 17. Organization-scoped data
MCP->>Claude: 18. Formatted responseKey Components
OAuth Metadata Discovery: MCP server exposes RFC 8414 compliant metadata endpoints
PKCE Security: Uses Proof Key for Code Exchange for enhanced security
Auto-Registration: Automatically registers new OAuth clients (like Claude.ai)
Organization Scoping: All data access is automatically scoped to the user's organization
JWT Tokens: Secure, stateless authentication using JSON Web Tokens
Security Features
PKCE (Proof Key for Code Exchange): Prevents authorization code interception attacks
Organization Isolation: Users can only access their organization's data
Token Validation: All API calls require valid JWT tokens
Automatic Expiry: Access tokens expire after 1 hour, refresh tokens after 7 days
8.5 Connecting Claude.ai to Your MCP Server
Step 1: Configure MCP in Claude.ai
Go to Claude.ai settings
Find the "MCP Servers" or "Model Context Protocol" section
Add a new server with these details:
Server URL:
http://localhost:8080(or your public URL)OAuth: Enable OAuth 2.0 authentication
Auto-discovery: Enable to automatically discover capabilities
Step 2: Authorize the Connection
Claude.ai will redirect you to your Ragstar login page
Sign in with your Ragstar account
You'll be redirected back to Claude.ai with authorization
The connection will be linked to your organization
Step 3: Start Using MCP Tools
You can now ask Claude.ai to:
"List all my dbt models"
"Search for revenue-related models"
"Show me details about the customer_metrics model"
"What dbt projects do I have connected?"
8.6 Example MCP Interactions
Listing Models
You: "What dbt models do I have available?"
Claude: [Calls list_dbt_models tool]
Claude: "You have 23 dbt models across 2 projects:
- analytics_prod: 15 models (staging, marts schemas)
- marketing_analytics: 8 models (staging, reporting schemas)
..."Searching Models
You: "Find models related to customer revenue"
Claude: [Calls search_dbt_models with "customer revenue"]
Claude: "I found 3 relevant models:
- customer_revenue_monthly (similarity: 0.95)
- customer_ltv_calculation (similarity: 0.87)
- revenue_attribution (similarity: 0.82)
..."Getting Model Details
You: "Show me the SQL for customer_revenue_monthly"
Claude: [Calls get_model_details for "customer_revenue_monthly"]
Claude: "Here's the customer_revenue_monthly model:
- Schema: marts
- Materialization: table
- SQL: SELECT customer_id, DATE_TRUNC('month', order_date) as month, SUM(amount) as revenue FROM..."8.7 Troubleshooting MCP Connection
Common Issues
Authentication Fails: Check that your Ragstar backend is accessible and you're logged in
No Models Found: Ensure your dbt project is connected and models are loaded
Permission Errors: Verify the user has access to the organization's dbt projects
Network Issues: Check firewall settings and port accessibility
Debug Commands
# Check MCP server health
curl http://localhost:8080/health
# Test OAuth metadata
curl http://localhost:8080/.well-known/oauth-authorization-server
# View MCP server logs
docker compose logs -f mcp-server8.8 Production Deployment
For production use:
Use HTTPS: Configure SSL certificates for secure connections
Restrict Origins: Set specific allowed origins instead of
*Monitor Usage: Track OAuth token usage and API calls
Scale Considerations: Each client needs its own server instance
8.9 Limitations
1:1 Client-Server Relationship: Each MCP client needs its own server instance
Organization Scoping: Users can only access their own organization's data
Token Expiry: Access tokens expire after 1 hour (refresh tokens after 7 days)
Self-Hosted Only: Not available in hosted/SaaS deployments
9. Contributing
We π community PRs. Please file an issue first for major changes. Make sure ruff, black, mypy, and eslint pass before opening a pull request.
10. License
Ragstar is released under the MIT License β see LICENSE.
This server cannot be deployed
Maintenance
Related MCP Connectors
The grounded data layer for any LLM: governed SQL, metrics, lineage and catalog over your data.
Versioned documentation registry and semantic search for AI tools and coding assistants.
Code intelligence for LLMs. Analyze, search, and retrieve code from any public git repository.
Query your org's data in natural language β read-only MCP access to SQL, NoSQL, files & warehouses.
Related MCP Servers
- AlicenseBqualityCmaintenanceA read-only MCP server that exposes dbt project artifacts and data quality result tables (BigQuery/Postgres) to LLM clients, enabling deep introspection, run-history analysis, source freshness, test coverage, and lineage walks.2728 npmMIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to search, explore data lineage, understand business context, and generate SQL queries across an organization's data ecosystem.Apache 2.0
- AlicenseNot gradedqualityBmaintenanceEnables governed, audit-traced AI access to a curated knowledge base through the Model Context Protocol, with OAuth 2.1 authentication and policy enforcement for secure, compliant queries.Apache 2.0
- AlicenseNot gradedqualityBmaintenanceEnables Agents to retrieve structured evidence with spans, versions, and content hashes from a self-hosted knowledge base, and optionally delegate single-shot questions. Exposes read-only search, evidence lookup, and answer tools over Streamable HTTP with Bearer authentication.MIT