LabscoMCP early access ↗
krzysztofgawrysMCP SERVER

Terraform RAG

Search your own Terraform modules — and how your teams actually use them — from the IDE.

by krzysztofgawrys ↗Cloud Resources & Infrastructure as CodeCommunity

LABSCO SUMMARY

Reading the modules is half of it; reading the callers is the other half.

Plenty of tools can index module source. What is unusual here is indexing consumer repositories too, so the answer to "how do we tag things" comes from what your teams actually wrote rather than from the module's documentation. Two things to settle before adopting: the licence is BUSL 1.1, so production use is a commercial conversation, and authentication is disabled by default — turn it on before the instance is reachable by anyone else.

What it is

A knowledge base over your Terraform module repositories. It clones them, parses every HCL file, embeds the results into PostgreSQL with pgvector, and then indexes consumer repositories to learn how the modules are really used — naming, variables, tagging, layout. The MCP endpoint puts that base in front of an agent.

What you get

  • Nine tools — 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 a semantic_query for natural-language search rather than exact names
  • get_dependencies walks the dependency tree using PostgreSQL recursive CTEs, so you can trace what depends on what
  • get_module_usage and find_similar_usages answer 'how do we normally call this' from real consumer code
  • A knowledge layer distils conventions across six dimensions — naming, variables, tagging, layout, versions and deployment — and treats them as authoritative in prompts
  • Version tracking through automatic git tag discovery, with code-hash caching so re-indexing does not repeat LLM and embedding calls
  • A full audit trail of LLM, MCP and API calls

Requirements

You host it. git clone, cp .env.example .env, set POSTGRES_PASSWORD, JWT_SECRET and an LLM API key, then docker compose up -d — the frontend on port 3000, the API on port 8000, the MCP endpoint at http://localhost:8000/mcp/. Index a repository by POSTing its repo_url and branch to /index/; private repos need an SSH deploy key at ./worker_deploy_key or a path in SSH_KEY_PATH. The LLM backend is your choice — Anthropic directly or through Bedrock, OpenRouter, Ollama, or any OpenAI-compatible endpoint, selected with LLM_BASE_URL and LLM_MODEL. Authentication is off by default, with local email/password plus JWT or ALB-terminated SSO as alternatives. Licensed under BUSL 1.1: non-production use is permitted, production use needs a commercial licence until it converts to AGPL-3.0 in 2029.

Setup effort

Run a container — build the image from the repository, then point your client at it