Link CLI lets agents get secure payment credentials from a Link wallet for one-time purchases and recurring payments — without storing your real card details.
The CLI can produce one of three credential types:
For now, this is only available to US and Canadian Link accounts.
Documentation:
[!TIP] If you're looking to integrate the Link CLI into your product or agent for consumers to pay with, be sure to look at Integrating into your agent.
npm i -g @stripe/link-cli
Agent and plugin integrations, including the MCP server, run the installed link-cli binary. They intentionally never download or resolve packages at startup, so install the CLI first.
Install the skills:
npx skills add stripe/link-cli
By default when called from an agent (non-TTY), all commands use toon output — a compact, LLM-friendly text format. All commands accept --format [format] for structured output. Other formats: json, yaml, md, jsonl.
List available commands:
link-cli --llms-full
Get a command's full schema with --schema. Example:
link-cli spend-request create --schema
Link CLI can run as a local MCP server. Add the following to your MCP client config (.mcp.json, etc.)
{
"mcpServers": {
"link": {
"command": "link-cli",
"args": ["--mcp"]
}
}
}
Alternatively, use serve to expose link-cli as an MCP endpoint over HTTP.
link-cli serve # binds 127.0.0.1:54321 (loopback only)
link-cli serve --port 8080
link-cli serve --host 0.0.0.0 # expose beyond localhost (see warning below)
The server handles POST /mcp and GET skill discovery at /.well-known/skills/index.json and /.well-known/skills/{skill-name}/SKILL.md, with OPTIONS preflight support. Other paths return 404, unsupported methods return 405, and malformed or ambiguous request paths return 400. It binds to 127.0.0.1 by default so only the local host can reach it. Anyone who can reach the port can use this CLI's authenticated Link session, so only override --host on a trusted, isolated network — doing so prints a warning.
Run a guided onboarding and demo flow:
link-cli onboard
The link-cli requires a Link account. You can log in to your existing one or create one online.
link-cli auth login
You receive a verification URL and a short phrase. Visit the URL, log in to your Link account, and enter the phrase to approve the connection.
link-cli user-info retrieve --format json
In addition to identity fields, the response can include the user's address, spend limits, and verification requirements:
{
"email": "jane@example.com",
"name": "Jane Doe",
"address": {
"line1": "510 Townsend St",
"line2": null,
"city": "San Francisco",
"state": "CA",
"postal_code": "94103",
"country": "US"
},
"agent_wallet_spend_limits": {
"per_transaction": { "limit": 50000 },
"daily": { "limit": 500000, "used": 120000, "remaining": 380000 },
"thirty_day": { "limit": null, "used": 600000, "remaining": null }
},
"agent_wallet_verification_requirement": {
"status": "identity_verification",
"action_url": "https://app.link.com/finish_setup?verify=identity_verification&intended_email=jane%40example.com&fromEmail=jane%40example.com"
}
}
The address field is omitted when its enrichment is unavailable and is null
when the user has no Person record. Finite spend-limit values are cents because
this response does not include a currency. A null limit or remaining amount
means unlimited. agent_wallet_verification_requirement.status can be
not_required, ssn_verification, credit_file_match_ca,
identity_verification, doc_upload_ca, pending, contact_support, or
complete. Its action_url is null when no user action is available.
Retrieve the rules that grant the current app authority to create spend requests without manual approval:
link-cli approval-policy retrieve --format json
Each rule includes an action, a per-purchase limit, and optionally an ordered list of allowed payment method IDs. The API returns an error when no approval policy has been configured.
link-cli payment-methods list
Returns the cards and bank accounts saved to your Link account. Use the id field as payment_method_id in the next step. If you have no payment methods, add new ones in Link.
The list can also include a Link balance payment method with its available balance when that amount is available.
Retrieve one payment method by ID:
link-cli payment-methods retrieve <payment-method-id>
The response contains the same redacted fields as the matching list item, including capability eligibility when available.
Set or change a payment-method nickname:
link-cli payment-methods update <payment-method-id> --nickname "Work card"
Clear a nickname by passing an explicit empty string:
link-cli payment-methods update <payment-method-id> --nickname ""
Set a payment method as the wallet default, or clear its default status:
link-cli payment-methods update <payment-method-id> --is-default true
link-cli payment-methods update <payment-method-id> --is-default false
You can pass --nickname and --is-default together. Supply at least one of
them; omitted fields stay unchanged. Setting a new default replaces the previous
wallet default. Link trims surrounding nickname whitespace and returns the
updated, redacted payment method.
link-cli shipping-address list
Returns the shipping addresses saved to your Link account. The response preserves nullable nickname, address, and address fields exactly as returned by the API.
Create a spend request with merchant details, line items, and amounts. If --payment-method-id is omitted, your default payment method will be used, or the first eligible one if no default is set:
link-cli spend-request create \
--payment-method-id csmrpd_xxx \
--merchant-name "Stripe Press" \
--merchant-url "https://press.stripe.com" \
--context "Purchasing 'Working in Public' from press.stripe.com. The user initiated this purchase through the shopping assistant." \
--amount 3500 \
--line-item "name:Working in Public,unit_amount:3500,quantity:1" \
--total "type:total,display_text:Total,amount:3500" \
--request-approval
The --request-approval flag triggers a push notification to the user for approval. Interactive mode polls until the request leaves the approval waiting states. Agent mode returns a spend-request retrieve command to wait for a status change, including a transition to submitted.
Easily approve requests with the Link app.
The approved spend request includes a card object with number, cvc, exp_month, exp_year, billing_address, and valid_until. Enter these into the merchant's checkout form.
link-cli spend-request retrieve lsrq_001
By default, retrieving a spend request doesn't include card details. Pass --include card to see unmasked card details.
To avoid leaking card credentials into agent transcripts or logs, use --output-file to write the full card to a secure local file while stdout shows only redacted data (brand, last4, expiry):
link-cli spend-request retrieve lsrq_001 --include card --output-file /tmp/link-card.json --format json
The file is created with 0600 permissions. If the file already exists, the command fails unless --force is passed. When --output-file is set, the JSON output replaces the card object with redacted fields and adds a card_output_file path.
For agent polling, pass --interval and optionally --max-attempts:
link-cli spend-request retrieve lsrq_001 --interval 2 --max-attempts 300
Link is already integrated with the following agents:
Link CLI can also read a consumer's financial data -- transactions, balances, and connected account details. Agents can use these features to answer personal finance questions and track trends. Financial Insights are powered by Financial Connections, covering 12,000+ US financial institutions.
Financial Insights also provides pre-computed and user-provided insights to power betterr shopping experiences through the insights commands.
Financial Insights requires additional authorization beyond the default; request access to each type of data you want to access on financial data sources:
link-cli auth login \
--client-name "My Agent" \
--scope "userinfo:read" \
--source-actions read_link_transactions \
--source-actions read_external_transactions \
--source-actions read_balances \
--source-actions read_source_details
If already authenticated for payments, use auth upgrade to add financial data access without dropping existing scopes.
Discovering available insight types only requires an
| 日期 | 榜单 | 排名 | 周期新增 | 总 STAR |
|---|