infura-mcp-server
Version:
Model Context Protocol (MCP) server providing comprehensive read-only Ethereum blockchain access through Infura's infrastructure. Connect Claude Desktop, VS Code, and Cursor to 29 secure Ethereum JSON-RPC tools across 30+ networks including Ethereum, Poly
39 lines (36 loc) • 1.07 kB
JavaScript
import { callInfura } from "../lib/infura-client.js";
/**
* Function to get the Ethereum chain ID from Infura.
* @param {object} args The arguments for the function.
* @param {string} [args.network="mainnet"] The network to query.
* @returns {Promise<Object>} - The result containing the chain ID in hexadecimal.
*/
const executeFunction = async ({ network = "mainnet" }) => {
return callInfura("eth_chainId", [], network);
};
/**
* Tool configuration for getting the Ethereum chain ID from Infura.
* @type {Object}
*/
const apiTool = {
function: executeFunction,
definition: {
type: "function",
function: {
name: "eth_chainId",
description: "Get the Ethereum chain ID from a specified Infura network.",
parameters: {
type: "object",
properties: {
network: {
type: "string",
description: "The Ethereum network to query, e.g., 'mainnet' or 'sepolia'.",
default: "mainnet",
},
},
required: [],
},
},
},
};
export { apiTool };