AI Evaluator MCP Server

AI Evaluator MCP Server

A comprehensive framework for evaluating AI responses using Inspect AI and Petri-style behavioral assessment patterns. Built as an MCP server for real-time evaluation during AI development.

Category
访问服务器

README

AI Evaluator Framework

A comprehensive framework for evaluating AI responses using Inspect AI and Petri-style behavioral assessment patterns. Built as an MCP (Model Context Protocol) server for real-time evaluation during AI development.

Features

  • Hallucination Detection - Catches unfounded claims and fabricated data
  • Tool Consistency - Verifies AI didn't claim tool results without calling tools
  • Context Consistency - Detects contradictions with earlier conversation
  • Confidence Calibration - Flags overconfident claims without evidence
  • Multi-Dimensional Scoring - Petri-style evaluation across 6 dimensions
  • Session Tracking - Compare responses across models, prompts, or sessions
  • Context Accumulation - Automatic context management with smart compaction

Project Structure

eval/
├── src/
│   └── eval_framework/
│       ├── __init__.py           # Package exports
│       ├── cli.py                # Command-line interface
│       │
│       ├── config/               # Configuration
│       │   ├── __init__.py
│       │   └── settings.py       # Settings and environment config
│       │
│       ├── core/                 # Core evaluation logic
│       │   ├── __init__.py
│       │   ├── evaluator.py      # Main ResponseEvaluator class
│       │   ├── judge.py          # Petri-style multi-dimensional judge
│       │   └── scorers.py        # Inspect AI custom scorers
│       │
│       ├── models/               # Data models
│       │   ├── __init__.py
│       │   └── evaluation.py     # Dataclasses for results
│       │
│       ├── server/               # MCP Server
│       │   ├── __init__.py
│       │   ├── app.py            # Server application
│       │   ├── handlers.py       # Tool handlers
│       │   ├── session.py        # Session state management
│       │   └── tools.py          # MCP tool definitions
│       │
│       └── utils/                # Utilities
│           ├── __init__.py
│           ├── context.py        # Context accumulation/compaction
│           ├── helpers.py        # Helper functions
│           └── storage.py        # SQLite persistence
│
├── tests/                        # Test suite
│   ├── __init__.py
│   ├── test_evaluator.py
│   └── test_context.py
│
├── pyproject.toml               # Project configuration
├── setup.py                     # Package setup
├── requirements.txt             # Dependencies
└── README.md                    # This file

Quick Start

1. Install

# Clone the repository
cd eval

# Create virtual environment
python -m venv venv
source venv/bin/activate  # or `venv\Scripts\activate` on Windows

# Install in development mode
pip install -e ".[dev]"

2. Configure

# Create .env file
echo "ANTHROPIC_API_KEY=your-key-here" > .env

3. Run the MCP Server

# Using the CLI
eval-server

# Or directly
python -m eval_framework.server.app

4. Connect from Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "ai-evaluator": {
      "command": "python",
      "args": ["-m", "eval_framework.server.app"],
      "cwd": "/path/to/eval"
    }
  }
}

Usage

MCP Tools Available

Tool Description
evaluate_response Comprehensive evaluation of AI responses
check_hallucinations Quick hallucination detection
verify_tool_consistency Check tool usage matches claims
compare_model_responses Compare multiple model responses
get_session_report Generate session statistics
start_evaluation_session Start a new tracking session
get_context_stats View context accumulation stats
clear_context Clear accumulated context

Example: Evaluate a Response

{
  "tool": "evaluate_response",
  "arguments": {
    "response": "I checked the database and found user #123 has 3 orders.",
    "context": "User asked about order status",
    "tools_available": ["database", "api"],
    "tools_used": []
  }
}

Python API

from eval_framework import ResponseEvaluator, PetriJudge

# Create evaluator
evaluator = ResponseEvaluator()

# Evaluate a response
result = await evaluator.evaluate_comprehensive(
    response="The answer is 42",
    context="What is the meaning of life?",
    tools_available=["calculator"],
    tools_used=["calculator"]
)

print(f"Score: {result['overall_score']}")
print(f"Hallucinations: {result['hallucinations']}")

Evaluation Dimensions

The Petri-style judge evaluates responses across 6 dimensions:

  1. Truthfulness - Are claims verifiable and accurate?
  2. Tool Reliability - Does response match actual tool usage?
  3. Consistency - Aligns with prior context? No contradictions?
  4. Appropriateness - Relevant and on-topic?
  5. Safety - Avoids harmful content?
  6. Calibration - Confidence matches evidence?

Configuration

Environment Variables

# Required
ANTHROPIC_API_KEY=sk-ant-...

# Optional
JUDGE_MODEL=anthropic/claude-sonnet-4-5-20250929
PETRI_JUDGE_MODEL=claude-opus-4-1-20250805
PASS_THRESHOLD=0.7
MAX_HISTORY_ITEMS=20
MAX_CONTEXT_CHARS=15000

Programmatic Configuration

from eval_framework.config import Settings, ContextConfig

settings = Settings(
    context=ContextConfig(
        max_history_items=30,
        max_context_chars=20000,
    )
)

Development

Run Tests

pytest tests/ -v

Code Formatting

black src/ tests/
ruff check src/ tests/

Type Checking

mypy src/

Architecture

┌─────────────────────────────────────────────────────────┐
│                    Your AI Application                   │
└────────────────────┬────────────────────────────────────┘
                     │
                     ▼
┌─────────────────────────────────────────────────────────┐
│              AI Evaluator MCP Server                     │
│                                                          │
│  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐  │
│  │   Inspect AI │  │ Petri Judge  │  │   Context    │  │
│  │  Framework   │  │  (6 dims)    │  │   Manager    │  │
│  └──────────────┘  └──────────────┘  └──────────────┘  │
│                                                          │
│  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐  │
│  │   Scorers    │  │   Storage    │  │   Session    │  │
│  │   (Custom)   │  │   (SQLite)   │  │   State      │  │
│  └──────────────┘  └──────────────┘  └──────────────┘  │
└─────────────────────────────────────────────────────────┘

Built With

License

MIT License - use freely in your development workflow

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选