evm-chain-id-format

evm-chain-id-format is a cursor rule for Cursor from MetaMask/metamask-connect-cursor-plugin. It costs 1,377 tokens per session, scanned A, original, MIT.

A set of rules for handling EVM network IDs in MetaMask Connect. EVM is the system used by Ethereum-compatible blockchains; these rules distinguish hexadecimal IDs used by wallets from decimal IDs used in CAIP-2 network labels.

In plain words
What is it for?
It is for converting chain IDs, defining supported networks, calling network-switch functions, and creating CAIP-2 identifiers for Ethereum-compatible chains.
Why use it?
It prevents connection failures and runtime errors caused by passing network IDs in the wrong format.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc).

Good fit It is for converting chain IDs, defining supported networks, calling network-switch functions, and creating CAIP-2 identifiers for Ethereum-compatible chains.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/metamask/metamask-connect-cursor-plugin/evm-chain-id-format
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/MetaMask/metamask-connect-cursor-plugin

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for evm-chain-id-format

README.md
[![agentmods](https://agentmods.dev/badge/rules/metamask/metamask-connect-cursor-plugin/evm-chain-id-format/github.svg)](https://agentmods.dev/rules/metamask/metamask-connect-cursor-plugin/evm-chain-id-format)
Your own site
<a href="https://agentmods.dev/rules/metamask/metamask-connect-cursor-plugin/evm-chain-id-format"><img src="https://agentmods.dev/badge/rules/metamask/metamask-connect-cursor-plugin/evm-chain-id-format/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for evm-chain-id-format

Your own site · 80×15
<a href="https://agentmods.dev/rules/metamask/metamask-connect-cursor-plugin/evm-chain-id-format"><img src="https://agentmods.dev/badge/rules/metamask/metamask-connect-cursor-plugin/evm-chain-id-format.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 1,377 This file is loaded in full into every session.
When invoked 1,377 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.01377 $0.01377
Opus 5.5 $0.00551 $0.00551
Sonnet 5.5 $0.00275 $0.00275
Haiku 4.5 $0.00138 $0.00138

Measured 3mo ago against content hash af66d3ca14ad, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

evm-chain-id-format scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

rules/evm-chain-id-format.mdc · 65 lines

How it starts

The opening of the file, as written. The whole thing — 65 lines — stays where its author put it; the contents beside it link to each section on GitHub.

EVM Chain ID Format

Hex String Requirement

  • Chain IDs in MetaMask Connect must always be hex strings: '0x1' not 1 or '1'
  • All chainIds arrays, supportedNetworks keys, and switchChain parameters expect hex format
  • Passing a number or decimal string will cause silent failures or runtime errors
  • Use '0x' + chainId.toString(16) to convert from decimal to hex

Common Chain IDs

Network Decimal Hex CAIP-2 Scope
Ethereum Mainnet 1 0x1 eip155:1
Sepolia 11155111 0xaa36a7 eip155:11155111
Polygon 137 0x89 eip155:137
Arbitrum One 42161 0xa4b1 eip155:42161
Optimism 10 0xa eip155:10
Base 8453 0x2105 eip155:8453
Avalanche C-Chain 43114 0xa86a eip155:43114
BNB Smart Chain 56 0x38 eip155:56
Celo 42220 0xa4ec eip155:42220
Linea 59144 0xe708 eip155:59144

CAIP-2 Conversion

  • EVM CAIP-2 format is eip155:<decimal-chainId> — always uses decimal, not hex
  • EVM RPC / EIP-1193 format uses hex strings (0x1)
  • Multichain invokeMethod scope uses CAIP-2 (eip155:1)
  • EVM client connect({ chainIds }) uses hex strings (['0x1'])
  • Convert: hex 0x89 → decimal 137 → CAIP-2 eip155:137

Auto-Included Chain

  • 0x1 (Ethereum mainnet) is automatically included in the EVM client's connect() permission request even if you don't pass it in chainIds
  • It is not injected into api.supportedNetworks — that map must explicitly contain every chain you use (including mainnet), and createEVMClient throws if it is empty
  • All chains need valid RPC URLs in supportedNetworks
  • If you use Infura RPC URLs, make sure the needed chains are enabled for your Infura project/API key

Wagmi Connector

  • The wagmi MetaMask connector is imported from wagmi/connectors: import { metaMask } from 'wagmi/connectors' — it requires @metamask/connect-evm as a peer dependency
  • Use getInfuraRpcUrls({ infuraApiKey: 'API_KEY', chainIds?: Hex[] }) from @metamask/connect-evm to populate supportedNetworks — returns a hex-chain-ID-keyed map of Infura RPC URLs (e.g. { '0x1': 'https://...', '0x89': 'https://...' }); chainIds is optional and filters to specific hex chain IDs
  • The multichain equivalent in @metamask/connect-multichain is getInfuraRpcUrls({ infuraApiKey: 'API_KEY', caipChainIds?: string[] }) — returns a CAIP-2-keyed map (e.g. { 'eip155:1': 'https://...' }) and accepts CAIP-2 IDs for filtering

Read the full file on GitHub · 65 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3mo ago First seen · 65 lines · 1,377 tokens per session scan A af66d3ca14ad

Subscribe to this mod's changes

evm-chain-id-format is a cursor rule published in the GitHub repository MetaMask/metamask-connect-cursor-plugin (2 stars, last pushed 2mo ago), licensed MIT. It adds 1,377 tokens to every session, about $0.0055 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

evm-chain-id-format compared with cursor rules from other repositories

evm-chain-id-format next to 6 cursor rules from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
evm-chain-id-formatMetaMask/metamask-connect-cursor-pluginCursor rule22mo agoMITA1,377Cursor
cardano-mcpJimmyh-world/Cardano_MCPCursor rule11y agoMITA3,030Cursor
solana_core_architectureAIFlowML/cursor_rulesCursor rule241y agononeA4Cursor
elizaos_v2_onchain_pluginsAIFlowML/cursor_rulesCursor rule241y agononeA0Cursor
tactton-ai-core/contract-knowledgeCursor rule171y agononeA614Cursor
stacks-developmentMcsavvy/stacks-next-template-chainhooks-with-dbCursor rule411mo agononeA7Cursor
solana_monitoring_analyticsDatai-Network/datai-mcp-serverCursor rule31y agononeA13Cursor