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]目录
- 需求 - 使用python - 使用uvx - 贡献 - 许可证
特性
- MCP协议支持:为AI助手实现模型上下文协议。
- 计算工具:管理OpenStack计算资源(服务器、版本)。
- 图像工具:管理OpenStack映像。
- 身份工具:处理OpenStack身份和身份验证。
- 网络工具:管理OpenStack网络资源。
- 块存储工具:管理OpenStack块存储资源。
Claude Desktop快速入门
使用Claude Desktop快速开始使用OpenStack MCP服务器
需求
- Python 3.10或更高版本
- 在中配置的OpenStack凭据
clouds.yaml文件 - 已安装Claude Desktop
- 创建或更新您的
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- 创建或更新您的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 --
# 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获得许可。看 许可证 文件以获取详细信息。
