# Denaria Agent MCP Handoff

Machine-readable instructions for preparing Denaria App/PWA action handoffs.

## Canonical Components

- MCP endpoint: https://mcp.denaria.finance/mcp
- Transport: Streamable HTTP
- Skill source: https://github.com/denaria-finance/denaria-skills
- Web skill mirror: https://denaria.finance/skills/denaria-action-handoff.md
- MCP Server Card: https://denaria.finance/.well-known/mcp/server-card.json
- Agent Skills Index: https://denaria.finance/.well-known/agent-skills/index.json

The web skill must remain synchronized with the canonical installable skill. It
is not a separate Denaria workflow.

## Bootstrap

For requests to open, prepare, create, or review a Denaria position, do not use
the demo or app UI as the preparation path.

When local skill support is available, obtain approval and install:

~~~bash
npx skills@latest add denaria-finance/denaria-skills
~~~

Then use /denaria-action-handoff with the user's original request.

## MCP Tools

Use denaria_get_capabilities for live discovery when needed. Use
denaria_prepare_create_position for a concrete position request.

Preferred arguments:

~~~json
{
  "marketId": "BTC-USD",
  "side": "long",
  "collateralAsset": "USDC",
  "collateralAmount": "30",
  "leverage": "2"
}
~~~

Do not send maxSlippageBps for normal create-position requests. The Denaria
App/PWA applies the user's setting during scan and review.

## Response Handling

Prefer structured display fields under structuredContent.result.clientDisplay:

~~~json
{
  "qrMarkdown": "![Denaria handoff QR](...)",
  "qrPageUrl": "https://.../handoff/qr?...",
  "qrImageUrl": "https://.../handoff/qr.png?...",
  "nextStep": "Open Denaria App/PWA and scan the QR to review and sign."
}
~~~

Render the QR first. When local file access exists, the installed skill should
download qrImageUrl and render the local PNG. Include the page URL, image URL,
short position summary, and next step as fallbacks.

Match the user's language. If the language is unclear, use English.

## Authority Boundary

~~~text
Denaria Agent Service prepares.
Denaria App/PWA verifies.
The user signs.
External agents do not execute.
~~~

Do not sign, submit, broadcast, execute, custody funds, or bypass PWA review.
Do not treat payment as trading consent.

## PWA Flow

1. Parse the concrete user intent.
2. Use the installed skill or official MCP endpoint.
3. Prepare the unsigned handoff.
4. Render the returned QR and fallback links.
5. The user scans the QR in Denaria App/PWA.
6. The PWA verifies the handoff and refreshes app-side state.
7. The user reviews and signs in the app.
