Skip to content

✨ (speculos-mcp) [NO-ISSUE]: Add Speculos MCP server for Ledger device emulation#1335

Open
aussedatlo wants to merge 6 commits intodevelopfrom
feat/no-issue-mcp-speculos
Open

✨ (speculos-mcp) [NO-ISSUE]: Add Speculos MCP server for Ledger device emulation#1335
aussedatlo wants to merge 6 commits intodevelopfrom
feat/no-issue-mcp-speculos

Conversation

@aussedatlo
Copy link
Contributor

@aussedatlo aussedatlo commented Mar 3, 2026

📝 Description

Add a new @ledgerhq/speculos-mcp package that provides a Model Context Protocol (MCP) server for interacting with the Speculos Ledger device emulator.

This enables AI agents (e.g. in Cursor IDE) to drive the Speculos emulator through a structured tool interface — signing Ethereum transactions and EIP-712 typed data, navigating review screens, reading device state, and capturing screenshots.

Key features:

14 MCP tools: sign_transaction, sign_typed_data, swipe, approve, reject, read, screenshot, start_speculos, stop_speculos, speculos_status, dismiss_transaction_check, accept_blind_signing, enable_blind_signing, get_logs
Automatic DMK session management with Speculos transport
Clear signing support with EIP-7730 context modules
Screen event monitoring via Speculos /events endpoint
Workflow resource describing the signing lifecycle for AI agents
Docker-based Speculos lifecycle management via start_speculos / stop_speculos
MCP-native logging via sendLoggingMessage() with categorized loggers (dmk, docker, server) and a get_logs tool for on-demand filtered retrieval
Device-aware interactions using speculos-device-controller (percentage-based actions instead of hardcoded pixel coordinates)
One-file-per-tool architecture for maintainability
Cursor MCP config (.cursor/mcp.json) for out-of-the-box IDE integration

❓ Context

  • JIRA or GitHub link: [NO-ISSUE]
  • Feature: New internal tooling package for AI-assisted Speculos device interaction

✅ Checklist

Pull Requests must pass CI checks and undergo code review. Set the PR as Draft if it is not yet ready for review.

  • Covered by automatic tests
  • Changeset is provided
  • Documentation is up-to-date
  • Impact of the changes:
    • New packages/speculos-mcp/ package (private, not published)
    • New .cursor/mcp.json configuration for the MCP server
    • Updated pnpm-lock.yaml with new dependencies

Made with Cursor

@vercel
Copy link

vercel bot commented Mar 3, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
device-sdk-ts-sample Ready Ready Preview, Comment Mar 18, 2026 10:28am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
doc-device-management-kit Ignored Ignored Mar 18, 2026 10:28am

Request Review

@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2026

Danger Check Results

Messages

⚠️

No changeset file found. Please make sure this is intended or add a changeset file.

Danger: All checks passed successfully! 🎉

Generated by 🚫 dangerJS against 62ba6e0

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new private @ledgerhq/speculos-mcp package that provides a Model Context Protocol (MCP) server for AI agents to interact with the Speculos Ledger device emulator. It enables signing Ethereum transactions and EIP-712 typed data, navigating device review screens, managing Docker-based Speculos lifecycle, and capturing screenshots through 14 MCP tools.

Changes:

  • New packages/speculos-mcp/ package with 14 MCP tools (sign, swipe, approve, reject, etc.), prompts, resources, and Docker-based Speculos lifecycle management
  • Cursor IDE integration via .cursor/mcp.json for out-of-the-box MCP server usage
  • Updated pnpm-lock.yaml with new dependencies (@modelcontextprotocol/sdk, zod@3.25, hono, etc.)

Reviewed changes

Copilot reviewed 40 out of 41 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
packages/speculos-mcp/package.json New private package definition with workspace deps and MCP SDK
packages/speculos-mcp/src/server.ts Main MCP server entry point with stdio transport
packages/speculos-mcp/src/speculos-client.ts HTTP + device-controller client for Speculos API
packages/speculos-mcp/src/dmk-session.ts DMK session management, signing state tracking
packages/speculos-mcp/src/actions.ts Device interaction flows (approve, reject, blind signing)
packages/speculos-mcp/src/docker-manager.ts Docker-based Speculos lifecycle (start/stop/status)
packages/speculos-mcp/src/screen-events.ts Screen event parsing and button detection
packages/speculos-mcp/src/screen-events.test.ts Unit tests for screen event parsing
packages/speculos-mcp/src/logger.ts Ring-buffer logger with MCP logging integration
packages/speculos-mcp/src/constants.ts UI pattern constants and delay values
packages/speculos-mcp/src/tools/*.ts 14 individual tool files (one-per-tool architecture)
packages/speculos-mcp/src/prompts/*.ts MCP prompts for signing workflows
packages/speculos-mcp/resources/workflow.md MCP resource describing the signing lifecycle
.cursor/mcp.json Cursor IDE MCP server configuration
pnpm-lock.yaml Lock file updates for new dependencies
Config files (.prettierrc, eslint, tsconfig, vitest) Standard project configuration
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…p-based waits with screen polling

Convert dmk-session and cs-tester-manager from module-level globals into
DmkSession and CsTesterManager classes, threaded through ToolDeps so tools
never import global state directly. Replace all sleep(DELAY.postTap) waits
with waitForScreenChange polling that detects actual screen transitions.

Also fixes a bug where start_speculos errors were swallowed when the
cs-tester child process exited before the polling loop detected the failure,
and adds Docker troubleshooting guidance to workflow.md.

Made-with: Cursor
Renumber workflow steps from 1-6 (instead of 0-5) and restructure
the initial step to lead with speculos_status before read, using
explicit branching for running vs not-running states.

Made-with: Cursor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants