Skip to main content
Glama
IAC Memory MCP Server

IAC Memory MCP Server

by AgentWong

IaC内存MCP服务器

模型上下文协议 (MCP) 服务器通过为基础设施即代码 (IaC) 组件提供持久内存存储来增强 Claude AI 的功能,重点关注 Terraform 和 Ansible 资源的版本跟踪和关系映射。

[!笔记]
这是一个个人项目,旨在确定在使用者(我)缺乏专业知识(例如缺乏 Python 知识)的情况下,AI 的能力状态。由于成本过高,我不打算继续开发或维护这个项目。

概述

IaC 内存 MCP 服务器通过提供以下功能解决了维护 IaC 组件的准确、版本感知上下文的挑战:

  • IaC 组件的持久存储和版本跟踪

  • 基于 URI 访问的分层资源组织

  • 组件间全面的关系映射

  • 特定版本的文档管理

  • 模式验证和时间元数据跟踪

  • 自动化关系分析和洞察

Related MCP server: drupal-modules-mcp MCP Server

核心组件

资源管理

该服务器实现了具有分层 URI 的复杂资源管理系统:

资源 URI 结构

resources://<platform>/<category>/<name>

支持的平台:

  • 地形改造

  • ansible

  • iac(针对一般基础设施实体)

示例 URI:

resources://terraform/providers/aws
resources://terraform/resources/aws/s3_bucket
resources://ansible/collections/community.aws
resources://ansible/modules/community.aws/s3_bucket

资源模板

服务器提供标准化访问模式的动态资源模板:

  • Terraform 提供商信息: resources://terraform/providers/{provider_name}

  • 资源类型详细信息: resources://terraform/resources/{provider_name}/{resource_type}

  • Ansible 收集数据: resources://ansible/collections/{collection_name}

  • 模块信息: resources://ansible/modules/{collection_name}/{module_name}

提示

服务器针对 IaC 组件发现和分析实现了四个专门的提示:

搜索资源

  • 目的:搜索 IaC 资源

  • 参数:

    • provider :提供者名称

    • resource_type :资源类型

  • 返回:有关给定提供者的特定资源的信息

分析实体

  • 目的:分析实体及其关系

  • 参数:

    • entity_id :实体ID

    • include_relationships :包含关系

  • 返回:详细的实体分析,包括名称、类型和观察结果

terraform_provider

  • 目的:获取有关 Terraform 提供商的信息

  • 参数:

    • provider_name :Terraform 提供商的名称(必需)

    • version :要查询的特定版本(可选)

  • 返回:指定版本的详细提供商信息

ansible_模块

  • 目的:获取有关 Ansible 模块的信息

  • 参数:

    • collection_name :Ansible 集合的名称(必需)

    • module_name :模块名称(必需)

    • version :要查询的特定版本(可选)

  • 返回:指定版本的详细模块信息

工具

该服务器实现了用于 IaC 组件管理的综合工具:

Terraform 工具

  • get_terraform_provider_info :检索详细的提供商信息,包括版本和资源

  • list_provider_resources :列出特定提供商可用的所有资源

  • get_terraform_resource_info :获取有关特定资源类型的详细信息

  • add_terraform_provider :注册具有版本控制的新提供程序

  • add_terraform_resource :添加带有模式的资源定义

  • update_provider_version :使用新文档更新提供程序版本

Ansible 工具

  • get_ansible_collection_info :获取有关 Ansible 集合的详细信息

  • list_ansible_collections :列出所有可用的 Ansible 集合

  • get_collection_version_history :查看集合的版本历史记录

  • get_ansible_module_info :获取有关特定模块的详细信息

  • list_collection_modules :列出集合中的所有模块

  • get_module_version_compatibility :检查模块的版本兼容性

  • add_ansible_collection :注册新的 Ansible 集合

  • add_ansible_module :添加带有验证和文档的新模块

实体操作

  • create_entity :创建新的基础设施实体

  • update_entity :修改现有实体配置

  • delete_entity :删除具有关系清理的实体

  • view_relationships :分析实体依赖关系

配置

服务器支持通过环境变量进行配置:

  • DATABASE_URL :SQLite 数据库位置

  • MCP_DEBUG :设置后启用调试日志记录

  • MCP_TEST_MODE :启用数据库重置测试模式

为了开发,创建一个.env文件:

DATABASE_URL=sqlite:////path/to/db.sqlite
MCP_DEBUG=1
MCP_TEST_MODE=1

与 Claude Desktop 集成

开发设置

"mcpServers": {
  "iac-memory": {
    "command": "uv",
    "args": [
      "--directory",
      "/path/to/iac-memory-mcp-server",
      "run",
      "iac-memory-mcp-server"
    ]
    "env": {
          "DATABASE_URL": "sqlite:////home/herman/iac.db"
      }
  }
}

生产设置

