loading…
Search for a command to run...
loading…
Provides comprehensive Terragrunt documentation, configuration generation, and tooling integration for AI assistants, enabling intelligent assistance with Terra
Provides comprehensive Terragrunt documentation, configuration generation, and tooling integration for AI assistants, enabling intelligent assistance with Terragrunt configurations, CLI commands, and HCL syntax.
A Model Context Protocol (MCP) server that provides comprehensive Terragrunt documentation and tooling integration for AI assistants like GitHub Copilot in VS Code.
This MCP server enables AI assistants to access and search the complete Terragrunt documentation, providing intelligent assistance for working with Terragrunt configurations, CLI commands, and HCL syntax. It features a robust caching system with network resilience and multiple fallback mechanisms.
New: Multi-mode architecture with 60-94% token overhead reduction for optimized AI assistant integration. Choose the mode that fits your workflow: CORE (docs), CONFIG (generation), GUIDANCE (troubleshooting), OBSERVABILITY (metrics), or FULL (all tools).
.cache/terragrunt-docs/)See Lazy Loading Documentation for performance optimization details.
See Advanced Backend Templates for enterprise configuration options.
8 consolidated tools for comprehensive Terragrunt assistance:
search_docs - Unified Documentation SearchUnified tool for all documentation search needs - semantic search, browsing sections, retrieving content, and finding code examples.
mode (string, optional): Operation mode - search, list, section, or examples (default: search)query (string, conditional): Search query text (required for search mode, optional for examples)section (string, conditional): Section name (required for section mode)detailLevel (string, optional): summary or full (default: summary)function_reference - Built-in Function ReferenceGet function details OR list all functions - unified tool for Terragrunt built-in function documentation.
function_name provided):function_name (string): Function name (e.g., "path_relative_to_include", "get_env")mode (string, optional): Detail level - summary or full (default: summary)include_examples (boolean, optional): Include code examples (default: true)function_name):category (string, optional): Filter by category (e.g., "path", "aws", "environment")search (string, optional): Search in function names and descriptionspage (number, optional): Page number (default: 1)pageSize (number, optional): Results per page (default: 20)cli_reference - CLI Command ReferenceGet command help OR list commands - unified tool for Terragrunt CLI command documentation.
command provided):command (string): Command name (e.g., "plan", "apply", "run-all", "hclfmt")command):category (string, optional): Filter by category (main, backend, stack, catalog, discovery, configuration, shortcut)search (string, optional): Search in command names and descriptionspage (number, optional): Page number (default: 1)pageSize (number, optional): Commands per page (default: 20)get_hcl_config_reference - HCL Configuration ReferenceGet documentation for HCL configuration blocks used in terragrunt.hcl files.
config (string, optional): Block name (e.g., "terraform", "remote_state", "dependency", "inputs", "generate", "locals")category (string, optional): Filter blocks by category (core, modules, generation, execution, iam, terraform)listBlocks (boolean, optional): List all available HCL blocks (default: false)get_guidance - Best Practices & ComparisonsGet best practices, comparisons, or patterns for Terragrunt usage.
query (string, optional): Topic, comparison, or scenariotype (string, optional): Guidance type - best-practices, comparison, or patternmode (string, optional): Detail level - summary or full (default: summary)level (string, optional): Experience level - beginner, intermediate, or advancedlistAll (boolean, optional): List all available guidance (default: false)Example prompts:
"What are the best practices for state management?"
"Compare different approaches for module organization"
"Show me beginner-level dependency management practices"
"What patterns should I use for CI/CD with Terragrunt?"
build_config - Generate or Write Terragrunt ConfigurationGenerate OR write OR generate+write Terragrunt configurations - unified tool for configuration management.
useCase provided, no content):useCase (string): Configuration type - remote_state, provider_generation, dependencies, hooks, or inputsoptions (object): Template variables (varies by use case and backend)backend (string, optional): Backend type for remote_state - s3, azurerm, or gcstier (string, optional): Template tier - essential, advanced, or complete (default: essential)strictValidation (boolean, optional): Enable strict validation (default: false)content provided):content (string): HCL content to writepath (string): File path where config should be writtenoverwrite (boolean, optional): Allow overwriting existing files (default: false)createBackup (boolean, optional): Create backup before overwrite (default: true)createParentDirs (boolean, optional): Create parent directories if missing (default: true)useCase + write=true + path):Example prompts:
"Generate a terragrunt config for S3 remote state in us-east-1"
"Write this configuration to /home/user/terraform/terragrunt.hcl"
"Generate and save an Azure backend configuration to my project"
"Show me how to set up dependencies between terragrunt modules"
diagnose_terragrunt_error - Error Diagnosis and TroubleshootingDiagnose Terragrunt error messages and get actionable solutions, debugging steps, and relevant documentation links.
error_message (string, required): The error message from Terragrunt to diagnosecommand (string, optional): Command that was run (e.g., "apply", "plan")version (string, optional): Terragrunt versionos (string, optional): Operating systemfilePath (string, optional): File path where error occurredmodule (string, optional): Module namebackend (string, optional): Backend typemaxMatches (number, optional): Maximum matches to return (default: 3)minConfidence (number, optional): Minimum confidence score 0-1 (default: 0.3)enableFuzzyMatching (boolean, optional): Enable fuzzy matching (default: true)enrichWithDocs (boolean, optional): Enrich with documentation-sourced solutions (default: false)Example prompts:
"I'm getting this error: Error acquiring the state lock"
"Help me fix: Backend configuration changed since last init"
"Diagnose this terragrunt error and tell me how to fix it"
See the Troubleshooting Guide for detailed usage examples and best practices.
get_server_metrics - Server Metrics and MonitoringRetrieve comprehensive performance metrics for the MCP server, including tool execution times, cache statistics, and error tracking.
format (string, optional): Output format - "json" or "text" (default: "json")filter (string, optional): Filter metrics by tool name prefixreset (boolean, optional): Reset metrics after retrieval (default: false)Example prompts:
"Show me server metrics in text format"
"Get metrics for all 'get_' tools only"
"What's the cache hit rate and average latency?"
"Show me metrics and reset them after"
See the Metrics Collection Guide for detailed usage, reporting, and export options.
For complete tool documentation and examples, see Available Tools.
The Terragrunt MCP Server supports 5 operational modes to optimize token usage and reduce overhead for specific workflows. Each mode loads only the tools and dependencies needed for its use case.
| Mode | Tools | Token Overhead | Memory | Managers | Use Case |
|---|---|---|---|---|---|
| FULL | 8 | 2,441 (baseline) | 0.20 MB | 12/12 | All features, backward compatible |
| CORE | 4 | 965 (-60%) | 0.19 MB | 4/12 | Documentation & reference lookups |
| CONFIG | 2 | 640 (-74%) | 0.08 MB | 6/12 | Configuration generation |
| GUIDANCE | 2 | 683 (-72%) | 0.13 MB | 4/12 | Troubleshooting & best practices |
| OBSERVABILITY | 1 | 155 (-94%) | 0.04 MB | 0/12 | Metrics & monitoring only |
Use CORE mode when:
Use CONFIG mode when:
Use GUIDANCE mode when:
Use OBSERVABILITY mode when:
Use FULL mode when:
Verified performance metrics:
See MODE_PERFORMANCE_VERIFIED.md for detailed benchmarks.
The easiest way to get started is using the pre-built Docker image:
# Pull the latest image
docker pull olofdevopsninja/terragrunt-mcp-server:latest
# Run with Docker
docker run -i olofdevopsninja/terragrunt-mcp-server:latest
# Or use docker-compose
docker-compose up
See the Docker Deployment Guide for detailed instructions.
Clone the repository
Install dependencies:
npm install
Build the server:
npm run build
FULL mode (all tools, default):
{
"mcp.servers": {
"terragrunt": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-v", "mcp-cache:/app/.cache",
"olofdevopsninja/terragrunt-mcp-server:latest"
]
}
}
}
Specialized modes (optimized for specific use cases):
{
"mcp.servers": {
"terragrunt-docs": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-v", "mcp-cache:/app/.cache",
"olofdevopsninja/terragrunt-mcp-server:latest",
"--mode", "core"
]
},
"terragrunt-config": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-v", "mcp-cache:/app/.cache",
"olofdevopsninja/terragrunt-mcp-server:latest",
"--mode", "config"
]
}
}
}
FULL mode:
{
"mcp.servers": {
"terragrunt": {
"command": "node",
"args": ["dist/index.js"],
"cwd": "/absolute/path/to/terragrunt-mcp-server"
}
}
}
Specialized modes using CLI wrappers:
{
"mcp.servers": {
"terragrunt-docs": {
"command": "node",
"args": ["bin/terragrunt-mcp-core"],
"cwd": "/absolute/path/to/terragrunt-mcp-server"
},
"terragrunt-config": {
"command": "node",
"args": ["bin/terragrunt-mcp-config"],
"cwd": "/absolute/path/to/terragrunt-mcp-server"
}
}
}
Alternative: Direct mode flag:
{
"mcp.servers": {
"terragrunt-core": {
"command": "node",
"args": ["dist/index.js", "--mode", "core"],
"cwd": "/absolute/path/to/terragrunt-mcp-server"
}
}
}
Restart VS Code to activate the MCP server
Verify installation: Ask GitHub Copilot: "Search Terragrunt docs for getting started"
Once configured, interact with Terragrunt documentation directly through Copilot in VS Code. The server provides intelligent context for all your Terragrunt questions.
terragrunt-mcp-server/
├── src/
│ ├── index.ts # MCP server entry point
│ ├── handlers/
│ │ ├── tools.ts # Tool execution handlers (7 consolidated tools)
│ │ └── prompts.ts # Prompt templates (future)
│ ├── terragrunt/
│ │ ├── docs.ts # Documentation fetching and caching
│ │ ├── functions.ts # Built-in functions manager
│ │ ├── cli-commands.ts # CLI commands manager
│ │ ├── hcl-blocks.ts # HCL configuration blocks manager
│ │ ├── best-practices.ts # Best practices analyzer
│ │ ├── generator.ts # Configuration generator
│ │ ├── file-writer.ts # Secure file writing
│ │ ├── error-patterns.ts # Error diagnosis patterns
│ │ ├── config.ts # Configuration management
│ │ └── utils.ts # Utility functions
│ └── types/
│ ├── mcp.ts # MCP protocol type definitions
│ └── terragrunt.ts # Terragrunt-specific types
├── test/
│ ├── unit/ # Unit tests (Vitest)
│ ├── integration/ # Integration tests
│ ├── performance/ # Performance benchmarks
│ └── edge-cases/ # Edge case validation
├── fixtures/
│ └── terragrunt-docs-fixture.json # Offline documentation cache
├── .cache/ # Auto-generated cache (gitignored)
│ └── terragrunt-docs/
│ ├── docs-cache.json # Cached documentation (~1.1MB)
│ └── metadata.json # Cache timestamps
├── docs/ # Comprehensive documentation
├── schemas/ # JSON schemas
├── package.json # Node.js dependencies
├── tsconfig.json # TypeScript configuration
└── README.md # This file
src/index.ts: Main entry point that initializes the MCP server with stdio transportsrc/handlers/tools.ts: Implements all 8 consolidated tools for documentation accesssrc/terragrunt/docs.ts: Core documentation manager with caching, retry logic, and fallbackstest/: Comprehensive test suite with unit, integration, and performance testsnpm run build # Compile TypeScript to dist/
npm run dev # Run in development mode with ts-node
npm start # Run compiled server from dist/
npm run lint # Check code style with ESLint
npm run lint:fix # Auto-fix linting issues
npm test # Run all tests (Jest)
npm run test:server # Run integration tests
The project includes comprehensive test coverage (363 tests):
npm test # Run all tests (~92 seconds)
npm run test:server # Integration tests only
npm test -- test/unit # Unit tests only
npm test -- test/performance # Performance benchmarks
npm test -- test/integration # All integration tests
Two CI/CD workflows are available:
Automatic Tests (.github/workflows/test.yml):
Manual Tests (.github/workflows/manual-test.yml):
For detailed testing information, see:
Build and run in Docker for isolated testing:
# Build Docker image
npm run docker:build
# Run with docker-compose
npm run docker:compose:up
npm run docker:compose:logs
npm run docker:compose:down
See DOCKER.md for detailed Docker usage.
See CONTRIBUTING.md for development guidelines and contribution process.
This server implements the Model Context Protocol (MCP) using the official SDK (@modelcontextprotocol/sdk). It provides:
The TerragruntDocsManager implements a sophisticated multi-tier caching strategy:
.cache/terragrunt-docs/ (~1.1MB)Built-in retry mechanism with exponential backoff:
Uses Cheerio to parse the official Terragrunt documentation site:
https://terragrunt.gruntwork.io/docs/See CHANGELOG.md for detailed version history and migration guides.
Current Version: 0.5.0
This project is licensed under the MIT License. See the LICENSE file for details.
Выполни в терминале:
claude mcp add terragrunt-mcp-server -- npx Web content fetching and conversion for efficient LLM usage.
Retrieval from AWS Knowledge Base using Bedrock Agent Runtime.
автор: modelcontextprotocolProvides auto-configuration for setting up an MCP server in Spring Boot applications.
A very streamlined mcp client that supports calling and monitoring stdio/sse/streamableHttp, and can also view request responses through the /logs page. It also
автор: xuzexin-hzНе уверен что выбрать?
Найди свой стек за 60 секунд
Автор?
Embed-бейдж для README
Похожее
Все в категории ai