-
Notifications
You must be signed in to change notification settings - Fork 502
Description
Ticket Contents
Description
The Model Context Protocol (MCP) is rapidly becoming the standard integration layer for AI agents interacting with external services. Finternet's UNITS system — with its delegation-scoped account model, programmable token operations, and credential-gated transfers — is a natural fit for agentic execution: recurring payments, conditional transfers, cross-border routing, and portfolio operations all benefit from agent-driven automation without requiring real-time user approval per operation.
An initial MCP server for the UNITS API exists but has known gaps in tool coverage, error handling, and agentic workflow support. This project has two workstreams: (1) audit and remediate existing MCP server gaps, and (2) design and implement delegation-scoped agentic workflow tools that expose UNITS' programmable delegation model to AI agents in a safe, policy-bound way.
Goals & Mid-Point Milestone
Goals
- Workstream 1 — Conduct a systematic audit of the existing UNITS MCP server against the full UNITS App API surface. For each gap, produce one of:
- A new MCP tool implementation
- A documented limitation with rationale (e.g., operations that should not be exposed via MCP for security reasons)
- A fix to an existing tool (error handling, schema correctness, response formatting)
- Workstream 2 — Design and implement MCP tools that expose UNITS' delegation model to agents safely. All agent-initiated operations must present a valid delegation credential chain; UNITS enforces scope at execution time. Tools to implement:
- get_account_summary — returns unified token holdings (native + proxy), active delegations, and credential store summary for the delegating account; respects delegation scope
- initiate_transfer — initiates a token transfer within the agent's delegated scope (token class, amount limit, frequency limit enforced); returns pre-flight policy evaluation result before committing
- check_transfer_eligibility — dry-run transfer policy evaluation without committing; returns which dependency pointers passed/failed and which credentials were checked
- get_delegation_scope — returns the agent's current delegation credential with scope constraints; allows an agent to self-check before attempting an out-of-scope operation
- subscribe_lifecycle_events — subscribes the agent to UNITS lifecycle events (transfer committed, credential expired, dependency pointer state changed) relevant to the delegating account, within delegated scope
- present_credential_vp — constructs and submits a Verifiable Presentation from the account's credential store to satisfy a transfer policy credential requirement; agent does not see raw credential values
- Agentic safety constraints:
- No MCP tool may expose a raw private key or credential claim value to the agent
- initiate_transfer always returns a pre-flight eligibility check result before committing; agents cannot skip the pre-flight
- All tool calls are logged with the agent's Finternet account address
- Scope violations return a structured SCOPE_EXCEEDED error, not a generic failure
- Goals Achieved By Mid-point Milestone: get_account_summary, check_transfer_eligibility, and get_delegation_scope tools implemented and tested.
Setup/Installation
Builds on the existing UNITS MCP server codebase. MCP SDK for tool definitions and server scaffolding. Local development against a Docker Compose UNITS dev environment. Integration tests using the MCP Inspector tool and a test AI agent harness (e.g., Claude via the Anthropic API with tool use).
Expected Outcome
No response
Acceptance Criteria
No response
Implementation Details
- MCP SDK: Any conformant MCP SDK may be used (reference implementations exist in TypeScript, Python, and Rust — contributor to select based on UNITS codebase language and justify the choice); all tools defined with full JSON Schema input/output specs regardless of implementation language
- Auth: All MCP tool calls carry a delegation credential chain in the request context; UNITS validates the chain before executing any operation
- Error schema: All UNITS MCP tool errors return {code: string, message: string, detail: object} where code is one of a defined enum, where code is appropriately defined enum
- Testing: Three levels required — (1) unit tests per tool against a mock UNITS server, (2) integration tests covering full request-response cycles against a dev UNITS instance, (3) end-to-end agentic workflow tests using an AI agent client exercising ≥2 complete delegation-scoped workflows. Contributor to propose specific tooling in their implementation plan.
Mockups/Wireframes
No response
Product Name
UNITS MCP Server — Agentic Tooling and Gap Remediation
Organisation Name
FinternetLabs
Domain
Financial Inclusion
Tech Skills Needed
Other
Mentor(s)
Will be assigned from the Finternet engineering team
Category
Backend, AI