OpenStack MCP服务器

OpenStack MCP服务器是一个基于模型上下文协议(MCP)的接口服务,使AI助手能够与OpenStack云服务进行交互,支持计算、存储、网络等资源管理。

  • by openstack-kr
  • Python
  • 本地部署
  • 19 星标
  • 更新于
在 GitHub 查看 openstack-kr/python-openstackmcp-server

使用说明

python openstackmcp服务器

Openstack mcp服务器是一个 模型上下文协议(MCP) 服务器,为AI助手提供与OpenStack服务交互的接口。

flowchart LR
    AI[AI Assistant] <-->|MCP Protocol| Server[OpenStack MCP Server]
    Server <-->|OpenStack SDK| SDK[OpenStack SDK]
    SDK <-->|REST API| Cloud[OpenStack Cloud]

目录

特性

  • MCP协议支持:为AI助手实现模型上下文协议。
  • 计算工具:管理OpenStack计算资源(服务器、版本)。
  • 图像工具:管理OpenStack映像。
  • 身份工具:处理OpenStack身份和身份验证。
  • 网络工具:管理OpenStack网络资源。
  • 块存储工具:管理OpenStack块存储资源。

Claude Desktop快速入门

使用Claude Desktop快速开始使用OpenStack MCP服务器

需求

  • Python 3.10或更高版本
  • 在中配置的OpenStack凭据 clouds.yaml 文件
  • 已安装Claude Desktop
  1. 创建或更新您的 clouds.yaml 使用您的OpenStack凭据创建文件。

    示例 clouds.yaml:

    clouds:
      openstack:
        auth:
          auth_url: https://your-openstack-auth-url.com
          username: your-username
          password: your-password
          project_name: your-project-name
          user_domain_name: Default
          project_domain_name: Default
        region_name: your-region
        interface: public
        identity_api_version: 3
    
  2. 创建或更新您的Claude Desktop配置文件:

    • macOS:编辑 $HOME/Library/Application Support/Claude/claude_desktop_config.json
    • 视窗:编辑 %APPDATA%\Claude\claude_desktop_config.json
    • Linux:编辑 $HOME/.config/Claude/claude_desktop_config.json

使用python

{
  "mcpServers": {
    "openstack-mcp-server": {
      "command": "/path/to/your/python",
      "args": [
        "python-openstackmcp-server"
      ],
      "env" : {
        "OS_CLIENT_CONFIG_FILE": "/path/to/your/clouds.yaml"
      }
    }
  }
}

使用uvx

{
  "mcpServers": {
    "openstack-mcp-server": {
      "command": "uvx",
      "args": [
        "python-openstackmcp-server"
      ],
      "env" : {
        "OS_CLIENT_CONFIG_FILE": "/path/to/your/clouds.yaml"
      }
    }
  }
}

发展

设置

该项目同时支持 uv 和 tox 用于开发和测试。

使用uv(快速本地开发)

# Install dependencies (including dev and test groups)
uv sync

# Run tests
uv run --group test pytest

# Run linting
uv run ruff check src tests

# Format code
uv run ruff format src tests

使用tox(OpenStack标准)

# Install tox
pip install tox
# or
uv tool install tox

# Run tests
tox -e py3

# Run linting
tox -e pep8

# Auto-format code
tox -e format

# Generate coverage report
tox -e cover

# Run arbitrary commands in virtualenv
tox -e venv -- <command>

# Test on specific Python version
tox -e py310  # or py311, py312, py313

# List all available environments
tox list

测试

该项目包括全面的测试覆盖率(85%+)。测试位于 tests/ 目录。

# Run all tests
tox -e py3

# Run with coverage
tox -e cover

# Run with debugger
tox -e debug

# Run specific test file
tox -e py3 -- tests/tools/test_compute_tools.py

贡献

欢迎投稿!请查看 贡献 有关如何为此项目做出贡献的详细信息,请参阅文件。

许可证

此项目根据Apache许可证2.0获得许可。看 许可证 文件以获取详细信息。