get_rpc_proxy_url
Retrieve an EVM RPC proxy URL for a specific wallet and blockchain chain ID to use with development tools like Forge, Hardhat, ethers.js, or viem.
Instructions
Get the EVM RPC proxy URL for a wallet and chain. Use this URL as --rpc-url for Forge, Hardhat, ethers.js, or viem.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| wallet_id | Yes | Wallet ID (UUID) | |
| chain_id | Yes | EVM chain ID (e.g. 1 for Ethereum mainnet, 137 for Polygon) |
Implementation Reference
- The handler function that executes the logic to fetch and construct the RPC proxy URL.
async (args) => { const result = await apiClient.get('/v1/connect-info'); if (!('ok' in result) || !result.ok) { return toToolResult(result); } const data = result.data as ConnectInfoData; if (!data.rpcProxy?.enabled || !data.rpcProxy?.baseUrl) { return { content: [{ type: 'text' as const, text: JSON.stringify({ error: 'RPC proxy is not enabled. Ask the operator to enable it in Admin Settings.', }), }], isError: true, }; } const url = `${data.rpcProxy.baseUrl}/${args.wallet_id}/${args.chain_id}`; return { content: [{ type: 'text' as const, text: JSON.stringify({ url, walletId: args.wallet_id, chainId: args.chain_id, usage: `Use this URL as --rpc-url: ${url}`, }), }], }; }, - packages/mcp/src/tools/get-rpc-proxy-url.ts:17-65 (registration)The registration function for the 'get_rpc_proxy_url' tool.
export function registerGetRpcProxyUrl( server: McpServer, apiClient: ApiClient, walletContext?: WalletContext, ): void { server.tool( 'get_rpc_proxy_url', withWalletPrefix( 'Get the EVM RPC proxy URL for a wallet and chain. Use this URL as --rpc-url for Forge, Hardhat, ethers.js, or viem.', walletContext?.walletName, ), { wallet_id: z.string().describe('Wallet ID (UUID)'), chain_id: z.number().describe('EVM chain ID (e.g. 1 for Ethereum mainnet, 137 for Polygon)'), }, async (args) => { const result = await apiClient.get('/v1/connect-info'); if (!('ok' in result) || !result.ok) { return toToolResult(result); } const data = result.data as ConnectInfoData; if (!data.rpcProxy?.enabled || !data.rpcProxy?.baseUrl) { return { content: [{ type: 'text' as const, text: JSON.stringify({ error: 'RPC proxy is not enabled. Ask the operator to enable it in Admin Settings.', }), }], isError: true, }; } const url = `${data.rpcProxy.baseUrl}/${args.wallet_id}/${args.chain_id}`; return { content: [{ type: 'text' as const, text: JSON.stringify({ url, walletId: args.wallet_id, chainId: args.chain_id, usage: `Use this URL as --rpc-url: ${url}`, }), }], }; }, ); } - Input schema definition for the 'get_rpc_proxy_url' tool.
{ wallet_id: z.string().describe('Wallet ID (UUID)'), chain_id: z.number().describe('EVM chain ID (e.g. 1 for Ethereum mainnet, 137 for Polygon)'), },