Skip to main content
Glama
IaC Memory MCP Server
by AgentWong

IaC内存MCP服务器

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

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

概述

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

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

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

  • 组件间全面的关系映射

  • 特定版本的文档管理

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

  • 自动化关系分析和洞察

Related MCP server: Chronos MCP

核心组件

资源管理

该服务器实现了具有分层 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

    B3.4/5.0

    Scored across 23 tools

    Disambiguation4/5

    Most tools have distinct purposes targeting specific IaC components (Ansible vs. Terraform) and operations (add/get/list/update). However, there is some potential overlap between 'create_entity' and the various 'add_' tools, as both involve storing information, though 'create_entity' seems more generic for a knowledge graph. The descriptions help clarify boundaries, but an agent might need to infer when to use 'create_entity' versus the specific 'add_' tools.

    Naming Consistency5/5

    Tool names follow a highly consistent verb_noun pattern throughout, with clear and predictable conventions. All tools use snake_case, and verbs like 'add', 'get', 'list', 'update', 'delete', and 'view' are applied consistently across similar resource types (e.g., 'add_ansible_collection', 'get_ansible_collection_info', 'list_ansible_collections'). This makes the tool set easy to navigate and understand.

    Tool Count3/5

    With 23 tools, the count is on the higher side for an MCP server, bordering on heavy. While the server covers both Ansible and Terraform domains comprehensively, the number of tools might feel overwhelming or lead to redundancy (e.g., separate tools for version history and compatibility checks). A more streamlined set could improve usability without losing functionality, placing it in the borderline range.

    Completeness5/5

    The tool surface provides complete CRUD/lifecycle coverage for both Ansible and Terraform components, including adding, retrieving, listing, updating, and deleting entities. It also handles version management, compatibility checks, and relationship viewing for a knowledge graph. No obvious gaps exist; agents can perform all expected operations for managing IaC metadata and entities without dead ends.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Provides persistent memory capabilities for Claude Code using Neo4j graph database to track development tasks, code patterns, solutions, and their relationships across sessions and projects, enabling contextual assistance and pattern recognition.
      11
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides Claude with a persistent local memory and structured knowledge graph to track project states, tasks, and historical decisions across different chat sessions. It enables users to recall information using keyword relevance, time-travel queries, and dependency analysis for complex project management.
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Provides persistent memory for Claude with hierarchical categorization, cross-corpus recall, session journals, and customizable persona, enabling memory continuity across sessions.
      7
      MIT