Token导航 LogoToken导航

MCP Server · 运维云端

Patronus MCP Server

Patronus MCP Server是一个为Patronus SDK提供的标准化接口,用于运行强大的LLM系统优化、评估和实验。

stdio官方级别未说明来源级核验工具 0
PythonAPI接口云端部署

快速开始

作者 / 组织
patronus-ai
提供方
patronus-ai
运行时
Python

工具数量

0

来源目录标注

资源数量

0

来源目录标注

提示词数量

0

来源目录标注

GitHub Star

15

仓库热度

收录来源

2 个

MCP World

选型结论

Patronus MCP Server 属于运维云端类 MCP Server,公开资料标注 0 个工具,通过stdio 本地进程接入,客户端适配情况以官方文档为准,有可以直接复制的安装命令;接入前要先准备 会话凭据。

分类

运维云端

传输方式

stdio

认证方式

会话凭据

部署方式

公开资料未说明

安装与配置

安装命令

python -m venv .venv

公开命令不是通用的启动方式,拼不出可靠配置示例;请在客户端 MCP 配置里按官方文档填写 command 和 args。

上手步骤

  1. 1

    准备运行环境

    stdio 服务在本地起进程,需要先装好 Python,再按安装命令拉取依赖。

  2. 2

    安装服务

    复制下面的安装命令执行;命令里带占位符的位置换成自己的密钥或路径。

  3. 3

    写入客户端配置

    在客户端的 MCP 配置里填启动命令和参数,保存后完全退出客户端再打开,让新配置生效。

  4. 4

    验证是否可用

    连接成功后客户端会列出 0 个工具,随便调一个只读工具确认能返回结果。

接入前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

详细介绍

Patronus MCP服务器

Patronus SDK的MCP服务器实现,为运行强大的LLM系统优化、评估和实验提供了标准化的接口。

特性

  • 使用API密钥和项目设置初始化Patronus
  • 使用可配置的评估器运行单次评估
  • 使用多个评估者运行批量评估
  • 使用数据集进行实验

安装

  1. 克隆存储库:
git clone https://github.com/yourusername/patronus-mcp-server.git
cd patronus-mcp-server
  1. 创建并激活虚拟环境:
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
  1. 安装主依赖项和开发依赖项:
uv pip install -e .
uv pip install -e ".[dev]"

用法

运行服务器

服务器可以使用API密钥运行,该密钥以两种方式提供:

  1. 命令行参数:
python src/patronus_mcp/server.py --api-key your_api_key_here
  1. 环境变量:
export PATRONUS_API_KEY=your_api_key_here
python src/patronus_mcp/server.py

交互式测试

测试脚本(tests/test_live.py)提供了一种交互式方法来测试不同的评估端点。您可以通过多种方式运行它:

  1. 使用命令行中的API键:
python -m tests.test_live src/patronus_mcp/server.py --api-key your_api_key_here
  1. 使用API密钥在环境中:
export PATRONUS_API_KEY=your_api_key_here
python -m tests.test_live src/patronus_mcp/server.py
  1. 没有API密钥(将提示):
python -m tests.test_live src/patronus_mcp/server.py

测试脚本提供了三个测试选项:

  1. 单项评价试验
  2. 批量评估测试

每个测试都将以格式良好的JSON输出显示结果。

API使用

初始化
from patronus_mcp.server import mcp, Request, InitRequest

request = Request(data=InitRequest(
    project_name="MyProject",
    api_key="your-api-key",
    app="my-app"
))
response = await mcp.call_tool("initialize", {"request": request.model_dump()})
单项评价
from patronus_mcp.server import Request, EvaluationRequest, RemoteEvaluatorConfig

request = Request(data=EvaluationRequest(
    evaluator=RemoteEvaluatorConfig(
        name="lynx",
        criteria="patronus:hallucination",
        explain_strategy="always"
    ),
    task_input="What is the capital of France?",
    task_output="Paris is the capital of France."
    task_context=["The capital of France is Paris."],
))
response = await mcp.call_tool("evaluate", {"request": request.model_dump()})
批量评估
from patronus_mcp.server import Request, BatchEvaluationRequest, RemoteEvaluatorConfig

request = Request(data=BatchEvaluationRequest(
    evaluators=[
        AsyncRemoteEvaluatorConfig(
            name="lynx",
            criteria="patronus:hallucination",
            explain_strategy="always"
        ),
        AsyncRemoteEvaluatorConfig(
            name="judge",
            criteria="patronus:is-concise",
            explain_strategy="always"
        )
    ],
    task_input="What is the capital of France?",
    task_output="Paris is the capital of France."
    task_context=["The capital of France is Paris."],
))
response = await mcp.call_tool("batch_evaluate", {"request": request.model_dump()})
运行实验
from patronus_mcp import Request, ExperimentRequest, RemoteEvaluatorConfig, CustomEvaluatorConfig

