Skip to content

Commit 44bf363

Browse files
brainGROWTHbrainGROWTH
authored andcommitted
docs: add SATP agent trust verification guide
Adds quickstart, configuration reference, usage modes (annotation/enforcement/graduated), testing examples, and composition patterns for the SATPProvider.
1 parent cc0135b commit 44bf363

1 file changed

Lines changed: 117 additions & 0 deletions

File tree

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
# SATP Agent Trust Verification
2+
3+
Verify agent identity and behavioral trust scores using [AgentFolio/SATP](https://github.com/brainAI-bot/satp-solana-sdk) (Solana Agent Trust Protocol).
4+
5+
## Overview
6+
7+
The `SATPProvider` is an auth provider that checks an agent's on-chain trust score before allowing tool execution. It answers: **"Should I trust this agent for this task?"**
8+
9+
## Quick Start
10+
11+
```typescript
12+
import { MCPServer, SATPProvider } from "mcp-framework";
13+
14+
const server = new MCPServer({
15+
auth: {
16+
provider: new SATPProvider({
17+
minTrustScore: 50,
18+
onMissing: "allow", // Don't break unidentified agents
19+
}),
20+
},
21+
});
22+
```
23+
24+
No API keys needed — the AgentFolio API is public.
25+
26+
## Configuration
27+
28+
| Option | Type | Default | Description |
29+
|--------|------|---------|-------------|
30+
| `apiUrl` | `string` | `"https://api.agentfolio.bot"` | AgentFolio API base URL |
31+
| `minTrustScore` | `number` | `0` | Minimum trust score (0-100) to allow access |
32+
| `requireVerified` | `boolean` | `false` | Require on-chain verification |
33+
| `agentIdHeader` | `string` | `"x-agent-id"` | Header name for agent identity |
34+
| `onMissing` | `"allow" \| "reject"` | `"allow"` | Behavior when agent identity is missing |
35+
| `cacheTtlMs` | `number` | `300000` | Cache TTL in ms (default 5 min) |
36+
37+
## How It Works
38+
39+
1. Agent sends request with `x-agent-id` header (or `Authorization: Agent <id>`)
40+
2. Provider queries AgentFolio for the agent's trust data
41+
3. If trust score meets threshold → request proceeds with trust data attached
42+
4. If below threshold → request rejected with `403` and `X-Trust-Required` header
43+
44+
## Modes
45+
46+
### Annotation mode (default)
47+
```typescript
48+
new SATPProvider({ onMissing: "allow", minTrustScore: 0 })
49+
```
50+
All requests pass through. Trust data is attached to `AuthResult.data.agentTrust` for your tool handlers to use (or ignore).
51+
52+
### Enforcement mode
53+
```typescript
54+
new SATPProvider({
55+
minTrustScore: 50,
56+
requireVerified: true,
57+
onMissing: "reject"
58+
})
59+
```
60+
Only verified agents with trust score ≥ 50 can access tools. Unidentified requests are rejected.
61+
62+
### Graduated trust
63+
```typescript
64+
// In your tool handler, use the trust data for risk-based decisions
65+
const trust = request.context?.agentTrust;
66+
67+
if (trust?.trustScore > 80) {
68+
// High trust: allow sensitive operations
69+
} else if (trust?.trustScore > 30) {
70+
// Medium trust: allow read-only operations
71+
} else {
72+
// Low/no trust: sandbox mode
73+
}
74+
```
75+
76+
## Testing
77+
78+
```bash
79+
# Test with a verified agent
80+
curl -H "x-agent-id: brainGrowth" http://localhost:3000/mcp
81+
82+
# Test without identity (annotation mode passes through)
83+
curl http://localhost:3000/mcp
84+
```
85+
86+
## Trust Data Shape
87+
88+
```typescript
89+
interface AgentTrustResult {
90+
agentId: string; // Agent identifier
91+
trustScore: number; // 0-100
92+
verified: boolean; // On-chain verification status
93+
name?: string; // Display name
94+
capabilities?: string[]; // Capability tags
95+
lastVerified?: string; // ISO timestamp
96+
}
97+
```
98+
99+
## Composing with Other Providers
100+
101+
SATPProvider works alongside JWT, OAuth, or API key providers. Use it as a secondary check after authentication:
102+
103+
```typescript
104+
// Your custom composed provider
105+
class ComposedProvider implements AuthProvider {
106+
private jwt = new JWTProvider(jwtConfig);
107+
private satp = new SATPProvider({ minTrustScore: 30 });
108+
109+
async authenticate(req: IncomingMessage) {
110+
const jwtResult = await this.jwt.authenticate(req);
111+
if (!jwtResult) return false;
112+
113+
const satpResult = await this.satp.authenticate(req);
114+
return satpResult; // Trust data in result.data.agentTrust
115+
}
116+
}
117+
```

0 commit comments

Comments
 (0)