agent-passport-system-mcp 2.5.0 → 2.6.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.
@@ -0,0 +1,36 @@
1
+ # Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We are committed to making participation in this project a welcoming experience for everyone.
6
+
7
+ ## Standards
8
+
9
+ Examples of positive behavior:
10
+
11
+ - Using inclusive language
12
+ - Being respectful of differing viewpoints
13
+ - Accepting constructive feedback gracefully
14
+ - Focusing on what is best for the community
15
+
16
+ Examples of unacceptable behavior:
17
+
18
+ - Personal attacks or derogatory comments
19
+ - Publishing others' private information without permission
20
+ - Other conduct which could reasonably be considered inappropriate in a professional setting
21
+
22
+ ## Responsibilities
23
+
24
+ Project maintainers are responsible for clarifying standards of acceptable behavior and are expected to take fair corrective action in response to any instances of unacceptable behavior.
25
+
26
+ ## Scope
27
+
28
+ This Code of Conduct applies within all project spaces, including issues, pull requests, and community discussions.
29
+
30
+ ## Enforcement
31
+
32
+ Instances of unacceptable behavior may be reported by contacting the project maintainer. All reports will be reviewed and investigated promptly and fairly.
33
+
34
+ ## Attribution
35
+
36
+ This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1.
@@ -0,0 +1,58 @@
1
+ # Contributing to Agent Passport System MCP Server
2
+
3
+ Thanks for your interest in contributing! This is the MCP server for the [Agent Passport System](https://github.com/aeoess/agent-passport-system) — 49 tools across 8 protocol layers for AI agent identity, trust, governance, and commerce.
4
+
5
+ ## Getting Started
6
+
7
+ 1. Fork the repository
8
+ 2. Clone your fork: `git clone https://github.com/<your-username>/agent-passport-mcp.git`
9
+ 3. Install dependencies: `npm install --include=dev`
10
+ 4. Build the project: `npm run build`
11
+
12
+ ## Development
13
+
14
+ The MCP server is a single-file TypeScript implementation (`src/index.ts`) that wraps the Agent Passport System SDK. All protocol logic lives in the SDK; this repo provides the MCP tool interface.
15
+
16
+ ### Building
17
+
18
+ ```bash
19
+ npm run build
20
+ ```
21
+
22
+ Build must succeed with zero TypeScript errors before submitting a PR.
23
+
24
+ ### Code Style
25
+
26
+ - TypeScript throughout
27
+ - Single-file architecture (`src/index.ts`)
28
+ - Each MCP tool follows the same pattern: validation, SDK call, JSON response
29
+ - Use `zod` for input validation
30
+
31
+ ## Submitting Changes
32
+
33
+ 1. Create a feature branch from `main`
34
+ 2. Make your changes with clear, descriptive commits
35
+ 3. Ensure `npm run build` succeeds with zero errors
36
+ 4. Open a pull request with a description of what you changed and why
37
+
38
+ ## Reporting Issues
39
+
40
+ Open an issue on GitHub with:
41
+
42
+ - A clear title and description
43
+ - Steps to reproduce (if applicable)
44
+ - Expected vs actual behavior
45
+ - Your environment (Node.js version, OS, MCP client)
46
+
47
+ ## Adding New Tools
48
+
49
+ If you're adding new MCP tools, follow the existing pattern in `src/index.ts`:
50
+
51
+ 1. Add the SDK import
52
+ 2. Register the tool with `server.tool()` including zod schema
53
+ 3. Update the README tool table
54
+ 4. Update the tool count in the README header
55
+
56
+ ## License
57
+
58
+ By contributing, you agree that your contributions will be licensed under the project's Apache-2.0 license.
package/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  MCP server for the [Agent Passport System](https://github.com/aeoess/agent-passport-system) — cryptographic identity, delegation, governance, and commerce for AI agents.
10
10
 
11
- **49 tools** across all 8 protocol layers. Works with any MCP client: Claude Desktop, Cursor, Windsurf, and more.
11
+ **55 tools** across all 8 protocol layers. Works with any MCP client: Claude Desktop, Cursor, Windsurf, and more.
12
12
 
13
13
  ## Quick Start
14
14
 
@@ -148,6 +148,16 @@ Add to your MCP config:
148
148
  | `create_disclosure` | Selective disclosure of principal identity (public/verified-only/minimal) |
149
149
  | `get_fleet_status` | Status of all agents endorsed by the current principal |
150
150
 
151
+ ### Reputation-Gated Authority — 5 tools
152
+
153
+ | Tool | Description |
154
+ |------|-------------|
155
+ | `resolve_authority` | Compute effective reputation score and authority tier for an agent |
156
+ | `check_tier` | Check if agent's earned tier permits action at given autonomy/spend |
157
+ | `review_promotion` | Create signed promotion review (earned-only reviewers, no self-promotion) |
158
+ | `update_reputation` | Bayesian (mu, sigma) updates from task results |
159
+ | `get_promotion_history` | List all promotion reviews this session |
160
+
151
161
  ## Architecture
152
162
 
153
163
  ```
@@ -163,7 +173,7 @@ Layer 1 — Agent Passport Protocol (Ed25519 identity)
163
173
 
164
174
  ## Links
165
175
 
166
- - npm SDK: [agent-passport-system](https://www.npmjs.com/package/agent-passport-system) (v1.11.0, 470 tests)
176
+ - npm SDK: [agent-passport-system](https://www.npmjs.com/package/agent-passport-system) (v1.12.0, 511 tests)
167
177
  - Python SDK: [agent-passport-system](https://pypi.org/project/agent-passport-system/) (v0.4.0, 86 tests)
168
178
  - Paper: [doi.org/10.5281/zenodo.18749779](https://doi.org/10.5281/zenodo.18749779)
169
179
  - Docs: [aeoess.com/llms-full.txt](https://aeoess.com/llms-full.txt)
package/build/index.js CHANGED
@@ -33,7 +33,7 @@ commercePreflight, createCommerceDelegation, getSpendSummary, requestHumanApprov
33
33
  // Principal Identity
34
34
  createPrincipalIdentity, endorseAgent, verifyEndorsement, revokeEndorsement, createDisclosure, createFleet, addToFleet, getFleetStatus, revokeFromFleet,
35
35
  // Reputation-Gated Authority (Layer 9)
36
- computeEffectiveScore, createScopedReputation, resolveAuthorityTier, checkTierForIntent, advisoryTierPrecheck, createPromotionReview, updateReputationFromResult, DEFAULT_TIERS, } from "agent-passport-system";
36
+ computeEffectiveScore, createScopedReputation, resolveAuthorityTier, checkTierForIntent, advisoryTierPrecheck, createPromotionReview, updateReputationFromResult, DEFAULT_TIERS, createProxyGateway, } from "agent-passport-system";
37
37
  // ═══════════════════════════════════════
38
38
  // State Management
39
39
  // ═══════════════════════════════════════
@@ -64,6 +64,8 @@ const state = {
64
64
  fleet: null,
65
65
  reputations: new Map(),
66
66
  promotionHistory: [],
67
+ gateway: null,
68
+ gatewayKeys: null,
67
69
  };
68
70
  // Load persisted task state
69
71
  function loadTasks() {
@@ -2112,6 +2114,216 @@ server.tool("get_promotion_history", "Get the promotion review history for this
2112
2114
  };
2113
2115
  });
2114
2116
  // ═══════════════════════════════════════
2117
+ // Proxy Gateway (Enforcement Boundary)
2118
+ // ═══════════════════════════════════════
2119
+ server.tool("create_gateway", "Create a ProxyGateway enforcement boundary. The gateway validates identity, delegation scope, policy compliance, and provides replay protection for every tool call. Returns gateway ID and public key.", {
2120
+ gatewayId: z.string().optional().describe("Custom gateway ID (auto-generated if omitted)"),
2121
+ approvalTTLSeconds: z.number().optional().describe("Two-phase approval timeout in seconds (default: 300)"),
2122
+ maxPendingPerAgent: z.number().optional().describe("Max pending approvals per agent (default: 10)"),
2123
+ }, async ({ gatewayId, approvalTTLSeconds, maxPendingPerAgent }) => {
2124
+ const keys = generateKeyPair();
2125
+ const id = gatewayId || `gateway-${Date.now().toString(36)}`;
2126
+ if (!state.floor) {
2127
+ return { content: [{ type: "text", text: "Error: Load a Values Floor first (load_values_floor)" }] };
2128
+ }
2129
+ const config = {
2130
+ gatewayId: id,
2131
+ gatewayPublicKey: keys.publicKey,
2132
+ gatewayPrivateKey: keys.privateKey,
2133
+ floor: state.floor,
2134
+ approvalTTLSeconds: approvalTTLSeconds ?? 300,
2135
+ maxPendingPerAgent: maxPendingPerAgent ?? 10,
2136
+ recheckRevocationOnExecute: true,
2137
+ };
2138
+ // Default executor echoes tool calls — real execution is done by MCP client
2139
+ const executor = async (tool, params) => {
2140
+ return { success: true, result: { tool, params, executedVia: 'mcp-gateway' } };
2141
+ };
2142
+ state.gateway = createProxyGateway(config, executor);
2143
+ state.gatewayKeys = keys;
2144
+ return {
2145
+ content: [{
2146
+ type: "text",
2147
+ text: JSON.stringify({
2148
+ created: true,
2149
+ gatewayId: id,
2150
+ publicKey: keys.publicKey,
2151
+ approvalTTLSeconds: config.approvalTTLSeconds,
2152
+ maxPendingPerAgent: config.maxPendingPerAgent,
2153
+ note: "Gateway ready. Register agents with register_gateway_agent, then process calls with gateway_process_tool_call.",
2154
+ }, null, 2),
2155
+ }],
2156
+ };
2157
+ });
2158
+ server.tool("register_gateway_agent", "Register an agent with the gateway. The agent must have a valid passport and floor attestation. Delegations define what scopes the agent can use through the gateway.", {
2159
+ agentId: z.string().describe("Agent ID to register"),
2160
+ }, async ({ agentId }) => {
2161
+ if (!state.gateway) {
2162
+ return { content: [{ type: "text", text: "Error: Create gateway first (create_gateway)" }] };
2163
+ }
2164
+ const agent = state.agents.get(agentId);
2165
+ if (!agent) {
2166
+ return { content: [{ type: "text", text: `Error: Agent "${agentId}" not found in session. Join social contract first.` }] };
2167
+ }
2168
+ const agentDelegations = Array.from(state.delegations.values()).filter(d => d.delegatedTo === agent.publicKey);
2169
+ if (agentDelegations.length === 0) {
2170
+ return { content: [{ type: "text", text: `Error: No delegations found for agent "${agentId}". Create a delegation first.` }] };
2171
+ }
2172
+ if (!agent.attestation) {
2173
+ return { content: [{ type: "text", text: `Error: Agent "${agentId}" has no floor attestation. Attest to floor first.` }] };
2174
+ }
2175
+ state.gateway.registerAgent(agent.passport, agent.attestation, agentDelegations);
2176
+ return {
2177
+ content: [{
2178
+ type: "text",
2179
+ text: JSON.stringify({
2180
+ registered: true,
2181
+ agentId,
2182
+ delegationCount: agentDelegations.length,
2183
+ scopes: agentDelegations.flatMap(d => d.scope),
2184
+ }, null, 2),
2185
+ }],
2186
+ };
2187
+ });
2188
+ server.tool("gateway_process_tool_call", "Process a tool call through the gateway enforcement boundary. Validates identity, delegation, policy, and replay protection in a single atomic operation. Returns execution result with full 3-signature proof chain.", {
2189
+ agentId: z.string().describe("ID of the requesting agent"),
2190
+ tool: z.string().describe("Tool name to execute"),
2191
+ params: z.record(z.unknown()).optional().describe("Tool parameters"),
2192
+ scopeRequired: z.string().describe("Delegation scope needed for this tool"),
2193
+ spendAmount: z.number().optional().describe("Spend amount if commerce action"),
2194
+ spendCurrency: z.string().optional().describe("Currency code (e.g. USD)"),
2195
+ context: z.string().optional().describe("Human-readable context for audit"),
2196
+ }, async ({ agentId, tool, params, scopeRequired, spendAmount, spendCurrency, context }) => {
2197
+ if (!state.gateway) {
2198
+ return { content: [{ type: "text", text: "Error: Create gateway first (create_gateway)" }] };
2199
+ }
2200
+ const agent = state.agents.get(agentId);
2201
+ if (!agent) {
2202
+ return { content: [{ type: "text", text: `Error: Agent "${agentId}" not found in session.` }] };
2203
+ }
2204
+ const { canonicalize } = await import("agent-passport-system");
2205
+ const requestId = `mcp-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
2206
+ const payload = canonicalize({ requestId, agentId, tool, params: params || {}, scopeRequired, spend: spendAmount ? { amount: spendAmount, currency: spendCurrency || 'USD' } : undefined });
2207
+ const request = {
2208
+ requestId,
2209
+ agentId,
2210
+ agentPublicKey: agent.publicKey,
2211
+ signature: sign(payload, agent.keyPair.privateKey),
2212
+ tool,
2213
+ params: params || {},
2214
+ scopeRequired,
2215
+ spend: spendAmount ? { amount: spendAmount, currency: spendCurrency || 'USD' } : undefined,
2216
+ context,
2217
+ };
2218
+ const result = await state.gateway.processToolCall(request);
2219
+ return {
2220
+ content: [{
2221
+ type: "text",
2222
+ text: JSON.stringify({
2223
+ executed: result.executed,
2224
+ requestId: result.requestId,
2225
+ result: result.result ?? undefined,
2226
+ denialReason: result.denialReason ?? undefined,
2227
+ toolError: result.toolError ?? undefined,
2228
+ ...(result.decision && { verdict: result.decision.verdict, reason: result.decision.reason }),
2229
+ ...(result.proof && {
2230
+ proof: {
2231
+ hasRequestSignature: !!result.proof.requestSignature,
2232
+ hasDecisionSignature: !!result.proof.decisionSignature,
2233
+ hasReceiptSignature: !!result.proof.receiptSignature,
2234
+ policyReceiptId: result.proof.policyReceipt?.policyReceiptId,
2235
+ },
2236
+ }),
2237
+ ...(result.receipt && {
2238
+ receipt: {
2239
+ receiptId: result.receipt.receiptId,
2240
+ agentId: result.receipt.agentId,
2241
+ action: result.receipt.action,
2242
+ },
2243
+ }),
2244
+ }, null, 2),
2245
+ }],
2246
+ };
2247
+ });
2248
+ server.tool("gateway_approve", "Two-phase execution: approve a tool call without executing it. Returns an approval ID that can be executed later with gateway_execute_approval. Useful for human-in-the-loop workflows.", {
2249
+ agentId: z.string().describe("ID of the requesting agent"),
2250
+ tool: z.string().describe("Tool name to approve"),
2251
+ params: z.record(z.unknown()).optional().describe("Tool parameters"),
2252
+ scopeRequired: z.string().describe("Delegation scope needed"),
2253
+ context: z.string().optional().describe("Human-readable context"),
2254
+ }, async ({ agentId, tool, params, scopeRequired, context }) => {
2255
+ if (!state.gateway) {
2256
+ return { content: [{ type: "text", text: "Error: Create gateway first (create_gateway)" }] };
2257
+ }
2258
+ const agent = state.agents.get(agentId);
2259
+ if (!agent) {
2260
+ return { content: [{ type: "text", text: `Error: Agent "${agentId}" not found in session.` }] };
2261
+ }
2262
+ const { canonicalize } = await import("agent-passport-system");
2263
+ const requestId = `mcp-approve-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
2264
+ const payload = canonicalize({ requestId, agentId, tool, params: params || {}, scopeRequired, spend: undefined });
2265
+ const request = {
2266
+ requestId,
2267
+ agentId,
2268
+ agentPublicKey: agent.publicKey,
2269
+ signature: sign(payload, agent.keyPair.privateKey),
2270
+ tool,
2271
+ params: params || {},
2272
+ scopeRequired,
2273
+ context,
2274
+ };
2275
+ const result = state.gateway.approve(request);
2276
+ return {
2277
+ content: [{
2278
+ type: "text",
2279
+ text: JSON.stringify({
2280
+ approved: result.approved,
2281
+ ...(result.approval && {
2282
+ approvalId: result.approval.approvalId,
2283
+ expiresAt: result.approval.expiresAt,
2284
+ nonce: result.approval.nonce,
2285
+ }),
2286
+ ...(result.denial && { denial: result.denial }),
2287
+ }, null, 2),
2288
+ }],
2289
+ };
2290
+ });
2291
+ server.tool("gateway_execute_approval", "Execute a previously approved tool call. Rechecks delegation validity before execution — if delegation was revoked since approval, execution is denied.", {
2292
+ approvalId: z.string().describe("Approval ID from gateway_approve"),
2293
+ }, async ({ approvalId }) => {
2294
+ if (!state.gateway) {
2295
+ return { content: [{ type: "text", text: "Error: Create gateway first (create_gateway)" }] };
2296
+ }
2297
+ const result = await state.gateway.executeApproval(approvalId);
2298
+ return {
2299
+ content: [{
2300
+ type: "text",
2301
+ text: JSON.stringify({
2302
+ executed: result.executed,
2303
+ requestId: result.requestId,
2304
+ result: result.result ?? undefined,
2305
+ denialReason: result.denialReason ?? undefined,
2306
+ ...(result.proof && {
2307
+ proof: {
2308
+ policyReceiptId: result.proof.policyReceipt?.policyReceiptId,
2309
+ },
2310
+ }),
2311
+ }, null, 2),
2312
+ }],
2313
+ };
2314
+ });
2315
+ server.tool("gateway_stats", "Get gateway statistics: total requests, permits, denials, replay attempts blocked, active agents, and pending approvals.", {}, async () => {
2316
+ if (!state.gateway) {
2317
+ return { content: [{ type: "text", text: "Error: Create gateway first (create_gateway)" }] };
2318
+ }
2319
+ return {
2320
+ content: [{
2321
+ type: "text",
2322
+ text: JSON.stringify(state.gateway.getStats(), null, 2),
2323
+ }],
2324
+ };
2325
+ });
2326
+ // ═══════════════════════════════════════
2115
2327
  // MCP Prompts — Role-Specific
2116
2328
  // ═══════════════════════════════════════
2117
2329
  server.prompt("coordination_role", "Get instructions for your assigned coordination role", {}, async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-passport-system-mcp",
3
- "version": "2.5.0",
3
+ "version": "2.6.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",
@@ -8,7 +8,9 @@
8
8
  "agent-passport-system-mcp": "build/index.js"
9
9
  },
10
10
  "files": [
11
- "build"
11
+ "build",
12
+ "CONTRIBUTING.md",
13
+ "CODE_OF_CONDUCT.md"
12
14
  ],
13
15
  "scripts": {
14
16
  "build": "tsc && chmod 755 build/index.js",
@@ -45,7 +47,7 @@
45
47
  "homepage": "https://github.com/aeoess/agent-passport-mcp",
46
48
  "dependencies": {
47
49
  "@modelcontextprotocol/sdk": "^1.12.0",
48
- "agent-passport-system": "file:../agent-passport-system/agent-passport-system-1.11.0.tgz",
50
+ "agent-passport-system": "file:../agent-passport-system/agent-passport-system-1.12.0.tgz",
49
51
  "zod": "^3.25.0"
50
52
  },
51
53
  "devDependencies": {