Back to MCP directory
publicPublicdnsLocal runtime

docker-container-mcp

一个基于Docker的MCP服务器,用于创建和管理容器。

article

README

🚀 Docker 容器 MCP 服务器 🛠️

这是一个用于创建 Docker 容器的 MCP(模型上下文协议)服务器,可借助特定镜像创建容器并获取其状态。

✨ 主要特性

  • 能够使用特定镜像创建 Docker 容器。
  • 可以获取容器的状态。

📦 安装指南

原文档未提供安装步骤,此章节跳过。

💻 使用示例

基础用法

创建容器

使用 create_container 工具创建 Docker 容器:

# 假设存在一个函数接口用于创建容器
# 这里仅为示意,实际代码需根据具体实现
def create_container(image):
    # 具体创建容器的逻辑
    pass

# 使用指定镜像创建容器
image = "your_image_name"
create_container(image)

检查容器状态

通过以下命令检查容器状态:

docker container inspect <container_id>

输出示例:

[
  {
    "Id": "container_id",
    "Name": "container_name",
    "State": {
      "Running": true,
      "Paused": false,
      "Stopped": false,
      "ExitCode": 0,
      "StartedAt": "2023-10-01T00:00:00.000Z",
      "FinishedAt": "0001-01-01T00:00:00.000Z"
    },
    "Mounts": [],
    "NetworkSettings": {
      "Ports": {},
      "IPAddress": "container_ip_address",
      "Gateway": "network_gateway",
      "DNS": ["dns_server"]
    }
  }
]

说明:通过容器 ID 可以获取其详细状态信息,包括运行状态、启动时间、网络设置等。

📚 详细文档

工具 📌

create_container

目的:使用指定镜像创建 Docker 容器。

参数

  • image:指定用于创建容器的镜像。

资源 📌

容器状态

  • 检查容器的状态。
    • 命令docker container inspect <container_id>
    • 输出示例
      [
        {
          "Id": "container_id",
          "Name": "container_name",
          "State": {
            "Running": true,
            "Paused": false,
            "Stopped": false,
            "ExitCode": 0,
            "StartedAt": "2023-10-01T00:00:00.000Z",
            "FinishedAt": "0001-01-01T00:00:00.000Z"
          },
          "Mounts": [],
          "NetworkSettings": {
            "Ports": {},
            "IPAddress": "container_ip_address",
            "Gateway": "network_gateway",
            "DNS": ["dns_server"]
          }
        }
      ]
      
    • 说明:通过容器 ID 可以获取其详细状态信息,包括运行状态、启动时间、网络设置等。

🔧 技术细节

原文档未提供技术实现细节,此章节跳过。

📄 许可证

原文档未提供许可证信息,此章节跳过。

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client