"mcpServers": {
  "iac-memory": {
    "command": "uvx",
    "args": [
        "--from",
        "git+https://github.com/AgentWong/iac-memory-mcp-server.git",
        "python",
        "-m",
        "iac_memory_mcp_server"
    ],
    "env": {
          "DATABASE_URL": "sqlite:////home/herman/iac.db"
      }
  }
}

发展

本地开发

# Install dependencies
uv sync

# Run tests
uv run pytest

# Development server with MCP Inspector
npx @modelcontextprotocol/inspector uv run iac-memory-mcp-server

执照

该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅 LICENSE 文件。

Available Tools

23 tools
add_ansible_collectionB

Add a new Ansible collection to the memory store with version and documentation information

Inputs: name (required), version (required), source_url (required), doc_url (required).

add_ansible_moduleC

Add a new Ansible module definition with its schema and version information

Inputs: collection (required), name (required), module_type (required), schema (required), +2 more.

add_terraform_providerB

Add a new Terraform provider to the memory store with version and documentation information

Inputs: name (required), version (required), source_url (required), doc_url (required).

add_terraform_resourceC

Add a new Terraform resource definition with its schema and version information

Inputs: name (required), resource_type (required), schema (required), version (required), +2 more.

create_entityC

Create a new entity in the knowledge graph with optional initial observations

Inputs: name (required), type (required), observation.

delete_entityC

Remove an entity and its relationships from the knowledge graph

Inputs: id (required).

get_ansible_collection_infoC

Retrieve comprehensive information about an Ansible collection

Inputs: collection_name (required).

get_ansible_module_infoC

Retrieve comprehensive information about an Ansible module including schema and documentation

Inputs: collection_name (required), module_name (required).

get_collection_version_historyA

Retrieve version history for a specific Ansible collection

Inputs: collection_name (required).

get_module_version_compatibilityC

Check module compatibility across collection versions

Inputs: collection_name (required), module_name (required), version (required).

get_provider_version_historyB

Retrieve version history for a specific Terraform provider

Inputs: provider_name (required).

get_resource_version_compatibilityC

Check resource compatibility across provider versions

Inputs: provider_name (required), resource_name (required), version (required).

get_terraform_provider_infoC

Retrieve comprehensive information about a Terraform provider

Inputs: provider_name (required).

get_terraform_resource_infoC

Retrieve comprehensive information about a Terraform resource including schema and documentation

Inputs: provider_name (required), resource_name (required).

list_ansible_collectionsC

List all cached Ansible collections with basic metadata

Inputs: filter_criteria.

list_provider_resourcesC

List all resources associated with a specific Terraform provider

Inputs: provider_name (required), filter_criteria.

list_terraform_providersB

List all cached Terraform providers with basic metadata

Inputs: filter_criteria.

update_collection_versionC

Update an existing Ansible collection's version information and documentation links

Inputs: collection_id (required), new_version (required), new_source_url, new_doc_url.

update_entityC

Update an existing entity's properties and add new observations

Inputs: id (required), name, type, observation.

update_module_versionC

Update an existing Ansible module's schema and related information

Inputs: module_id (required), new_schema (required), new_version, new_doc_url.

update_provider_versionC

Update an existing Terraform provider's version information and documentation links

Inputs: provider_name (required), new_version (required), new_source_url, new_doc_url.

update_resource_schemaC

Update an existing Terraform resource's schema and related information

Inputs: resource_id (required), new_schema (required), new_version, new_doc_url.

view_relationshipsC

Retrieve all relationships and observations for a specific entity

Inputs: entity_id (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 23 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose with no ambiguity. The tools are organized into well-defined categories: Ansible collections/modules, Terraform providers/resources, and knowledge graph entities. Even tools with similar verbs like 'add_' and 'update_' target different resources, making misselection unlikely.

    Naming Consistency5/5

    Tool names follow a highly consistent verb_noun pattern throughout. All tools use snake_case with clear prefixes (add_, get_, list_, update_, delete_, view_) followed by specific resource names. This predictable naming convention makes the tool set easy to navigate and understand.

    Tool Count4/5

    With 23 tools, the count is slightly high but reasonable given the server's scope covering both Ansible and Terraform infrastructure-as-code components plus a knowledge graph. Each tool appears to serve a specific purpose, though the number might feel heavy compared to more focused servers.

    Completeness5/5

    The tool surface provides complete CRUD/lifecycle coverage for both Ansible and Terraform domains, plus comprehensive entity management for the knowledge graph. There are no obvious gaps - tools cover addition, retrieval, listing, updating, deletion, version history, compatibility checking, and relationship viewing for all resource types.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      An MCP server for managing and persisting notes, offering CRUD operations, note summarization, and resource-based access via a note:// URI scheme.
      4
      7
      MIT
    • F
      license
      Not graded
      quality
      C
      maintenance
      A note management MCP server that enables users to store, retrieve, and summarize personal notes via a custom URI scheme. It provides tools for adding content and prompts for generating brief or detailed summaries of stored information.
      -