Token导航 LogoToken导航

MCP Server · 运维云端

MCP Agent Attestation

为模型上下文协议(MCP)代理提供加密身份验证功能,确保服务器能够验证连接AI代理的身份和来源。

stdio官方级别未说明来源级核验工具 0
安全PythonClaude

快速开始

作者 / 组织
JAVillarino
提供方
JAVillarino

工具数量

0

来源目录标注

资源数量

0

来源目录标注

提示词数量

0

来源目录标注

GitHub Star

1

仓库热度

收录来源

1 个

MCP World

选型结论

MCP Agent Attestation 属于运维云端类 MCP Server,公开资料标注 0 个工具,通过stdio 本地进程接入,适配 Claude,有可以直接复制的安装命令;接入前要先准备 OAuth 授权。

分类

运维云端

传输方式

stdio

认证方式

OAuth 授权

部署方式

公开资料未说明

安装与配置

安装命令

pip install -e ".[all]"

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

上手步骤

  1. 1

    准备运行环境

    stdio 服务在本地起进程,需要先装好 对应的运行时,再按安装命令拉取依赖。

  2. 2

    安装服务

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

  3. 3

    写入客户端配置

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

  4. 4

    验证是否可用

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

接入前确认

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

详细介绍

MCP代理认证

模型上下文协议代理的加密身份验证

概述

此项目为实现加密证明扩展 模型上下文协议(MCP) 这使得服务器能够验证连接的AI代理的身份和来源。

问题:MCP处理用户授权(OAuth 2.1),但缺少代理身份验证。服务器无法验证正在连接的模型、部署它的人,或者它的来源链是否完整。

解决方案:基于JWT的认证令牌,带有Ed25519签名,使用MCP与代理一起旅行 experimental 非中断协议扩展的能力字段。

特性

  • 🔐 Ed25519签名:快速、安全的加密验证
  • 🎫 基于JWT的代币:具有SPIFFE兼容标识符的标准格式
  • 🔄 重播保护:基于JTI的缓存阻止令牌重用
  • 🏢 企业就绪:SPIFFE ID格式,JWKS密钥分发
  • 🛡️ 策略强制:必需/首选/可选认证模式
  • 🧪 攻击模拟:演示套件证明了针对常见攻击的安全性

快速开始

安装

# Clone the repository
git clone https://github.com/joelv/mcp-agent-attestation.git
cd mcp-agent-attestation

# Create virtual environment with uv (recommended)
uv venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Install with all dependencies
uv pip install -e ".[all]"

# Or with pip
pip install -e ".[all]"

运行演示

# Core attestation demo
python -m attestation.core

# Attack simulation suite
python -m attestation.attacks

# Protocol extension demo
python -m attestation.protocol

项目结构

mcp-agent-attestation/
├── SPEC.md                    # Technical specification
├── README.md                  # This file
├── pyproject.toml             # Project configuration
├── src/
│   └── attestation/
│       ├── __init__.py        # Package exports
│       ├── core.py            # Core attestation primitives
│       ├── protocol.py        # MCP protocol extension
│       ├── attacks.py         # Attack simulations
│       ├── jwks.py            # JWKS HTTP fetcher
│       ├── cache.py           # Redis/in-memory replay cache
│       ├── mcp_client.py      # MCP SDK client integration
│       └── mcp_server.py      # MCP SDK server integration
└── tests/
    └── ...

用法

创建认证令牌(代理/客户端)

from attestation import (
    AttestationProvider,
    AgentIdentity,
    KeyPair,
)

# In production, Anthropic would run this
keypair = KeyPair.generate("anthropic-2025-01")
provider = AttestationProvider(
    issuer="https://api.anthropic.com",
    keypair=keypair,
)

# Create identity for the agent
identity = AgentIdentity(
    model_family="claude-4",
    model_version="claude-sonnet-4-20250514",
    provider="anthropic",
)

# Generate token for a specific server
token = provider.create_token(
    identity=identity,
    audience="https://mcp-server.example.com",
)

验证证明(服务器端)

from attestation import (
    AttestationVerifier,
    InMemoryKeyResolver,
    VerificationPolicy,
)

# Setup key resolver (would fetch from JWKS in production)
key_resolver = InMemoryKeyResolver()
key_resolver.add_keypair("https://api.anthropic.com", keypair)

# Create verifier
verifier = AttestationVerifier(
    trusted_issuers=["https://api.anthropic.com"],
    key_resolver=key_resolver,
    policy=VerificationPolicy.REQUIRED,
)

# Verify incoming token
result = await verifier.verify(token)

if result.verified:
    print(f"Verified agent: {result.subject}")
    print(f"Trust level: {result.trust_level}")
else:
    print(f"Verification failed: {result.error}")

MCP SDK集成

该库提供与MCP Python SDK的直接集成:

客户端:验证ClientSession
from mcp.client.stdio import stdio_client
from attestation import AttestationProvider, AgentIdentity, KeyPair
from attestation.mcp_client import AttestingClientSession

# Setup attestation
keypair = KeyPair.generate("my-key")
provider = AttestationProvider(issuer="https://api.anthropic.com", keypair=keypair)
identity = AgentIdentity(model_family="claude-4", model_version="claude-sonnet-4", provider="anthropic")

# Connect with attestation
async with stdio_client(server_params) as (read, write):
    session = AttestingClientSession(
        read_stream=read,
        write_stream=write,
        attestation_provider=provider,
        agent_identity=identity,
        target_audience="https://my-mcp-server.com",
    )
    result = await session.initialize()  # Token injected automatically

    # Check attestation was verified
    if session.attestation_verified:
        print(f"Verified with trust level: {session.attestation_status['trust_level']}")
