Get the FREE Ultimate OpenClaw Setup Guide →

iac-memory -project

This is a personal project to determine whether or not Claude 3.5 Sonnet can write moderately complex MCP Server code (Python).

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio agentwong-iac-memory-mcp-server-project uv --directory /path/to/iac-memory-mcp-server run iac-memory-mcp-server \
  --env DATABASE_URL="sqlite:////home/herman/iac.db"

How to use

The IaC Memory MCP Server provides persistent memory storage and versioned context for Infrastructure-as-Code components across Terraform and Ansible resources. It exposes a set of resource URIs for hierarchical access, supports prompts for discovering resources, analyzing entities and retrieving provider/module information, and offers a collection of tooling to manage providers, resources, collections, and entities. Use the server to maintain versioned documentation, track relationships between IaC components, and gain tailored insights about how resources relate over time. To interact with the server, run it via the MCP tooling (for example through the Claude Desktop integration) and use the four specialized prompts to explore and analyze your IaC landscape: search_resources to discover resources by provider and type; analyze_entity to inspect a given entity and its relationships; terraform_provider to fetch provider details for a specific Terraform provider and version; and ansible_module to retrieve module information from a given Ansible collection.

Once running, you can use the provided tooling to manage Terraform providers and resources (adding providers/resources, listing resources, and updating provider versions) as well as manage Ansible collections and modules (adding collections/modules, listing modules, and checking version compatibility). Entity operations include creating, updating, deleting entities and viewing their relationships. The server also supports template URIs for common data lookups such as provider information and resource definitions, which helps you quickly access standardized access patterns like resources://terraform/providers/{provider_name} and resources://ansible/modules/{collection_name}/{module_name}.

How to install

Prerequisites:

  • Python 3.8+ (for uv-based operation) or a compatible runtime environment as described in the MCP setup guide
  • Access to a database (SQLite recommended for development) and a writable filesystem path for the .env file
  • MCP tooling installed (e.g., the uv/uvx runtime and Claude Desktop integration if you intend to run via Claude)
  • Network access if pulling from remote sources or repositories

Installation steps:

  1. Clone the repository: git clone https://github.com/AgentWong/iac-memory-mcp-server.git cd iac-memory-mcp-server

  2. Create and configure environment variables:

    • DATABASE_URL should point to your SQLite database path or another supported database
    • OPTIONALLY enable MCP_DEBUG or MCP_TEST_MODE for development testing Example: echo "DATABASE_URL=sqlite:////path/to/iac-memory.db" > .env echo "MCP_DEBUG=1" >> .env echo "MCP_TEST_MODE=1" >> .env
  3. Install dependencies (adjust to your runtime toolchain):

    • If using Python/uv, install required packages (adjust per project requirements): python -m pip install -r requirements.txt
    • If using a Node-based workflow or other tooling, follow the project’s preferred setup steps.
  4. Run the MCP server (development approach): uv run iac-memory-mcp-server

    Or via Claude Desktop integration as shown in the integration docs

  5. Verify the server is responding and the MCP prompts are accessible. If needed, start in debug/test mode to validate interactions.

  6. Optional: create a .env file for production-like configuration and wire up your Claude Desktop integration using the production or development setup examples provided in the readme.

Additional notes

Tips and notes:

  • Environment variables: DATABASE_URL is required to locate the database. MCP_DEBUG and MCP_TEST_MODE can help with debugging and test resets during development.
  • URI model: Use resources://<platform>/<category>/<name> to locate resources; examples include Terraform providers, Terraform resources, Ansible collections, and Ansible modules.
  • Prompts: Familiarize yourself with search_resources, analyze_entity, terraform_provider, and ansible_module to perform common discovery and analysis tasks.
  • Integration: The provided integration examples show both development (uv) and production-like (uvx) invocations; pick the one matching your deployment approach.
  • Ownership and maintenance: This project is documented as a personal/experimental setup; consider security and data protection implications when running in production.
  • Troubleshooting: If the MCP server fails to start, check the .env file path, ensure the DATABASE_URL is reachable, and verify that the uv/uvx runtime is correctly installed and accessible in your environment.

Related MCP Servers

Sponsor this space

Reach thousands of developers