Skip to content

feat: Add MM Connect integration #83

Merged
jiexi merged 11 commits intomainfrom
jl/integrate-mm-connect
Oct 29, 2025
Merged

feat: Add MM Connect integration #83
jiexi merged 11 commits intomainfrom
jl/integrate-mm-connect

Conversation

@jiexi
Copy link
Member

@jiexi jiexi commented Oct 23, 2025

Add MM Connect Integration

Note this does not work for the extension flow for some reason. We should refactor the overloaded extensionId for different entrypoints flow in subsequent PR

Uploading Screen Recording 2025-10-28 at 11.19.59 AM.mov…


Note

Integrates MetaMask Connect via a new provider, adds an MM Connect auto-connect UI button, and updates dependencies/config to support it.

  • SDK:
    • Add MM_CONNECT_ID and update SDK.setExtensionIdAndConnect to support mm-connect.
    • Introduce MetaMaskConnectProvider using @metamask/connect-multichain for connect, session, invoke, and notifications.
  • UI:
    • Add "Auto Connect via MM Connect" button in src/App.tsx and import MM_CONNECT_ID.
  • Dependencies/Config:
    • Add @metamask/connect-multichain to package.json and allow its protobufjs script in LavaMoat.

Written by Cursor Bugbot for commit 62c642a. This will update automatically on new commits. Configure here.

@jiexi jiexi requested a review from a team as a code owner October 23, 2025 23:25
@jiexi jiexi changed the title WIP MetaMaskConnectProvider WIP: MetaMaskConnectProvider Oct 23, 2025
cursor[bot]

This comment was marked as outdated.

@socket-security
Copy link

socket-security bot commented Oct 24, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​metamask/​connect-multichain@​0.1.0791008087100
Updated@​metamask/​utils@​11.3.0 ⏵ 11.8.19910094 +191 -3100

View full report

@socket-security
Copy link

socket-security bot commented Oct 24, 2025

Warning

MetaMask internal reviewing guidelines:

  • Do not ignore-all
  • Each alert has instructions on how to review if you don't know what it means. If lost, ask your Security Liaison or the supply-chain group
  • Copy-paste ignore lines for specific packages or a group of one kind with a note on what research you did to deem it safe.
    @SocketSecurity ignore npm/PACKAGE@VERSION
Action Severity Alert  (click "▶" to expand/collapse)
Warn Medium
@paulmillr/qr@0.2.1 is Deprecated.

Reason: The package is now available as "qr": npm install qr

From: ?npm/@metamask/connect-multichain@0.1.0npm/@paulmillr/qr@0.2.1

ℹ Read more on: This package | This alert | What is a deprecated package?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Research the state of the package and determine if there are non-deprecated versions that can be used, or if it should be replaced with a new, supported solution.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@paulmillr/qr@0.2.1. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn Low
@protobufjs/inquire@1.1.0 is a AI-detected potential code anomaly.

Notes: The code uses eval to dynamically require a module, which is highly unusual and considered unsafe. The usage of eval can lead to code injection vulnerabilities if the moduleName is not properly validated. Additionally, the use of string manipulation to form 'require' is a form of obfuscation and makes the code harder to read and understand.

Confidence: 1.00

Severity: 0.60

From: ?npm/@metamask/connect-multichain@0.1.0npm/@protobufjs/inquire@1.1.0

ℹ Read more on: This package | This alert | What is an AI-detected potential code anomaly?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: An AI system found a low-risk anomaly in this package. It may still be fine to use, but you should check that it is safe before proceeding.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@protobufjs/inquire@1.1.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn Low
pako@2.1.0 is a AI-detected potential code anomaly.

Notes: The code constitutes a robust, standard UTF-8/UTF-16 conversion utility with appropriate fallback paths for environments lacking TextEncoder/TextDecoder. It handles surrogate pairs, invalid sequences, and boundary-safe slicing correctly. No malicious behavior or data leakage is evident in this isolated module; it is safe to rely on as a helper in the open-source supply chain when used as intended.

Confidence: 1.00

Severity: 0.60

From: ?npm/@metamask/connect-multichain@0.1.0npm/pako@2.1.0

ℹ Read more on: This package | This alert | What is an AI-detected potential code anomaly?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: An AI system found a low-risk anomaly in this package. It may still be fine to use, but you should check that it is safe before proceeding.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/pako@2.1.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Ignoring alerts on:

  • @protobufjs/fetch@1.1.0
  • @metamask/onboarding@1.0.1
  • cross-fetch@4.1.0
  • openapi-fetch@0.13.8
  • protobufjs@7.5.4
  • @metamask/multichain-ui@0.1.0
  • @metamask/connect-multichain@0.1.0

View full report

cursor[bot]

This comment was marked as outdated.

// noop?
}
if (request.method === 'wallet_createSession') {
await this.#mmConnect?.connect(['eip155:1'], []);
Copy link
Member Author

Choose a reason for hiding this comment

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

this probably isn't right. Should only be called in the connect method

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@jiexi jiexi changed the title WIP: MetaMaskConnectProvider feat: Add MM Connect integration Oct 28, 2025
cursor[bot]

This comment was marked as outdated.

},
});

await this.#mmConnect?.connect(['eip155:1'], []);
Copy link

Choose a reason for hiding this comment

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

Bug: Redundant Connection Interferes with Multi-Chain Support

The connect() method prematurely calls mmConnect.connect with hardcoded eip155:1 and empty accounts. This creates a redundant connection that conflicts with the wallet_createSession handler, which later connects with the actual user-requested scopes, potentially leading to an incorrect initial state and hindering multi-chain support.

Fix in Cursor Fix in Web

@jiexi
Copy link
Member Author

jiexi commented Oct 29, 2025

@SocketSecurity ignore npm/@metamask/connect-multichain@0.1.0
@SocketSecurity ignore npm/@metamask/multichain-ui@0.1.0

this is us

@jiexi
Copy link
Member Author

jiexi commented Oct 29, 2025

@SocketSecurity ignore npm/cross-fetch@4.1.0
@SocketSecurity ignore npm/@protobufjs/fetch@1.1.0
@SocketSecurity ignore npm/openapi-fetch@0.13.8

expected

@jiexi
Copy link
Member Author

jiexi commented Oct 29, 2025

@SocketSecurity ignore npm/protobufjs@7.5.4
needs to grab .proto files

@jiexi
Copy link
Member Author

jiexi commented Oct 29, 2025

@SocketSecurity ignore npm/@metamask/onboarding@1.0.1

I trust Mark

@jiexi jiexi merged commit a62e21b into main Oct 29, 2025
15 checks passed
@jiexi jiexi deleted the jl/integrate-mm-connect branch October 29, 2025 17:09
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