Nox模型上下文协议服务器

一个允许AI助手运行nox会话的MCP服务器,用于发现和执行项目的测试、lint、构建等自动化任务。

  • by rvforest
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 rvforest/nox-mcp

使用说明

氮氧化物mcp

A. 模型上下文协议(MCP) 使AI助手能够运行的服务器 夜 会议。这允许LLM发现并执行项目的测试、lint、构建和其他自动化任务。

特性

  • 发现会话 --列出所有可用的nox会话及其描述和Python版本
  • 运行会话 --按名称、标签或关键字表达式执行会话
  • 按Python版本筛选 --覆盖任何会话的默认Python版本
  • 结构化输出 --返回JSON响应,以便人工智能工具轻松解析

安装

需要Python 3.10+和 夜 安装在您的PATH中。

pip install nox-mcp

或与 紫外线:

uv pip install nox-mcp

快速开始

配置您的MCP客户端

将nox-mcp添加到mcp客户端配置中。例如,在Claude Desktop的 claude_desktop_config.json:

{
  "mcpServers": {
    "nox": {
      "command": "nox-mcp"
    }
  }
}

或者如果使用uvx:

{
  "mcpServers": {
    "nox": {
      "command": "uvx",
      "args": ["nox-mcp"]
    }
  }
}

可用工具

配置后,您的AI助手可以使用这些工具:

nox_list_sessions

列出当前项目中所有可用的nox会话。

Returns: List of session objects with name, python version, and description

nox_run_session

运行一个或多个nox会话。

参数 类型 说明
sessions list[str] 要运行的会话名称(例如。, ["tests", "lint"])
tags list[str] 按标签筛选会话
keywords str 关键字表达式(例如。, "test and not slow")
python str Python版本覆盖(例如。, "3.12")
timeout int 最长等待秒数(默认值:300)

工作流示例

  1. 问你的AI助手: “有哪些nox会话可用?”
  2. 助理打来电话 nox_list_sessions 并向您显示选项
  3. 问: “使用Python 3.12运行测试”
  4. 助理打来电话 nox_run_session(sessions=["tests"], python="3.12")

需求

  • Python 3.10+
  • 夜 已安装并在PATH中可用
  • MCP兼容客户端(Claude Desktop等)

发展

# Clone the repository
git clone https://github.com/rvforest/nox-mcp.git
cd nox-mcp

# Install dependencies
uv sync

# Run tests
uv run nox -s test

# Run all checks
uv run nox -s check

许可证

MIT许可证——见 许可证 了解详情。