Terraform RAG MCP Server

Terraform RAG MCP Server

rag-for-terraform•bykrzysztofgawrys

An MCP server exposing a Terraform module knowledge base so IDE agents can query, inspect, and compose modules.

License: Business Source License 1.1•Runtime: Awaiting documentation review•Category: developer tools

WHAT IT DOES

  • •Exposes nine MCP tools for querying modules, module details, dependencies, usage, similar usages, example code, and stats.
  • •Provides a Streamable HTTP MCP endpoint usable from any MCP-compatible client.
  • •Searches an indexed knowledge base built from parsed Terraform module repositories.
  • •Supports dependency graph lookups using PostgreSQL recursive CTEs.

BEST FOR

  • •Developers who want to query Terraform module knowledge directly from their IDE.
  • •Teams needing to find module dependencies and trace impact between Terraform modules.

ABOUT RAG-FOR-TERRAFORM

Terraform RAG MCP Server is cataloged as an MCP server attributed to krzysztofgawrys. An MCP server exposing a Terraform module knowledge base so IDE agents can query, inspect, and compose modules. It is categorized under developer tools. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: Business Source License 1.1. Check the source repository's current license and terms before using, modifying or distributing this software.

Capability inspector

Capability definitions are not reviewed. Unreviewed imports are not exposed as trusted interfaces.

