UNPKG

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

46 lines (43 loc) 1.43 kB
import { callInfura } from "../lib/infura-client.js"; /** * Function to get transaction information by transaction hash from Infura. * * @param {Object} args - Arguments for the transaction query. * @param {string} args.transactionHash - The 32-byte transaction hash to query. * @param {string} [args.network="mainnet"] The network to query. * @returns {Promise<Object>} - The transaction information or null if not found. */ const executeFunction = async ({ transactionHash, network = "mainnet" }) => { return callInfura("eth_getTransactionByHash", [transactionHash], network); }; /** * Tool configuration for getting transaction information by hash from Infura. * @type {Object} */ const apiTool = { function: executeFunction, definition: { type: "function", function: { name: "eth_getTransactionByHash", description: "Get transaction information by transaction hash from a specified Infura network.", parameters: { type: "object", properties: { transactionHash: { type: "string", description: "The 32-byte transaction hash to query.", }, network: { type: "string", description: "The Ethereum network to query, e.g., 'mainnet' or 'sepolia'.", default: "mainnet", }, }, required: ["transactionHash"], }, }, }, }; export { apiTool };