# Create a custom evaluator function
@evaluator()
def exact_match(expected: str, actual: str, case_sensitive: bool = False) -> bool:
    if not case_sensitive:
        return expected.lower() == actual.lower()
    return expected == actual

# Create a custom adapter class
class ExactMatchAdapter(FuncEvaluatorAdapter):
    def __init__(self, case_sensitive: bool = False):
        super().__init__(exact_match)
        self.case_sensitive = case_sensitive

    def transform(self, row, task_result, parent, **kwargs):
        args = []
        evaluator_kwargs = {
            "expected": row.gold_answer,
            "actual": task_result.output if task_result else "",
            "case_sensitive": self.case_sensitive
        }
        return args, evaluator_kwargs

# Create experiment request
request = Request(data=ExperimentRequest(
    project_name="my_project",
    experiment_name="my_experiment",
    dataset=[{
        "input": "What is 2+2?",
        "output": "4",
        "gold_answer": "4"
    }],
    evaluators=[
        # Remote evaluator
        RemoteEvaluatorConfig(
            name="judge",
            criteria="patronus:is-concise"
        ),
        # Custom evaluator
        CustomEvaluatorConfig(
            adapter_class="my_module.ExactMatchAdapter",
            adapter_kwargs={"case_sensitive": False}
        )
    ]
))

# Run the experiment
response = await mcp.call_tool("run_experiment", {"request": request.model_dump()})
response_data = json.loads(response[0].text)

# The experiment runs asynchronously, so results will be pending initially
assert response_data["status"] == "success"
assert "results" in response_data
assert isinstance(response_data["results"], str)  # Results will be a string (pending)
列出评估者信息

全面了解所有可用的评估人员及其相关标准:

# No request body needed
response = await mcp.call_tool("list_evaluator_info", {})

# Response structure:
{
    "status": "success",
    "result": {
        "evaluator_family_name": {
            "evaluator": {
                # evaluator configuration and metadata
            },
            "criteria": [
                # list of available criteria for this evaluator
            ]
        }
    }
}

此端点将有关评估者及其相关标准的信息组合成一个有组织的响应。结果按评估器族分组,每个族包含其评估器配置和可用条件列表。

创建标准

在Patronus API中创建一个新的评估者标准。

{
    "request": {
        "data": {
            "name": "my-criteria",
            "evaluator_family": "Judge",
            "config": {
                "pass_criteria": "The MODEL_OUTPUT should contain all the details needed from RETRIEVED CONTEXT to answer USER INPUT.",
                "active_learning_enabled": false,
                "active_learning_negative_samples": null,
                "active_learning_positive_samples": null
            }
        }
    }
}

参数:

  • name (str):条件的唯一名称
  • evaluator_family (str):评估者的家庭(例如,“判断”、“答案相关性”)
  • config (dict):标准的配置

- pass_criteria (str):通过考试必须满足的标准 - active_learning_enabled (bool,可选):是否启用主动学习 - active_learning_negative_samples (int,可选):主动学习的负样本数 - active_learning_positive_samples (int,可选):主动学习的阳性样本数

退货:

{
    "status": "success",
    "result": {
        "name": "my-criteria",
        "evaluator_family": "Judge",
        "config": {
            "pass_criteria": "The MODEL_OUTPUT should contain all the details needed from RETRIEVED CONTEXT to answer USER INPUT.",
            "active_learning_enabled": False,
            "active_learning_negative_samples": null,
            "active_learning_positive_samples": null
        }
    }
}
自定义评估

使用装饰有以下内容的自定义计算器函数来计算任务输出 @evaluator.

{
    "request": {
        "data": {
            "task_input": "What is the capital of France?",
            "task_context": ["The capital of France is Paris."],
            "task_output": "Paris is the capital of France.",
            "evaluator_function": "is_concise",
            "evaluator_args": {
                "threshold": 0.7
            }
        }
    }
}

参数:

  • task_input (str):输入提示
  • task_context (List\[str\],可选):评估的上下文信息
  • task_output (str):要评估的输出
  • evaluator_function (str):要使用的求值器函数的名称(必须用 @evaluator)
  • evaluator_args (Dict\[str,Any\],可选):计算器函数的其他参数

计算器函数可以返回:

  • bool:简单的通过/失败结果
  • int 或 float:数字分数(通过阈值为0.7)
  • str:文本输出
  • EvaluationResult:完整的评估结果,包括分数、通过状态、解释等。

退货:

{
    "status": "success",
    "result": {
        "score": 0.8,
        "pass_": true,
        "text_output": "Good match",
        "explanation": "Output matches context well",
        "metadata": {
            "context_length": 1
        },
        "tags": ["high_score"]
    }
}

评估器函数示例:

from patronus import evaluator, EvaluationResult

@evaluator
def is_concise(output: str) -> bool:
    """Simple evaluator that checks if the output is concise"""
    return len(output.split())  EvaluationResult:
    """Evaluator that returns a score based on context"""
    return EvaluationResult(
        score=0.8,
        pass_=True,
        text_output="Good match",
        explanation="Output matches context well",
        metadata={"context_length": len(context)},
        tags=["high_score"]
    )

