home / mcp / iac memory mcp server
This is a personal project to determine whether or not Claude 3.5 Sonnet can write moderately complex MCP Server code (Python).
Configuration
View docs{
"mcpServers": {
"agentwong-iac-memory-mcp-server-project": {
"command": "uv",
"args": [
"--directory",
"/path/to/iac-memory-mcp-server",
"run",
"iac-memory-mcp-server"
],
"env": {
"MCP_DEBUG": "1",
"DATABASE_URL": "sqlite:////home/herman/iac.db",
"MCP_TEST_MODE": "1"
}
}
}
}This MCP server provides persistent memory storage and version-aware context for IaC components, enabling you to store, relate, and query Terraform and Ansible resources over time. It keeps your IaC assets organized, supports relationship mapping, and offers prompts to discover and analyze resources and providers.
You connect your MCP client to the IaC Memory MCP Server to store and query IaC components. Use the server to create entities for Terraform providers, Terraform resources, Ansible collections, and Ansible modules, then build relationships between them. Access patterns revolve around hierarchical URIs, prompts that search and analyze resources, and tooling that surfaces provider and module details. You can analyze an entity’s name, type, and observed relationships, and you can examine provider versions and resource schemas to keep your context accurate across updates.
Key capabilities you’ll use repeatedly include: creating and updating IaC entities, viewing and analyzing relationships, and querying detailed information about Terraform providers and Ansible modules. Use the search and analyze prompts to discover resources, and use the provider/module queries to retrieve up-to-date details for planning changes or reviews. When you start a session, the server’s URI-based resource access helps you locate resources such as Terraform providers, Terraform resources, Ansible collections, and Ansible modules.
Prerequisites: you need a runtime capable of running the MCP server and a way to store persistent state. You will also use a local or remote MCP runtime to start the server.
Install the Ultraviolet runtime that powers MCP servers. This example shows both development and production start flows.
# Development flow uses the Ultraviolet runtime
# Install Ultraviolet tooling (example global install)
npm install -g uv
# Start the server in development mode (directory points to your server code)
uv --directory /path/to/iac-memory-mcp-server run iac-memory-mcp-server
```} ,{# Production flow uses the Ultraviolet runtime for a production build
# Install Ultraviolet tooling (example global install)
npm install -g uvx
# Start the server from a Git-backed source or local build
uvx --from git+https://github.com/AgentWong/iac-memory-mcp-server.git python -m iac_memory_mcp_server
```}]} ,{Prepare configuration by setting environment variables for the database and debug/test modes. Create a .env file or export variables in your shell before starting the server.
DATABASE_URL=sqlite:////path/to/db.sqlite
MCP_DEBUG=1
MCP_TEST_MODE=1
export DATABASE_URL MCP_DEBUG MCP_TEST_MODE
````}]} ,{When starting, ensure the environment variables are visible to the process. The server uses DATABASE_URL to locate the storage and optional MCP_DEBUG/MCP_TEST_MODE flags to control logging and test resets.
Configuration details and runtime notes are provided through explicit code blocks in the setup examples. Use the development setup for local testing and the production setup for deployment. Both flows include the DATABASE_URL variable in their environment block.
Security considerations include keeping the database URL private and restricting access to the MCP server to trusted clients. Regularly rotate credentials and monitor debug logs if MCP_DEBUG is enabled.
Troubleshooting tips: verify that the correct runtime (uv or uvx) is installed, confirm that the server directory path is correct, and ensure the DATABASE_URL points to a valid SQLite database file with the right permissions. If the server fails to start, check for conflicting processes using the same port or path and review the environment variables for typos.
You will primarily create and manage entities representing IaC components and then explore their relationships and version histories. Use the provided prompts to locate resources, retrieve provider information, and inspect module details for Terraform and Ansible. The server’s URI-based access makes it straightforward to organize resources under Terraform providers, Terraform resources, Ansible collections, and Ansible modules.
Retrieve detailed information about a Terraform provider, including version and resources.
List all resources available for a specific Terraform provider.
Get detailed information about a Terraform resource type.
Register a new Terraform provider with versioning support.
Add resource definitions with schemas to the server.
Update provider versions with new documentation and metadata.
Retrieve detailed information about an Ansible collection.
List all available Ansible collections.
View version history for an Ansible collection.
Get detailed information about a specific Ansible module.
List all modules within an Ansible collection.
Check version compatibility for Ansible modules.
Register a new Ansible collection.
Add a new Ansible module with validation and documentation.
Create a new infrastructure entity in the memory store.
Update an existing infrastructure entity.
Remove an entity and clean up related relationships.
Analyze dependencies and relationships between entities.