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
56 lines (53 loc) • 1.65 kB
JavaScript
import { callInfura } from "../lib/infura-client.js";
/**
* Function to get the transaction count for a specified Ethereum address.
*
* @param {Object} args - Arguments for the transaction count request.
* @param {string} args.address - The Ethereum address to query.
* @param {string} [args.tag="latest"] - The block tag to use for the query.
* @param {string} [args.network="mainnet"] The network to query.
* @returns {Promise<Object>} - The transaction count for the specified address.
*/
const executeFunction = async ({
address,
tag = "latest",
network = "mainnet",
}) => {
return callInfura("eth_getTransactionCount", [address, tag], network);
};
/**
* Tool configuration for getting the transaction count on Ethereum.
* @type {Object}
*/
const apiTool = {
function: executeFunction,
definition: {
type: "function",
function: {
name: "eth_getTransactionCount",
description:
"Get the transaction count for a specified Ethereum address on a given network.",
parameters: {
type: "object",
properties: {
address: {
type: "string",
description: "The Ethereum address to query.",
},
tag: {
type: "string",
enum: ["latest", "earliest", "pending"],
description: "The block tag to use for the query.",
},
network: {
type: "string",
description: "The Ethereum network to query, e.g., 'mainnet' or 'sepolia'.",
default: "mainnet",
},
},
required: ["address"],
},
},
},
};
export { apiTool };