Tools (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

Resources (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

Prompts (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for Terraform RAG MCP Server are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

What query modes does the agentic pipeline support?

It supports four query modes: compose, search, optimize, and audit.

Which LLM backends can be used?

It supports Anthropic (direct or Bedrock), OpenRouter, Ollama, or any OpenAI-compatible endpoint.

Upstream README

View this exact version on GitHub

README.md · 89d633a3437a · Fetched 2026-11-13 12:16:14 UTC

Original upstream text, without AI rewriting. Scripts, forms and unsafe links are filtered for safety.

Showing the last retrieved documentation snapshot; check the source for current changes.

⬡

Terraform RAG

AI-powered knowledge base for your Terraform modules.
Index, search, compose, and audit - all from one place.

Live Demo - Architecture - Quick Start - MCP Server

Python 3.12 FastAPI pgvector MCP License


Try the live demo

Web UI - browse 2700+ modules across 175+ repos (AWS / Azure / GCP):

https://terraform-rag.io

Login: demo@terraform-rag.io / demo (read-only)

MCP - connect your IDE to the knowledge base:

{
  "mcpServers": {
    "terraform-rag": {
      "type": "http",
      "url": "https://terraform-rag.io/mcp",
      "headers": {
        "Authorization": "Bearer trag_6c495d7a027369cb5d324d877626c272"
      }
    }
  }
}

9 tools available: query_modules, pick_modules, list_modules, get_module_details, get_dependencies, get_module_usage, find_similar_usages, fetch_example_code, get_stats (list_modules also takes semantic_query for natural-language search).


What it does

Point it at your Terraform module repositories. It clones them, parses every HCL file, generates embeddings, and builds a searchable knowledge base in PostgreSQL + pgvector. Then it learns how those modules are actually used across your consumer repos - naming patterns, variable conventions, tagging strategies, deployment layouts - and distils that into authoritative guidance.

An agentic pipeline (Claude, Bedrock, or any OpenAI-compatible model) explores the knowledge base across multiple tool-use turns to assemble grounded, reviewable answers - assistive retrieval with a human in the loop, not an autonomous code generator. Query from the web UI, the REST API, or directly from your IDE via MCP.

See it in action

Module browser
Module Browser - 2700+ modules across 175+ repos
Agentic query
Agentic Compose - tool calls and reasoning in real time
Generated HCL
Generated HCL - syntax-highlighted output
Knowledge browser
Knowledge Browser - conventions and usage patterns
Index jobs
Index Jobs - repository indexing dashboard
Audit logs
Audit Logs - full trail of LLM, MCP, and API calls

Features

Agentic Query Pipeline - more than a single RAG lookup. The LLM browses modules, checks details, reads conventions, and fetches example code across multiple tool-use turns before composing an answer for you to review. Four query modes: compose, search, optimize, and audit.

Knowledge Layer - indexes consumer repos to learn real-world usage patterns. Distils conventions across six dimensions (naming, variables, tagging, layout, versions, deployment) and treats them as authoritative guidance in all prompts.

MCP Server - Streamable HTTP endpoint works with Claude Code, Cursor, Windsurf, and any MCP-compatible client. Query your module knowledge base directly from your IDE.

Dependency Graph - PostgreSQL recursive CTEs map the full dependency tree between modules. Find what depends on what, trace impact, and visualize relationships with a D3 force-directed graph.

Version Tracking - automatic git tag discovery with per-module version history. Code-hash caching avoids redundant LLM/embedding calls on re-index.

Flexible LLM Backend - Anthropic (direct or Bedrock), OpenRouter, Ollama, or any OpenAI-compatible endpoint. Swap models without changing code.

CI/CD Integration - GitHub Actions workflow and webhook endpoints for automatic re-indexing when .tf files change.

Authentication - disabled (default), local email/password with JWT, or ALB-terminated SSO via AWS Identity Center / OIDC.

Quick Start

# 1. Clone and configure
git clone https://github.com/krzysztofgawrys/rag-for-terraform.git
cd rag-for-terraform
cp .env.example .env
# Edit .env - set POSTGRES_PASSWORD, JWT_SECRET, and your LLM API key

# 2. Start everything
docker compose up -d

# 3. Index your first repo
curl -X POST http://localhost:8000/index/ \
  -H "Content-Type: application/json" \
  -d '{"repo_url": "git@github.com:org/tf-modules.git", "branch": "main"}'

For private repos, place your SSH deploy key at ./worker_deploy_key (or set SSH_KEY_PATH in .env).

MCP Server

Connect any MCP-compatible client to http://localhost:8000/mcp/.

Claude Code (.mcp.json):

{
  "mcpServers": {
    "terraform-rag": {
      "type": "http",
      "url": "http://localhost:8000/mcp/"
    }
  }
}

Available tools: query_modules, pick_modules, list_modules, get_module_details, get_dependencies, get_module_usage, find_similar_usages, fetch_example_code, get_stats.

LLM Configuration

ModeLLM_BASE_URLLLM_MODEL example
Anthropic (direct)(empty)claude-sonnet-4-6
AWS Bedrock(set AWS_BEDROCK_REGION)us.anthropic.claude-sonnet-4-6-20250514-v1:0
OpenRouterhttps://openrouter.ai/api/v1anthropic/claude-sonnet-4-6
Ollama (local)http://ollama:11434/v1qwen2.5-coder:32b

A separate cheap model can be used for module descriptions during indexing (DESCRIPTION_LLM_* variables).

Architecture

  Browser         AI Agent / IDE
     |               |
+---------+      +--------+      +----------------+
| Frontend|----->|  API   |----->| PostgreSQL 16  |
| (Vite)  |      | FastAPI|      | + pgvector     |
+---------+      +---+----+      +----------------+
                     |
                +----+----+
                | Worker  |      +-------+
                | (Celery)|----->| Redis |
                +---------+      +-------+

For the full technical deep-dive - stack details, directory structure, API endpoints, agent internals, knowledge layer pipeline, known limitations, and deployment notes - see docs/ARCHITECTURE.md.

License

Business Source License 1.1 - see LICENSE for details.

  • Non-production use (evaluation, testing, development) is permitted
  • Production use requires a commercial license from the author
  • On 2029-05-25 the license converts to AGPL-3.0

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for Terraform RAG MCP Server from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/rag-for-terraform)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

Downloads and pulls

Separate sources, scopes and periods. Never combined or treated as installations, active users or security reviews.

No reviewed package or image identity; download statistics are not listed yet.

Related developer tools MCP Servers

Alternative and complementary servers in the same category

View all in developer tools →
Postbye
postbye-mcp•postbye-team

A directory listing describing a cancellation-letter and mailing-address service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools
Singapore Proxy MCP
singapore-proxy-mcp•Xavierfok

A hosted MCP service for browsing and searching through Singapore mobile-network proxies.

0
Developer Tools

A directory listing describing a Markdown-to-PDF service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools