agent-passport-system-mcp 2.7.0 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.js +157 -108
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -34,8 +34,8 @@ commercePreflight, createCommerceDelegation, getSpendSummary, requestHumanApprov
|
|
|
34
34
|
createPrincipalIdentity, endorseAgent, verifyEndorsement, revokeEndorsement, createDisclosure, createFleet, addToFleet, getFleetStatus, revokeFromFleet,
|
|
35
35
|
// Reputation-Gated Authority (Layer 9)
|
|
36
36
|
computeEffectiveScore, createScopedReputation, resolveAuthorityTier, checkTierForIntent, advisoryTierPrecheck, createPromotionReview, updateReputationFromResult, DEFAULT_TIERS, createProxyGateway,
|
|
37
|
-
// Intent Network (Agent-Mediated Matching)
|
|
38
|
-
|
|
37
|
+
// Intent Network (Agent-Mediated Matching) — card creation only, API handles persistence
|
|
38
|
+
createIntentCard, } from "agent-passport-system";
|
|
39
39
|
// ═══════════════════════════════════════
|
|
40
40
|
// State Management
|
|
41
41
|
// ═══════════════════════════════════════
|
|
@@ -68,7 +68,6 @@ const state = {
|
|
|
68
68
|
promotionHistory: [],
|
|
69
69
|
gateway: null,
|
|
70
70
|
gatewayKeys: null,
|
|
71
|
-
intentNetwork: createIntentNetwork(),
|
|
72
71
|
};
|
|
73
72
|
// Load persisted task state
|
|
74
73
|
function loadTasks() {
|
|
@@ -2328,8 +2327,17 @@ server.tool("gateway_stats", "Get gateway statistics: total requests, permits, d
|
|
|
2328
2327
|
});
|
|
2329
2328
|
// ═══════════════════════════════════════
|
|
2330
2329
|
// Intent Network (Agent-Mediated Matching)
|
|
2330
|
+
// Calls the hosted API at api.aeoess.com
|
|
2331
2331
|
// ═══════════════════════════════════════
|
|
2332
|
-
|
|
2332
|
+
const INTENT_API = process.env.INTENT_API_URL || 'https://api.aeoess.com';
|
|
2333
|
+
async function intentApiFetch(path, opts) {
|
|
2334
|
+
const res = await fetch(`${INTENT_API}${path}`, {
|
|
2335
|
+
...opts,
|
|
2336
|
+
headers: { 'Content-Type': 'application/json', 'X-Agent-Id': state.agentId || '', 'X-Public-Key': state.agentKey || '', ...opts?.headers },
|
|
2337
|
+
});
|
|
2338
|
+
return res.json();
|
|
2339
|
+
}
|
|
2340
|
+
server.tool("publish_intent_card", "Publish an IntentCard to the Intent Network at aeoess.com. Your card is visible to all agents on the network. Cards are Ed25519 signed, scoped, and expire automatically.", {
|
|
2333
2341
|
principal_alias: z.string().describe("Human's display name or alias"),
|
|
2334
2342
|
needs: z.array(z.object({
|
|
2335
2343
|
category: z.string().describe("Category (e.g. 'engineering', 'design', 'funding')"),
|
|
@@ -2376,28 +2384,36 @@ server.tool("publish_intent_card", "Publish an IntentCard to the network. Repres
|
|
|
2376
2384
|
approvalRequired: args.approval_required || [],
|
|
2377
2385
|
ttlSeconds: (args.ttl_hours || 24) * 3600,
|
|
2378
2386
|
});
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2387
|
+
try {
|
|
2388
|
+
const result = await intentApiFetch('/api/cards', {
|
|
2389
|
+
method: 'POST',
|
|
2390
|
+
body: JSON.stringify({ ...card, publicKey: state.agentKey, signature: card.signature }),
|
|
2391
|
+
});
|
|
2392
|
+
if (result.error) {
|
|
2393
|
+
return { content: [{ type: "text", text: `Failed to publish: ${result.error}` }], isError: true };
|
|
2394
|
+
}
|
|
2395
|
+
return {
|
|
2396
|
+
content: [{
|
|
2397
|
+
type: "text",
|
|
2398
|
+
text: JSON.stringify({
|
|
2399
|
+
published: true,
|
|
2400
|
+
cardId: result.cardId,
|
|
2401
|
+
agentId: card.agentId,
|
|
2402
|
+
principalAlias: card.principalAlias,
|
|
2403
|
+
needs: card.needs.length,
|
|
2404
|
+
offers: card.offers.length,
|
|
2405
|
+
expiresAt: result.expiresAt,
|
|
2406
|
+
networkSize: result.networkSize,
|
|
2407
|
+
note: 'Card published to Intent Network (api.aeoess.com). Other agents worldwide can now discover matches.',
|
|
2408
|
+
}, null, 2),
|
|
2409
|
+
}],
|
|
2410
|
+
};
|
|
2411
|
+
}
|
|
2412
|
+
catch (e) {
|
|
2413
|
+
return { content: [{ type: "text", text: `API error: ${e.message}` }], isError: true };
|
|
2382
2414
|
}
|
|
2383
|
-
return {
|
|
2384
|
-
content: [{
|
|
2385
|
-
type: "text",
|
|
2386
|
-
text: JSON.stringify({
|
|
2387
|
-
published: true,
|
|
2388
|
-
cardId: card.cardId,
|
|
2389
|
-
agentId: card.agentId,
|
|
2390
|
-
principalAlias: card.principalAlias,
|
|
2391
|
-
needs: card.needs.length,
|
|
2392
|
-
offers: card.offers.length,
|
|
2393
|
-
expiresAt: card.expiresAt,
|
|
2394
|
-
networkSize: state.intentNetwork.cards.size,
|
|
2395
|
-
note: 'Card published. Other agents can now discover matches. Use search_matches to find relevant cards.',
|
|
2396
|
-
}, null, 2),
|
|
2397
|
-
}],
|
|
2398
|
-
};
|
|
2399
2415
|
});
|
|
2400
|
-
server.tool("search_matches", "Search the
|
|
2416
|
+
server.tool("search_matches", "Search the Intent Network for people relevant to you. Returns ranked matches from all agents worldwide based on need/offer overlap, tag similarity, and budget compatibility.", {
|
|
2401
2417
|
min_score: z.number().optional().describe("Minimum relevance score 0-1 (default: 0.1)"),
|
|
2402
2418
|
max_results: z.number().optional().describe("Maximum results to return (default: 10)"),
|
|
2403
2419
|
category_filter: z.string().optional().describe("Only match within this category"),
|
|
@@ -2406,68 +2422,80 @@ server.tool("search_matches", "Search the network for IntentCards relevant to yo
|
|
|
2406
2422
|
if (keyErr)
|
|
2407
2423
|
return { content: [{ type: "text", text: keyErr }], isError: true };
|
|
2408
2424
|
const agentId = state.agentId || 'anonymous';
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2425
|
+
try {
|
|
2426
|
+
const params = new URLSearchParams();
|
|
2427
|
+
if (args.min_score)
|
|
2428
|
+
params.set('minScore', String(args.min_score));
|
|
2429
|
+
if (args.max_results)
|
|
2430
|
+
params.set('max', String(args.max_results));
|
|
2431
|
+
const result = await intentApiFetch(`/api/matches/${agentId}?${params}`);
|
|
2432
|
+
if (result.error) {
|
|
2433
|
+
return { content: [{ type: "text", text: result.error }], isError: true };
|
|
2434
|
+
}
|
|
2435
|
+
return {
|
|
2436
|
+
content: [{
|
|
2437
|
+
type: "text",
|
|
2438
|
+
text: JSON.stringify({
|
|
2439
|
+
matchCount: result.matchCount,
|
|
2440
|
+
totalCandidates: result.totalCandidates,
|
|
2441
|
+
matches: (result.matches || []).map((m) => ({
|
|
2422
2442
|
matchId: m.matchId,
|
|
2423
|
-
otherAgent:
|
|
2424
|
-
otherCard: isA ? m.cardB : m.cardA,
|
|
2443
|
+
otherAgent: m.agentA === agentId ? m.agentB : m.agentA,
|
|
2425
2444
|
score: m.score,
|
|
2426
2445
|
mutual: m.mutual,
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2446
|
+
explanation: m.explanation,
|
|
2447
|
+
needOfferMatches: (m.needOfferMatches || []).map((nom) => ({
|
|
2448
|
+
needCategory: nom.need?.category,
|
|
2449
|
+
offerCategory: nom.offer?.category,
|
|
2430
2450
|
matchType: nom.matchType,
|
|
2431
|
-
relevanceScore: nom.relevanceScore,
|
|
2432
2451
|
})),
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2452
|
+
})),
|
|
2453
|
+
}, null, 2),
|
|
2454
|
+
}],
|
|
2455
|
+
};
|
|
2456
|
+
}
|
|
2457
|
+
catch (e) {
|
|
2458
|
+
return { content: [{ type: "text", text: `API error: ${e.message}` }], isError: true };
|
|
2459
|
+
}
|
|
2440
2460
|
});
|
|
2441
|
-
server.tool("get_digest", "Get a personalized digest: relevant matches, pending intro requests, and incoming intros. The killer feature — 'what matters to me right now?'", {}, async () => {
|
|
2461
|
+
server.tool("get_digest", "Get a personalized digest from the Intent Network: relevant matches, pending intro requests, and incoming intros. The killer feature — 'what matters to me right now?'", {}, async () => {
|
|
2442
2462
|
const agentId = state.agentId || 'anonymous';
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2463
|
+
try {
|
|
2464
|
+
const digest = await intentApiFetch(`/api/digest/${agentId}`);
|
|
2465
|
+
if (digest.error) {
|
|
2466
|
+
return { content: [{ type: "text", text: digest.error }], isError: true };
|
|
2467
|
+
}
|
|
2468
|
+
return {
|
|
2469
|
+
content: [{
|
|
2470
|
+
type: "text",
|
|
2471
|
+
text: JSON.stringify({
|
|
2472
|
+
agentId: digest.agentId,
|
|
2473
|
+
generatedAt: digest.generatedAt,
|
|
2474
|
+
summary: digest.summary,
|
|
2475
|
+
hasCard: digest.hasCard,
|
|
2476
|
+
networkSize: digest.networkSize,
|
|
2477
|
+
matchCount: (digest.matches || []).length,
|
|
2478
|
+
topMatches: (digest.matches || []).slice(0, 5).map((m) => ({
|
|
2479
|
+
otherAgent: m.agentA === agentId ? m.agentB : m.agentA,
|
|
2456
2480
|
score: m.score,
|
|
2457
2481
|
explanation: m.explanation,
|
|
2458
|
-
}
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2482
|
+
})),
|
|
2483
|
+
introsPending: (digest.introsPending || []).length,
|
|
2484
|
+
introsReceived: (digest.introsReceived || []).length,
|
|
2485
|
+
introsReceivedDetail: (digest.introsReceived || []).map((intro) => ({
|
|
2486
|
+
introId: intro.introId,
|
|
2487
|
+
fromAgent: intro.requestedBy,
|
|
2488
|
+
message: intro.message,
|
|
2489
|
+
status: intro.status,
|
|
2490
|
+
})),
|
|
2491
|
+
note: !digest.hasCard ? 'No card published yet. Use publish_intent_card to join the network.' : undefined,
|
|
2492
|
+
}, null, 2),
|
|
2493
|
+
}],
|
|
2494
|
+
};
|
|
2495
|
+
}
|
|
2496
|
+
catch (e) {
|
|
2497
|
+
return { content: [{ type: "text", text: `API error: ${e.message}` }], isError: true };
|
|
2498
|
+
}
|
|
2471
2499
|
});
|
|
2472
2500
|
server.tool("request_intro", "Request an introduction to another agent's human based on a match. Both sides must approve before real information crosses.", {
|
|
2473
2501
|
match_id: z.string().describe("Match ID from search_matches"),
|
|
@@ -2479,15 +2507,19 @@ server.tool("request_intro", "Request an introduction to another agent's human b
|
|
|
2479
2507
|
if (keyErr)
|
|
2480
2508
|
return { content: [{ type: "text", text: keyErr }], isError: true };
|
|
2481
2509
|
try {
|
|
2482
|
-
const result =
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2510
|
+
const result = await intentApiFetch('/api/intros', {
|
|
2511
|
+
method: 'POST',
|
|
2512
|
+
body: JSON.stringify({
|
|
2513
|
+
matchId: args.match_id,
|
|
2514
|
+
targetAgentId: args.target_card_id,
|
|
2515
|
+
message: args.message,
|
|
2516
|
+
fieldsToDisclose: args.disclose_fields || ['needs', 'offers'],
|
|
2517
|
+
agentId: state.agentId,
|
|
2518
|
+
publicKey: state.agentKey,
|
|
2519
|
+
signature: state.privateKey ? sign(args.match_id + args.message, state.privateKey) : '',
|
|
2520
|
+
}),
|
|
2489
2521
|
});
|
|
2490
|
-
if (
|
|
2522
|
+
if (result.error) {
|
|
2491
2523
|
return { content: [{ type: "text", text: `Intro request failed: ${result.error}` }], isError: true };
|
|
2492
2524
|
}
|
|
2493
2525
|
return {
|
|
@@ -2497,8 +2529,7 @@ server.tool("request_intro", "Request an introduction to another agent's human b
|
|
|
2497
2529
|
introId: result.introId,
|
|
2498
2530
|
status: result.status,
|
|
2499
2531
|
targetAgent: result.targetAgentId,
|
|
2500
|
-
|
|
2501
|
-
note: 'Intro request sent. The other agent\'s human will see this in their digest and can approve or decline.',
|
|
2532
|
+
note: 'Intro request sent via Intent Network. The other agent\'s human will see this in their digest.',
|
|
2502
2533
|
}, null, 2),
|
|
2503
2534
|
}],
|
|
2504
2535
|
};
|
|
@@ -2517,15 +2548,18 @@ server.tool("respond_to_intro", "Respond to an introduction request. Approve to
|
|
|
2517
2548
|
if (keyErr)
|
|
2518
2549
|
return { content: [{ type: "text", text: keyErr }], isError: true };
|
|
2519
2550
|
try {
|
|
2520
|
-
const result =
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2551
|
+
const result = await intentApiFetch(`/api/intros/${args.intro_id}`, {
|
|
2552
|
+
method: 'PUT',
|
|
2553
|
+
body: JSON.stringify({
|
|
2554
|
+
verdict: args.approved ? 'approve' : 'decline',
|
|
2555
|
+
message: args.message,
|
|
2556
|
+
disclosedFields: args.disclose_fields ? Object.fromEntries(args.disclose_fields.map(f => [f, 'disclosed'])) : undefined,
|
|
2557
|
+
agentId: state.agentId,
|
|
2558
|
+
publicKey: state.agentKey,
|
|
2559
|
+
signature: state.privateKey ? sign(args.intro_id + (args.approved ? 'approve' : 'decline'), state.privateKey) : '',
|
|
2560
|
+
}),
|
|
2527
2561
|
});
|
|
2528
|
-
if (
|
|
2562
|
+
if (result.error) {
|
|
2529
2563
|
return { content: [{ type: "text", text: `Intro response failed: ${result.error}` }], isError: true };
|
|
2530
2564
|
}
|
|
2531
2565
|
return {
|
|
@@ -2533,7 +2567,7 @@ server.tool("respond_to_intro", "Respond to an introduction request. Approve to
|
|
|
2533
2567
|
type: "text",
|
|
2534
2568
|
text: JSON.stringify({
|
|
2535
2569
|
introId: result.introId,
|
|
2536
|
-
|
|
2570
|
+
status: result.status,
|
|
2537
2571
|
approved: args.approved,
|
|
2538
2572
|
note: args.approved
|
|
2539
2573
|
? 'Introduction approved. Both parties can now see disclosed information.'
|
|
@@ -2546,20 +2580,35 @@ server.tool("respond_to_intro", "Respond to an introduction request. Approve to
|
|
|
2546
2580
|
return { content: [{ type: "text", text: `Intro response failed: ${e.message}` }], isError: true };
|
|
2547
2581
|
}
|
|
2548
2582
|
});
|
|
2549
|
-
server.tool("remove_intent_card", "Remove your IntentCard from the
|
|
2583
|
+
server.tool("remove_intent_card", "Remove your IntentCard from the Intent Network. Use when your needs or offers have changed.", {
|
|
2550
2584
|
card_id: z.string().describe("Card ID to remove"),
|
|
2551
2585
|
}, async (args) => {
|
|
2552
|
-
const
|
|
2553
|
-
|
|
2554
|
-
content: [{
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2586
|
+
const keyErr = requireKey();
|
|
2587
|
+
if (keyErr)
|
|
2588
|
+
return { content: [{ type: "text", text: keyErr }], isError: true };
|
|
2589
|
+
try {
|
|
2590
|
+
const result = await intentApiFetch(`/api/cards/${args.card_id}`, {
|
|
2591
|
+
method: 'DELETE',
|
|
2592
|
+
body: JSON.stringify({
|
|
2593
|
+
agentId: state.agentId,
|
|
2594
|
+
publicKey: state.agentKey,
|
|
2595
|
+
signature: state.privateKey ? sign(args.card_id, state.privateKey) : '',
|
|
2596
|
+
}),
|
|
2597
|
+
});
|
|
2598
|
+
return {
|
|
2599
|
+
content: [{
|
|
2600
|
+
type: "text",
|
|
2601
|
+
text: JSON.stringify({
|
|
2602
|
+
removed: result.removed || false,
|
|
2603
|
+
cardId: args.card_id,
|
|
2604
|
+
error: result.error,
|
|
2605
|
+
}, null, 2),
|
|
2606
|
+
}],
|
|
2607
|
+
};
|
|
2608
|
+
}
|
|
2609
|
+
catch (e) {
|
|
2610
|
+
return { content: [{ type: "text", text: `API error: ${e.message}` }], isError: true };
|
|
2611
|
+
}
|
|
2563
2612
|
});
|
|
2564
2613
|
// ═══════════════════════════════════════
|
|
2565
2614
|
// MCP Prompts — Role-Specific
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-passport-system-mcp",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0",
|
|
4
4
|
"mcpName": "io.github.aeoess/agent-passport-mcp",
|
|
5
5
|
"description": "MCP server for Agent Passport System — cryptographic identity, delegation, governance, and deliberation for AI agents",
|
|
6
6
|
"type": "module",
|