wallet_from_private_key
Generate a wallet for Ethereum and EVM-compatible blockchains using a private key with the MCP Crypto Wallet EVM server. Enables wallet creation for blockchain operations.
Instructions
Create a wallet from a private key
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| privateKey | Yes | The private key |
Implementation Reference
- src/handlers/wallet.ts:61-79 (handler)The core handler function that implements the wallet_from_private_key tool logic using ethers.Wallet.export const fromPrivateKeyHandler = async (input: fromPrivateKeyHandlerInput): Promise<ToolResultSchema> => { try { if (!input.privateKey) { return createErrorResponse("Private key is required"); } const provider = getProvider() const wallet = new ethers.Wallet(input.privateKey, provider); return createSuccessResponse( `Wallet created from private key successfully: Address: ${wallet.address} Private Key: ${wallet.privateKey} Public Key: ${wallet.publicKey} `); } catch (error) { return createErrorResponse(`Failed to create wallet from private key: ${(error as Error).message}`); } };
- src/tools.ts:65-75 (schema)MCP tool schema definition with input validation for the privateKey parameter.{ name: "wallet_from_private_key", description: "Create a wallet from a private key", inputSchema: { type: "object", properties: { privateKey: { type: "string", description: "The private key" } }, required: ["privateKey"] } },
- src/tools.ts:561-561 (registration)Registration of the tool name to its handler function in the handlers dictionary."wallet_from_private_key": fromPrivateKeyHandler,
- src/handlers/wallet.types.ts:1-4 (schema)TypeScript type definition for the input parameters used in the handler.export type fromPrivateKeyHandlerInput = { privateKey: string; provider?: string; };