# MCPletA2A MCPlet Agent Profile (A2A) platform implementation and reference implementation. ## Directory Structure ``` MCPletA2A/ ├── platform_impl/ MCPlet Agent Profile Host platform └── reference_impl/ Cancel-rate reduction scenario reference implementation ``` ## Platform (`platform_impl`) Implements the MCPlet Agent Profile Host as defined in MCPlet-spec-v202603-03. Key components: | Component | File | Role | |-----------|------|------| | MCPlet Host | `src/host/mcplet-host.ts` | Main orchestration entry point | | Pool Registry | `src/pools/pool-registry.ts` | Pool membership + per-agent access enforcement | | MCPlet Discovery | `src/discovery/mcplet-discovery.ts` | MCP tools/list + validation + hot-reload | | LLM Adapter | `src/llm/` | LLM-agnostic interface, Claude implementation | | Base Agent | `src/agents/base-agent.ts` | Abstract agent with Passkey interception + tool loop | | Director Agent | `src/agents/director-agent.ts` | Cron-triggered, anti-concurrent, retry-safe | | A2A Local Bus | `src/a2a/local-bus.ts` | In-process inter-agent message routing | | A2A External Endpoint | `src/a2a/external-endpoint.ts` | HTTP endpoint for External Agents (Bearer auth) | | Passkey Server | `src/passkey/passkey-server.ts` | localhost WebAuthn ceremony page | | Dashboard | `src/dashboard/dashboard-server.ts` | Audit log + tool/agent visibility | | Audit Log | `src/host/audit-log.ts` | In-memory action invocation log | ### Setup ```bash cd platform_impl npm install npm run build ``` ### Configuration Copy and edit `config/platform.yaml`: ```bash export ANTHROPIC_API_KEY=sk-ant-... MCPLET_CONFIG=config/platform.yaml npm start ``` --- ## Reference Implementation (`reference_impl`) Demonstrates the cancel-rate reduction scenario from Flow.png. ### Flow ``` [cron 07:00] Director Agent → InfoGatheringAgent (info-pool) fetch_web_content → 天気予報 (明日は雨) call_external_api → デザート在庫 query_crm → 高キャンセル傾向顧客 5名 query_crm → 明日の予約 6件 → PlanningAgent (pool-less) query_erp → 在庫確認 → 無料デザートキャンペーン立案 → [店長 Passkey 承認] → DispatchAgent (media-pool) send_email × 5 → 対象顧客にメール送信 (Passkey strict) ``` ### MCPlet Inventory | MCPlet | Tool | Type | Pool | Visibility | |--------|------|------|------|------------| | サイトアクセス | `read_site_stats` | read | media-pool | [model] | | Email | `send_email` | action | media-pool | [app] | | SNS | `post_sns` | action | media-pool | [app] | | 外部Web | `fetch_web_content` | read | info-pool | [model] | | 外部API | `call_external_api` | read | info-pool | [model] | | CRM | `query_crm` | read | (none) | [model] | | ERP | `query_erp` | read | (none) | [model] | | HR | `query_hr` | read | (none) | [model] | ### Setup ```bash cd reference_impl npm install npm run build # Start mock services (port 5100) npm run mock ``` ### Running MCPlet Servers Each MCPlet is a standalone MCP server started via stdio. Start all: ```bash node dist/mcplets/info-pool/web-access/index.js node dist/mcplets/info-pool/api-access/index.js node dist/mcplets/internal/crm/index.js node dist/mcplets/internal/erp/index.js node dist/mcplets/internal/hr/index.js node dist/mcplets/media-pool/site-access/index.js node dist/mcplets/media-pool/email/index.js node dist/mcplets/media-pool/sns/index.js ``` --- ## Spec Compliance | Requirement | Implementation | |-------------|---------------| | `mcpletType` declaration + enforcement | `MCPletDiscovery.validate()` rejects missing/invalid | | Visibility filtering | `PoolRegistry.getToolsForAgent()` filters to `model`-visible for LLM | | Per-agent Pool access | `PoolRegistry.canAgentAccess()` enforced in `BaseAgent.invokeMCPlet()` | | action + model-visible + no auth → reject | `MCPletDiscovery.validate()` | | Director Agent anti-concurrency | `DirectorAgent.running` flag | | A2A local bus process-boundary | `A2ALocalBus` — in-memory only, no network | | External Agent auth | Bearer token validation in `A2AExternalEndpoint` | | Passkey Web Page (localhost mode) | Dynamic port, loopback-only, auto-close | | action tool Passkey interception | `BaseAgent.invokeMCPlet()` Phase 2 intercept | | Audit log for action tools | `AuditLog.record()` on every action invocation |