Skip to main content
Glama
@pulumi/mcp-server

@pulumi/mcp-server

Official
by pulumi

Pulumi MCP 服务器

**注意:**此 MCP 服务器目前正在积极开发中。其 API(包括可用命令及其参数)尚处于实验阶段,可能会引入重大变更,恕不另行通知。如果您遇到错误或需要其他 Pulumi 命令的支持,请在GitHub上提交问题。

实现模型上下文协议(MCP) 的服务器,用于使用 Pulumi 自动化 API 和 Pulumi 云 API 与 Pulumi CLI 进行交互。

该软件包允许 MCP 客户端执行 Pulumi 操作,例如检索包信息、预览更改、部署更新和以编程方式检索堆栈输出,而无需在客户端环境中直接安装 Pulumi CLI。

用法

您的机器上必须安装 Pulumi CLI。

此软件包主要用于集成到可以使用 MCP 服务器作为 AI 工具的应用程序中。例如,以下是如何将 Pulumi MCP 服务器添加到 Claude 桌面的 MCP 配置文件中:

{
  "mcpServers": {
    "pulumi": {
      "command": "npx",
      "args": ["@pulumi/mcp-server@latest","stdio"]
    }
  }
}

或者,如果您更喜欢使用带有服务器发送事件(SSE)而不是stdio的 HTTP :

{
  "mcpServers": {
    "pulumi": {
      "command": "npx",
      "args": ["@pulumi/mcp-server@latest","sse"]
    }
  }
}

Related MCP server: mcp-perplexity

Docker容器

您还可以将 Pulumi MCP 服务器作为 Docker 容器运行。这种方法无需直接在主机上安装 Node.js 及其依赖包。

构建容器

构建容器:

docker build -t pulumi/mcp-server:latest .

与 MCP 客户端一起使用

要将容器化服务器与 MCP 客户端一起使用,您需要将客户端配置为使用 Docker 容器。例如,在 Claude 桌面的 MCP 配置中:

{
  "mcpServers": {
    "pulumi": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "pulumi/mcp-server:latest", "stdio"]
    }
  }
}

通过 HTTP (SSE) 与 MCP 客户端一起使用

要通过 HTTP (SSE) 将容器化服务器与 MCP 客户端一起使用,可以使用以下命令运行容器:

{
  "mcpServers": {
    "pulumi": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "-p", "3000:3000", "pulumi/mcp-server:latest", "sse"]
    }
  }
}

对于需要访问本地 Pulumi 项目的 Pulumi 操作,您需要挂载相应的目录。例如,如果您的 Pulumi 项目位于~/projects/my-pulumi-app中:

{
  "mcpServers": {
    "pulumi": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "-v", "~/projects/my-pulumi-app:/app/project", "pulumi/mcp-server:latest"]
    }
  }
}

然后,当使用 MCP 工具时,您将在请求中将项目目录引用为/app/project 。

可用命令

服务器公开以下 Pulumi 操作的处理程序,可通过 MCP 请求调用:

  • preview :在指定的堆栈上运行pulumi preview 。

    • workDir (字符串,必需):包含Pulumi.yaml项目文件的工作目录。

    • stackName (字符串,可选):要操作的堆栈名称(默认为“dev”)。

  • up :运行pulumi up来部署指定堆栈的更改。

    • workDir (字符串,必需):包含Pulumi.yaml项目文件的工作目录。

    • stackName (字符串,可选):要操作的堆栈名称(默认为“dev”)。

  • stack-output :成功部署后从指定堆栈检索输出。

    • workDir (字符串,必需):包含Pulumi.yaml项目文件的工作目录。

    • stackName (字符串,可选):要从中检索输出的堆栈名称(默认为“dev”)。

    • outputName (字符串,可选):要检索的特定堆栈输出名称。如果省略,则返回堆栈的所有输出。

  • get-resource :返回有关特定 Pulumi Registry 资源的信息,包括其输入和输出。

    • provider (字符串,必需):Git 托管组件的云提供商(例如“aws”、“azure”、“gcp”、“random”)或github.com/org/repo 。

    • module (字符串,可选):要查询的模块(例如,“s3”,“ec2”,“lambda”)。

    • resource (字符串,必需):资源类型名称(例如,“Bucket”,“Function”,“Instance”)。

  • list-resources :列出 Pulumi 提供程序包中的可用资源,可选择按模块进行过滤。

    • provider (字符串,必需):Git 托管组件的云提供商(例如“aws”、“azure”、“gcp”、“random”)或github.com/org/repo 。

    • module (字符串,可选):要过滤的模块(例如,“s3”,“ec2”,“lambda”)。

发展

  1. 克隆存储库。

  2. 安装依赖项: make ensure

  3. 构建项目: make build

  4. 测试项目: make test

执照

本项目遵循 Apache-2.0 许可证。详情请参阅许可证文件。

Available Tools

5 tools
pulumi-cli-previewC

Run pulumi preview for a given project and stack

Inputs: workDir (required), stackName.

pulumi-cli-stack-outputC

Get the output value(s) of a given stack

Inputs: workDir (required), outputName, stackName.

pulumi-cli-upC

Run pulumi up for a given project and stack

Inputs: workDir (required), stackName.

pulumi-registry-get-resourceB

Get information about a specific resource from the Pulumi Registry

Inputs: provider (required), resource (required), module.

pulumi-registry-list-resourcesB

List all resource types for a given provider and module

Inputs: provider (required), module.

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 5 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose with no ambiguity: pulumi-cli-preview, pulumi-cli-up, and pulumi-cli-stack-output handle different CLI operations for project/stack management, while pulumi-registry-get-resource and pulumi-registry-list-resources focus on distinct registry lookup tasks. The descriptions reinforce these boundaries, making misselection unlikely.

    Naming Consistency5/5

    All tool names follow a consistent pattern: they start with 'pulumi-' followed by a hyphen-separated domain (cli or registry) and a specific action (e.g., preview, up, get-resource). This predictable structure enhances readability and agent usability without any deviations or mixed conventions.

    Tool Count4/5

    With 5 tools, the count is reasonable and well-scoped for a Pulumi MCP server, covering core CLI operations and registry lookups. It's slightly lean but not insufficient, as each tool earns its place; minor additions like stack management or config tools could enhance it, but it's not a significant gap.

    Completeness4/5

    The tool set covers key Pulumi workflows: preview, up, and stack outputs for deployment, plus registry resource lookups. Minor gaps exist, such as missing tools for stack management (e.g., create/delete) or config operations, but agents can likely work around these with the provided tools for basic infrastructure-as-code tasks.

    Related MCP Connectors

    Related MCP Servers