服务器端:认证服务器
from mcp.server.lowlevel.server import Server
from attestation import AttestationVerifier, InMemoryKeyResolver, VerificationPolicy
from attestation.mcp_server import AttestingServer, create_attesting_server

# Setup verifier
key_resolver = InMemoryKeyResolver()
key_resolver.add_keypair("https://api.anthropic.com", trusted_keypair)
verifier = AttestationVerifier(
    trusted_issuers=["https://api.anthropic.com"],
    key_resolver=key_resolver,
    policy=VerificationPolicy.REQUIRED,
)

# Create attesting server
attesting_server = create_attesting_server("my-server", verifier, version="1.0.0")

# Register handlers (same as normal MCP server)
@attesting_server.list_tools()
async def list_tools():
    return [...]

# Protect specific tools
@attesting_server.call_tool()
@attesting_server.require_attestation(trust_level=TrustLevel.PROVIDER)
async def call_tool(name, arguments):
    return [...]

低级协议集成

from attestation import (
    AttestingAgent,
    AttestationMiddleware,
    ServerAttestationCapability,
)

# Client side: Attach attestation to initialize request
agent = AttestingAgent(provider=provider, identity=identity)
capabilities = agent.inject_into_capabilities(
    {"sampling": {}, "roots": {"listChanged": True}},
    audience="https://mcp-server.example.com"
)

# Server side: Verify in middleware
middleware = AttestationMiddleware(
    verifier=verifier,
    capability=ServerAttestationCapability(
        policy="required",
        trusted_issuers=["https://api.anthropic.com"]
    )
)

result = await middleware.process_initialize(request_params)
if result.should_proceed:
    session.attestation = result.context
else:
    return result.error_response

攻击模拟结果

攻击模拟套件演示了对以下情况的保护:

攻击状态防御
模型欺骗✅ 已阻止签名验证
产地伪造✅ 已阻止受信任的发行者列表
令牌重播✅ 已阻止JTI缓存
代币篡改✅ 已阻止签名验证
发卡行打字✅ 已阻止严格匹配发卡行
降级攻击✅ 已阻止策略执行
观众不匹配✅ 已阻止受众验证
安全降级✅ 已阻止已签署的索赔

检测率:100%

规格

看 规格.md 完整的技术规范,包括:

  • JWT令牌结构和声明
  • MCP协议扩展格式
  • 密钥管理(JWKS)
  • 安全注意事项
  • 企业扩展(SPIFFE/IdP)

CLI工具

用于令牌管理的命令行实用程序:

# Generate a key pair
python -m attestation keygen --kid my-key-2025

# Generate an attestation token
python -m attestation generate \
  --issuer https://api.anthropic.com \
  --audience https://my-server.com \
  --model-version claude-sonnet-4 \
  --output full

# Inspect a token (without verification)
python -m attestation inspect 

# Run attack simulation suite
python -m attestation attack

可观测性

内置指标和跟踪支持:

from attestation import get_metrics, trace_verification, AttestationEventHandler

# Access metrics
metrics = get_metrics()
print(metrics.verification_total)
print(metrics.to_prometheus())  # Prometheus format

# Trace operations (OpenTelemetry-compatible)
with trace_verification("https://api.anthropic.com") as span:
    result = await verifier.verify(token)
    span.set_attribute("verified", result.verified)

# Custom event handlers
class MyHandler(AttestationEventHandler):
    def on_replay_detected(self, issuer, jti):
        alert_security_team(issuer, jti)

register_event_handler(MyHandler())

路线图

  • \[x\] 核心证明原语
  • \[x\] MCP协议扩展
  • \[x\] 攻击模拟套件
  • \[x\] MCP SDK集成(认证客户端会话、认证服务器)
  • \[x\] 带缓存的JWKS HTTP提取器
  • \[x\] Redis支持的回放缓存
  • \[x\] CLI工具
  • \[x\] 可观察性(度量、跟踪、事件处理程序)
  • \[x\] TypeScript实现
  • \[\]行为指纹识别(未来研究)

贡献

欢迎投稿和反馈!

许可证

MIT许可证-请参阅 许可证 了解详情。

作者

乔尔·维拉里诺\ 莱斯大学,计算机科学与统计学\ joelavillarino@gmail.com

致谢

初步实施是在Claude(Anthropic)的协助下开发的。 所有代码均由Joel Villarino审查、测试和扩展。

______________________________________________________________________

工具与能力

工具数量

0

资源数量

0

提示词数量

0

能力标签

加密验证Python本地部署身份认证AI安全JWT令牌协议扩展

支持客户端

Claude

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

典型使用场景

看服务状态

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

执行部署变更

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

核对资源用量

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

选择建议

值得选的地方

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

先想清楚的地方

  • stdio 方式要求本地装好 运行环境,换机器要重新装一遍。
  • 需要自备OAuth 授权,没有凭据没法直接试。
  • 公开摘要偏短,具体能力和限制要回到仓库确认。

更适合

  • 需要在运维云端场景里让模型直接调用外部能力的人。
  • 已经在用 Claude 的用户,接入路径最短。
  • 想先快速试一下、能接受在本地跑服务的人。

不太适合

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

同类对比

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

MCP World · 本页

0stdio有1 个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 条

MCP Agent Attestation 怎么安装?

公开资料给出的安装命令是 pip install -e ".[all]",运行环境为 未标注。装完后按客户端要求写进 MCP 配置,重启客户端生效。

MCP Agent Attestation 怎么在 Claude Desktop、Cursor 里配置?

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

MCP Agent Attestation 收费吗?

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

MCP Agent Attestation 需要 API Key 吗?

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

MCP Agent Attestation 支持哪些客户端?

公开资料标注支持 Claude;其他客户端只要能配置 MCP Server,也能用同样的命令或地址接入。

来源信息

继续浏览同类 MCP