Subchapter 2.25
plugins/virtuals.mdMarkdown18 KBView on GitHub
[!IMPORTANT] Complete the short Base MCP onboarding flow defined in
SKILL.mdbefore calling any Virtuals endpoint. Virtuals is session-authenticated: every tool requires a JWTtokenparameter obtained via a SIWE login that the user must approve through Base MCP. Run the Auth flow once per session and reuse the token for subsequent calls.
Virtuals (ACP — Agent Commerce Protocol) is a platform for creating and operating autonomous AI agents that can transact onchain, hold payment cards, and own email identities. The Virtuals HTTP API prepares and executes agent management, agent card, and agent email operations. The Base MCP wallet is used only to sign the SIWE login challenge — Virtuals does not route onchain transactions through Base MCP after auth.
No install required. The Virtuals API is a hosted JSON-RPC-2.0-over-HTTP endpoint at https://mcp.acp.virtuals.io/. All 30 operations (auth, agent management, email, cards) are called via plain HTTP POST — no separate server to register or restart.
Virtuals authentication is stateless — no session is stored server-side. Every authenticated tool requires the JWT token from login_complete as an explicit parameter. Run this flow once at the start of the session and reuse the token until it expires (~1 hour); use login_refresh with the refresh token thereafter.
get_wallets (Base MCP) → baseAccount.address
↓
login_start (Virtuals HTTP API) → SIWE message (with nonce + 30-min expiry)
↓
sign type=personal_sign (Base MCP) → approvalUrl + requestId
↓ user approves at the link
get_request_status (Base MCP) → { signature, status: "signed" }
↓
login_complete (Virtuals HTTP API) message + signature → { token, refreshToken, walletAddress }
↓
Reuse `token` as the `token` parameter on every subsequent Virtuals API call.get_wallets and use baseAccount.address.login_start with walletAddress. Returns the SIWE message to sign and a nonce valid for 30 minutes.sign with type: "personal_sign" and data: { message: <SIWE message verbatim> }. Returns an approvalUrl and requestId.get_request_status once after the user confirms; the result includes the signature value.login_complete with the exact message from step 2 and the signature from step 5. Returns { token, refreshToken, walletAddress }.token as the token parameter on every subsequent Virtuals API call. Refresh with login_refresh once the JWT expires.The Base MCP wallet is a Base Account smart wallet (contract account, not a plain EOA). The SIWE signing path has a few sharp edges — these are the failure modes we’ve observed.
Start with wallet identity, not signature format. The most frequent root cause is that the user is approving the sign-in with a different wallet than the one named in the SIWE message — not signature wrapping. Virtuals fully supports Base Account smart wallets (contract accounts), so smart-wallet support is not the issue.
Typical address-mismatch scenarios:
get_wallets returned the address cached there, but the user is approving the sign-in popup on another device (e.g. phone) — or vice versa. The wallet that actually signs is different from the one named in the SIWE message.get_wallets returned.get_wallets result. You fetched the address earlier in the session and the user has since switched the active wallet in Base MCP, so login_start was called with a stale address.Recovery — always try this first:
get_wallets (Base MCP) to refresh baseAccount.address.login_start with the confirmed address so the SIWE message names the wallet the user will actually approve.Only after ruling out wallet mismatch, consider the signature-format cause below.
In some Base Account smart wallet flows, Base MCP sign returns an ERC-6492 wrapped signature (used for counterfactual or contract-deployment-attached signing), and the Virtuals verifier expects a plain ERC-1271 signature.
Recognize ERC-6492 wrapped signatures by:
6492649264926492649264926492649264926492649264926492649264926492.Recovery: restart the auth flow from login_start. Subsequent approvals from the same wallet can produce a plain ERC-1271 signature that Virtuals accepts; the wrapping behavior isn’t deterministic from one approval to the next. If it keeps returning ERC-6492 wrapped signatures, ask the user to confirm via the same approval URL again — repeated retries typically resolve to a plain ERC-1271 signature within a few attempts.
Do not try to unwrap the ERC-6492 envelope manually and submit just the inner bytes — Virtuals rejects that too, because the inner Base Account smart wallet signature format isn’t a vanilla ERC-1271 (r, s, v) either.
Pass the wallet address to login_start exactly as returned by Base MCP get_wallets. The returned address is lowercase, which is fine — Virtuals normalises it. But when calling login_complete, the message you pass must be the verbatim string returned by login_start (which uses the EIP-55 checksummed address). Do not lowercase or otherwise reformat the message. A single character change in casing inside the message hashes to a different value than what was signed and the server will return Invalid SIWE signature.
Verified working pattern:
login_start input: lowercase address (e.g. 0xca8f1eb...) → finelogin_complete message: verbatim string from the login_start response (contains the checksummed 0xCa8F1eB...) → requiredSIWE nonces expire 30 minutes after login_start. If the user took a long time to approve, or you waited and tried again later, login_complete will fail. Restart from login_start to get a fresh nonce — do not reuse an old one.
The SIWE message field in sign (as data.message) and the message field in login_complete must be byte-identical to what login_start returned. JSON-escape \n correctly when embedding in the sign tool’s data payload. When passing the message to login_complete, use real newlines (the same characters the JSON \n escapes decoded to). Any mismatch — extra trailing whitespace, CRLF vs LF, etc. — breaks the hash and yields Invalid SIWE signature.
ERC-1271 verification calls the wallet contract on Base. If the Base Account smart wallet has never been activated on Base mainnet, the contract isn’t deployed and verification will fail even with a structurally correct signature. Confirm deployment by checking eth_getCode for the address on Base mainnet — non-empty bytecode means it’s deployed. Most Base MCP users will already have a deployed wallet; if not, ask the user to perform a no-op transaction first (any Base transaction will deploy the wallet).
JWTs returned by login_complete expire after about an hour. When a Virtuals API call returns a 401, POST login_refresh with the stored refreshToken to get a new access token; only re-run the full SIWE flow if the refresh token is also rejected.
All Virtuals operations go through the Virtuals HTTP API (POST/JSON-RPC). HTTP routing follows the standard order in ../references/custom-plugins.md.
| Capability | Path |
|---|---|
| SIWE sign-in challenge | Base MCP sign (personal_sign) — see Auth. |
| All Virtuals operations (agent management, email, cards) | POST mcp.acp.virtuals.io JSON-RPC — harness HTTP tool if available, else the chat-only HTTP path in ../references/custom-plugins.md. |
The API is POST/JSON-RPC — the GET-only user-paste fallback does not apply. On a chat-only surface with no POST-capable HTTP path, tell the user the operation requires a harness with HTTP tools (e.g. Claude Code) and stop. No onchain transactions route through Base MCP after auth — Virtuals operations execute against Virtuals’ own backend.
POST https://mcp.acp.virtuals.io/
Content-Type: application/json
Accept: application/json, text/event-streamThe endpoint speaks JSON-RPC 2.0. Call any method with method: "tools/call", the method name in params.name, and its arguments in params.arguments. Responses arrive as a Server-Sent Events frame — a single data: line wrapping the JSON-RPC envelope. Unwrap result.content[0].text (a JSON string) to get the payload; check result.isError before using it.
Every authenticated method takes token* (JWT from login_complete) and agentId* (the target agent). Auth methods take neither.
Request example (list agents):
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "agent_list",
"arguments": { "token": "<jwt>" }
}
}| Method | Key args | Purpose |
|---|---|---|
login_start | walletAddress* | Begin SIWE flow. Returns a message (with nonce, 30-min expiry) to sign. |
login_complete | message*, signature* | Exchange signed SIWE message for { token, refreshToken, walletAddress }. |
login_refresh | refreshToken* | Refresh an expired access token without a full SIWE re-auth. |
All require token*.
| Method | Key args | Purpose |
|---|---|---|
agent_list | — | List all agents under the authenticated account. |
agent_create | name*, description*, image? | Create a new agent. |
agent_prepare_launch | agentId*, chainId*, symbol*, antiSniperTaxType*, needAcf*, isProject60days*, airdropPercent*, isRobotics*, prebuyAmount* | Prepare a token launch for an agent. Returns an approvalUrl for user confirmation. |
agent_prepare_launch_status | agentId*, referenceId* | Poll the status of an in-progress token launch. |
All require token* and agentId*.
| Method | Key args | Purpose |
|---|---|---|
agent_email_create_identity | — | Provision a new email identity for the agent. |
agent_email_get_identity | — | Retrieve the agent’s current email identity. |
agent_email_inbox | folder?, cursor?, limit? | List inbox messages. Returns { messages, nextCursor }. |
agent_email_search | query* | Full-text search across the agent’s mailbox. |
agent_email_get_thread | threadId* | Read a full thread — all messages, attachments, status. |
agent_email_compose | to*, subject*, textBody*, htmlBody? | Send a new outbound email from the agent’s address. |
agent_email_reply | threadId*, textBody*, htmlBody? | Reply within an existing thread. |
agent_email_extract_otp | messageId* | Heuristically extract a one-time code from a single message. |
agent_email_extract_links | messageId* | Extract and categorize every link from a message body. |
agent_email_get_attachment | attachmentId* | Get attachment metadata (filename, MIME type, size). Does not return file content. |
All require token* and agentId*.
| Method | Key args | Purpose |
|---|---|---|
agent_card_signup | email* | Start agentcard.ai signup by sending a magic-link email. Returns a state token to pass to agent_card_signup_poll. |
agent_card_signup_poll | state* | Poll signup status. Returns { done, email, nextStep }. |
agent_card_whoami | — | Get card account status { email, verified, nextStep }. |
agent_card_get_profile | — | Get cardholder profile (name, phone, payment method summary). |
agent_card_update_profile | firstName?, lastName?, phoneNumber? | Update cardholder profile. All fields optional (PATCH semantics). |
agent_card_reset_profile | — | Wipe name, phone, and payment method. Requires re-signup to reactivate. |
agent_card_setup_payment_method | — | Start a Stripe SetupIntent session. Returns { url } — user opens URL to attach a payment method. |
agent_card_get_limit | — | Get total spend limit and usage { spendLimitCents, spentCents }. |
agent_card_set_limit | amountCents* | Set total spend limit in cents (minimum 100). |
agent_card_issue | amountCents* | Issue a single-use virtual card. Returns PAN/CVV/expiry inline — treat as PII, do not echo to chat unless the user has explicitly asked. |
agent_card_list | — | List all issued cards / spend-requests for the agent. |
agent_card_get | requestId* | Get a single spend-request by id — status, captured amount, timestamps. PAN/CVV are redacted. |
agent_card_3ds_codes | — | List recent 3DS verification codes received from merchants. Treat as PII. |
token (and refreshToken).token parameter plus its own required arguments.login_refresh when a call returns 401; re-run the full SIWE flow only if the refresh token is also rejected.Target tool: sign (Base MCP, personal_sign) — used only for the SIWE login challenge in the Auth flow.
After authentication there is no Base MCP submission (none): agent management, card, and email operations execute against Virtuals’ own backend via the Virtuals HTTP API, not through Base MCP send_calls or swap.
Log me into Virtualsget_wallets (Base MCP) → baseAccount.address.login_start with walletAddress → SIWE message.sign (Base MCP) with type: "personal_sign", data: { message } → approval URL.get_request_status (Base MCP) → signature.login_complete with the message + signature → token.List all my Virtuals agentsagent_list with token.Create a Virtuals agent with email and a payment cardagent_create with name, description → agentId.agent_email_create_identity with token + agentId.agent_card_signup, poll agent_card_signup_poll until done, then POST agent_card_issue and set limits with agent_card_set_limit.Check my agent's email for a verification codeagent_email_inbox → find the target message by subject/sender.agent_email_extract_otp with the messageId → one-time code.agent_card_issue) and 3DS codes (agent_card_3ds_codes) include sensitive payment information. Email contents may include personal information, OTPs, and attachment data. Do not echo card numbers, CVVs, 3DS codes, OTPs, or email bodies to chat unless the user has explicitly asked.baseAccount.address from get_wallets for SIWE — not the agent wallets (agentWallets[]), which are session-scoped delegations for transactional flows.data: line as JSON, then unwrap result.content[0].text (itself a JSON string) to get the payload. Check result.isError before using the content.agent_card_issue returns PAN/CVV inline. Treat the full card number and CVV as PII from the moment they’re received — do not echo them to chat logs or store them beyond the immediate user request.