发展

项目结构

patronus-mcp-server/
├── src/
│   └── patronus_mcp/
│       ├── __init__.py
│       └── server.py
├── tests/
│   └── test_server.py
    └── test_live.py
├── pyproject.toml
└── README.md

添加新功能

  1. 在中定义新的请求模型 server.py:
   class NewFeatureRequest(BaseModel):
       # Define your request fields here
       field1: str
       field2: Optional[int] = None
  1. 使用以下工具实现新的工具功能 @mcp.tool() 装饰师:
   @mcp.tool()
   def new_feature(request: Request[NewFeatureRequest]):
       # Implement your feature logic here
       return {"status": "success", "result": ...}
  1. 添加相应的测试:

- 在中添加API测试 test_server.py:

     def test_new_feature():
         request = Request(data=NewFeatureRequest(
             field1="test",
             field2=123
         ))
         response = mcp.call_tool("new_feature", {"request": request.model_dump()})
         assert response["status"] == "success"

- 在中添加交互式测试 test_live.py:

     async def test_new_feature(self):
         request = Request(data=NewFeatureRequest(
             field1="test",
             field2=123
         ))
         result = await self.session.call_tool("new_feature", {"request": request.model_dump()})
         await self._handle_response(result, "New feature test")

- 将新测试添加到中的测试选择菜单 main()

  1. 用以下内容更新README:

- “功能”部分中的新功能描述 - API用法部分中的API用法示例 - 任何新的配置选项或要求

运行测试

测试脚本使用模型上下文协议(MCP)客户端与服务器通信。它支持:

  • 交互式测试选择
  • JSON响应格式
  • 适当的资源清理
  • 多个API键输入法

您还可以运行标准测试套件:

pytest tests/

运行服务器

python -m src.patronus_mcp.server

许可证

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

贡献

  1. 分叉存储库
  2. 创建要素分支
  3. 提交您的更改
  4. 推到分支
  5. 创建拉取请求

工具与能力

工具数量

0

资源数量

0

提示词数量

0

能力标签

LLM评估Python本地部署系统优化实验管理API接口

数量来自来源目录的标注,具体工具清单以官方文档为准。

典型使用场景

看服务状态

查询容器、日志和监控指标,定位异常。

执行部署变更

在权限范围内触发发布、回滚和环境切换。

核对资源用量

汇总用量,找出闲置和超额的部分。

选择建议

值得选的地方

  • 只提供 0 个工具,职责集中,接入后不容易误操作。
  • 有现成的安装命令,不用自己找入口,照着跑就能起服务。
  • 公开说明写得比较完整,接入前能看清能力边界。

先想清楚的地方

  • stdio 方式要求本地装好 Python,换机器要重新装一遍。
  • 需要自备会话凭据,没有凭据没法直接试。
  • 第三方目录整理,版本更新和行为细节以官方仓库为准。

更适合

  • 需要在运维云端场景里让模型直接调用外部能力的人。
  • 想先快速试一下、能接受在本地跑服务的人。

不太适合

  • 完全不想在本地装环境的人。
  • 暂时拿不到会话凭据的人。
  • 需要厂商级 SLA 和技术支持的生产环境。

同类对比

5 个同类
MCP Server工具数传输方式安装命令收录来源最后核验
Patronus MCP Server

MCP World · 本页

0stdio有2 个2026-05-17
Ui Tars Desktop 8a825770

MCP World

0stdio有1 个2026-05-17
Elie222 MCP

MCP World

0未说明未标注1 个2026-05-17
Arizeai Phoenix MCP

MCP World

0stdio有3 个2026-05-17
Unity MCP 87ee506e

MCP World

42HTTP有2 个2026-05-17

按同分类和工具数量挑出最接近的几条,字段以各自详情页为准。

常见问题

5 条

Patronus MCP Server 怎么安装?

公开资料给出的安装命令是 python -m venv .venv,运行环境为 Python。装完后按客户端要求写进 MCP 配置,重启客户端生效。

Patronus MCP Server 怎么在 Claude Desktop、Cursor 里配置?

它是stdio 本地进程,客户端配置里要写启动命令和参数,运行环境是 Python;保存后完全退出客户端再打开,配置才会生效。

Patronus MCP Server 收费吗?

本站只整理公开资料,不代收费用,也没有标注具体价格。是否收费取决于服务本身和背后的接口额度,正式使用前按官方说明确认。

Patronus MCP Server 需要 API Key 吗?

公开资料标注的认证方式是会话凭据,也就是要先拿到凭据才能连上;凭据只填在自己本地的配置里,不要写进公开仓库。

Patronus MCP Server 支持哪些客户端?

公开资料没有标注具体客户端;能配置本地 MCP 命令的客户端都能接,配置方式参照官方文档。

来源信息

继续浏览同类 MCP