MCPF MCP信托登记处
 ](https://nodejs.org/)   
MCP服务器的信任注册表 -通过凭证验证和撤销管理对模型上下文协议服务器进行集中治理和验证。
🌟 什么是MCPF注册表?
MCPF注册表为MCP服务器提供集中的信任治理:
MCP Server Registration
↓
Credential Verification (W3C VC)
↓
Registry Entry (searchable, verifiable)
↓
Consumers query trusted servers基于Veritrust的生产MCP注册表: 与集成https://ans.veritrust.vc/mcp
特性
- 📋 服务器注册表 -已验证MCP服务器的持久存储
- ✅ 凭证验证 -W3C VC注册前验证
- 🔍 发现 -按能力、组织、国家、标签搜索
- ⚡ 状态管理 -活动、暂停、撤销的服务器
- 🔐 信任锚 -可配置的可信凭证颁发者
- 📊 撤销列表 -与StatusList2021集成
- 🗄️ PostgreSQL后端 -生产就绪数据库
- 🚀 REST API -简单的HTTP/JSON接口
🚀 快速开始
使用Docker(推荐)
# Clone repository
git clone https://github.com/MCPTrustFramework/MCPF-registry.git
cd MCPF-registry
# Start service
docker-compose up -d
# Verify running
curl http://localhost:4002/mcp/health
# {"status":"ok","version":"1.0.0-alpha"}
# List servers
curl http://localhost:4002/mcp/servers手动安装
# Install dependencies
cd src
npm install
# Set up database
createdb mcpf_registry
psql mcpf_registry < db.sql
# Configure
cp .env.example .env
# Edit .env with your settings
# Run
npm start📖 api参考
核心终点
获取注册表信息
GET /mcp答复:
{
"name": "MCPF Trust Registry",
"version": "1.0.0-alpha",
"mcpfVersion": "1.0",
"documentation": "https://mcpf.dev/docs/registry",
"endpoints": {
"servers": "/mcp/servers",
"search": "/mcp/search",
"issuers": "/mcp/issuers",
"revocations": "/mcp/revocations"
}
}列出MCP服务器
GET /mcp/servers?page=1&limit=50答复:
{
"page": 1,
"limit": 50,
"total": 123,
"items": [
{
"did": "did:web:weather.example.com:mcp:api",
"endpoint": "https://weather.example.com/mcp",
"manifest": "https://weather.example.com/mcp/manifest.json",
"credentials": [
{
"issuer": "did:web:veritrust.vc",
"type": "MCPServerCredential",
"credentialUrl": "https://weather.example.com/mcp/credential.json"
}
],
"metadata": {
"capabilities": ["getCurrentWeather", "getForecast"],
"organization": "National Weather Service",
"country": "US",
"tags": ["weather", "public-data"],
"status": "active"
}
}
]
}通过DID获取服务器
GET /mcp/servers/:did例子:
curl http://localhost:4002/mcp/servers/did:web:weather.example.com:mcp:api注册MCP服务器
POST /mcp/servers
Content-Type: application/json
{
"did": "did:web:weather.example.com:mcp:api",
"endpoint": "https://weather.example.com/mcp",
"manifest": "https://weather.example.com/mcp/manifest.json",
"credentials": [
{
"issuer": "did:web:veritrust.vc",
"type": "MCPServerCredential",
"credentialUrl": "https://weather.example.com/mcp/credential.json"
}
],
"metadata": {
"capabilities": ["getCurrentWeather", "getForecast"],
"organization": "National Weather Service",
"country": "US",
"tags": ["weather", "public-data"],
"status": "active"
}
}搜索服务器
GET /mcp/search?capability={capability}&tag={tag}&organization={org}&country={country}例子:
# Search by capability
curl 'http://localhost:4002/mcp/search?capability=getCurrentWeather'
# Search by organization
curl 'http://localhost:4002/mcp/search?organization=National+Weather+Service'
# Multiple filters
curl 'http://localhost:4002/mcp/search?capability=weather&country=US'列出受信任的发卡机构
GET /mcp/issuers答复:
{
"issuers": [
{
"id": "did:web:veritrust.vc",
"name": "Veritrust",
"documentation": "https://veritrust.vc/issuer/"
}
]
}获得撤销
GET /mcp/revocations答复:
{
"revokedServers": [],
"revokedCredentials": []
}🏗️ 建筑
┌─────────────────────────────────────┐
│ HTTP API (Express.js) │
│ /mcp/servers, /mcp/search │
└──────────────┬──────────────────────┘
│
┌──────────────┴──────────────────────┐
│ Registry Core │
│ • Server validation │
│ • Credential verification │
│ • Search & filtering │
└──────────────┬──────────────────────┘
│
┌──────────────┴──────────────────────┐
│ PostgreSQL Database │
│ • mcp_registry table │
│ • Indexes on DID, capabilities │
│ • JSONB for flexible metadata │
└─────────────────────────────────────┘📊 数据库模式
mcp_注册表
CREATE TABLE mcp_registry (
id SERIAL PRIMARY KEY,
did TEXT NOT NULL UNIQUE, -- MCP server DID
endpoint TEXT NOT NULL, -- MCP endpoint URL
manifest TEXT NOT NULL, -- Manifest URL
credentials JSONB NOT NULL DEFAULT '[]', -- Array of credentials
meta_capabilities JSONB NOT NULL DEFAULT '[]', -- Server capabilities
meta_organization TEXT, -- Organization name
meta_country TEXT, -- Country code
meta_tags JSONB NOT NULL DEFAULT '[]', -- Search tags
meta_status TEXT DEFAULT 'active', -- active|suspended|revoked
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
CREATE INDEX idx_mcp_registry_created_at ON mcp_registry (created_at DESC);🔐 安全
凭证验证
注册前,注册中心应验证:
- 发行人信托 -凭证颁发者是否在受信任列表中?
- 签名有效期 -凭证签名是否经过验证?
- 撤销状态 -凭证是否被吊销?
- 过期 -凭证仍然有效吗?
验证流程示例:
import { VCVerifier } from 'mcpf-did-vc';
const verifier = new VCVerifier();
// Before registration
for (const cred of server.credentials) {
const result = await verifier.verify(cred.credentialUrl);
if (!result.valid) {
throw new Error(`Invalid credential: ${result.error}`);
}
}
// Register server
await registry.upsertServer(server);访问控制
生产部署应保护写端点:
// Add authentication middleware
app.use('/mcp/servers', requireAPIKey);
// Example API key middleware
function requireAPIKey(req, res, next) {
const apiKey = req.headers['x-api-key'];
if (!apiKey || !isValidAPIKey(apiKey)) {
return res.status(401).json({ error: 'Unauthorized' });
}
next();
}🐳 Docker部署
docker-compose.yml
version: '3.8'
services:
registry:
build: .
ports:
- "4002:4002"
environment:
- DATABASE_URL=postgresql://postgres:password@db:5432/mcpf_registry
- PORT=4002
- MCPF_ISSUER_DID=did:web:veritrust.vc
depends_on:
- db
restart: unless-stopped
db:
image: postgres:16-alpine
environment:
- POSTGRES_DB=mcpf_registry
- POSTGRES_PASSWORD=password
volumes:
- postgres_data:/var/lib/postgresql/data
restart: unless-stopped
volumes:
postgres_data:环境变量
# .env
DATABASE_URL=postgresql://user:pass@localhost:5432/mcpf_registry
PORT=4002
NODE_ENV=production
MCPF_ISSUER_DID=did:web:veritrust.vc
MCPF_REGISTRY_VERSION=1.0.0-alpha📝 例子
示例1:注册气象服务
curl -X POST http://localhost:4002/mcp/servers \
-H 'Content-Type: application/json' \
-d '{
"did": "did:web:weather.example.com:mcp:api",
"endpoint": "https://weather.example.com/mcp",
"manifest": "https://weather.example.com/mcp/manifest.json",
"credentials": [{
"issuer": "did:web:veritrust.vc",
"type": "MCPServerCredential",
"credentialUrl": "https://weather.example.com/mcp/credential.json"
}],
"metadata": {
"capabilities": ["getCurrentWeather", "getForecast", "getAlerts"],
"organization": "National Weather Service",
"country": "US",
"tags": ["weather", "public-data", "free-tier"],
"status": "active"
}
}'示例2:按能力搜索
# Find all servers with weather capability
curl 'http://localhost:4002/mcp/search?capability=getCurrentWeather'
# Find all database servers
curl 'http://localhost:4002/mcp/search?capability=query'
# Find all servers in a country
curl 'http://localhost:4002/mcp/search?country=US'示例3:获取服务器详细信息
curl http://localhost:4002/mcp/servers/did:web:weather.example.com:mcp:api🧪 测试
# Run tests
npm test
# With coverage
npm run test:coverage
# Integration tests (requires Docker)
npm run test:integration📈 演出
标准硬件上的基准测试(4 CPU,8GB RAM,PostgreSQL 16):
| 操作 | 性能 | 注意事项 |
|---|---|---|
| 列出服务器 | ~20ms | 分页、索引 |
| 按DID获取 | ~5ms | 唯一索引 |
| 搜索 | ~30ms | JSONB运算符 |
| 注册 | ~25ms | 插入/追加销售 |
| 吞吐量 | ~1500请求/秒 | 读取繁重的工作负载 |
🔗 与MCPF集成
有了MCPF,vc
import { VCVerifier } from 'mcpf-did-vc';
import { RegistryClient } from 'mcpf-registry';
const registry = new RegistryClient('http://localhost:4002');
const verifier = new VCVerifier();
// Get server from registry
const server = await registry.getServer('did:web:weather.example.com:mcp:api');
// Verify its credentials
for (const cred of server.credentials) {
const result = await verifier.verifyCredentialUrl(cred.credentialUrl);
console.log(`Credential valid: ${result.valid}`);
}使用MCPF ans
import { ANSClient } from 'mcpf-ans';
// ANS includes integrated MCP registry
const ansClient = new ANSClient('https://ans.example.com');
// Search via ANS
const servers = await ansClient.mcpSearch({ capability: 'weather' });
// Same data as direct registry access使用克劳德桌面
配置Claude Desktop以使用注册表:
{
"mcpServers": {
"weather": {
"registry": "https://registry.example.com/mcp",
"did": "did:web:weather.example.com:mcp:api",
"verify": true
}
}
}🤝 贡献
看 贡献.md 作为指导方针。
📝 许可证
MIT许可证-请参阅 许可证
📞 联系
- 网站: https://mcpf.dev
- github: https://github.com/MCPTrustFramework/MCPF-registry
- 问题: https://github.com/MCPTrustFramework/MCPF-registry/issues
- 讨论: https://github.com/MCPTrustFramework/MCPF-registry/discussions
🙏 致谢
基于生产实施:
- Veritrust (https://veritrust.vc)-MCP注册处https://ans.veritrust.vc/mcp
🔗 相关项目
- MCPF规范 -SSOT
- MCPF做了vc -DID/VC基础设施
- MCPF安 -代理名称服务
- MCPF-a2a注册表 -A2A代表团
- MCP协议 -MCP官方规范
______________________________________________________________________
版本: 1.0.0-alpha\ 最后更新时间: 2025年12月31日\ 状态: 生产就绪(基于Veritrust部署)
