home / mcp / iac memory mcp server

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).

Installation
Add the following to your MCP client configuration file.

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.

How to use

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.

How to install

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.

Additional sections

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.

Notes on usage patterns

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.

Available tools

get_terraform_provider_info

Retrieve detailed information about a Terraform provider, including version and resources.

list_provider_resources

List all resources available for a specific Terraform provider.

get_terraform_resource_info

Get detailed information about a Terraform resource type.

add_terraform_provider

Register a new Terraform provider with versioning support.

add_terraform_resource

Add resource definitions with schemas to the server.

update_provider_version

Update provider versions with new documentation and metadata.

get_ansible_collection_info

Retrieve detailed information about an Ansible collection.

list_ansible_collections

List all available Ansible collections.

get_collection_version_history

View version history for an Ansible collection.

get_ansible_module_info

Get detailed information about a specific Ansible module.

list_collection_modules

List all modules within an Ansible collection.

get_module_version_compatibility

Check version compatibility for Ansible modules.

add_ansible_collection

Register a new Ansible collection.

add_ansible_module

Add a new Ansible module with validation and documentation.

create_entity

Create a new infrastructure entity in the memory store.

update_entity

Update an existing infrastructure entity.

delete_entity

Remove an entity and clean up related relationships.

view_relationships

Analyze dependencies and relationships between entities.

IaC Memory MCP Server - agentwong/iac-memory-mcp-server-project