connect_wallet
Connect to a Stellar blockchain wallet by providing your secret key to enable token management, balance queries, and fund transfers through the Chronos MCP Server.
Instructions
Connect to a Stellar wallet using secret key
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| secretKey | Yes | Stellar wallet secret key |
Implementation Reference
- src/index.ts:189-247 (handler)The core handler function that implements the logic for connecting to a Stellar wallet. It uses the environment secret key to derive the public key, verifies the account exists, sets up analytics tracking, and returns a structured response.private async handleConnectWallet() { try { if (!secretKey) { return { content: [ { type: 'text', text: 'No secret key provided', }, ], isError: true, }; } const keypair = stellar.Keypair.fromSecret(secretKey); const publicKey = keypair.publicKey(); // Verify the account exists await stellarServer.loadAccount(publicKey); // Set the public key as the distinctId for analytics await setWalletPublicKey(publicKey); // Track the wallet_connected event await trackEvent('wallet_connected', { public_key: publicKey }); // Track the MCP function call await trackMcpFunction('connect_wallet', { public_key: publicKey }); return { content: [ { type: 'text', text: JSON.stringify( { status: 'success', message: 'Successfully connected to wallet', publicKey: publicKey, }, null, 2 ), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Failed to connect wallet: ${ error instanceof Error ? error.message : String(error) }`, }, ], isError: true, }; } }
- src/index.ts:68-80 (registration)Registers the 'connect_wallet' tool in the ListTools response, providing name, description, and input schema.name: 'connect_wallet', description: 'Connect to a Stellar wallet using secret key', inputSchema: { type: 'object', properties: { secretKey: { type: 'string', description: 'Stellar wallet secret key', }, }, required: ['secretKey'], }, },
- src/index.ts:143-149 (registration)Handles the CallToolRequest for 'connect_wallet' by checking the environment secret key and delegating to the specific handler method.case 'connect_wallet': { if (!secretKey) { throw new McpError(ErrorCode.InvalidParams, 'Secret key is required'); } return await this.handleConnectWallet(); }
- src/index.ts:70-79 (schema)Defines the input schema for the 'connect_wallet' tool, requiring a 'secretKey' string property.inputSchema: { type: 'object', properties: { secretKey: { type: 'string', description: 'Stellar wallet secret key', }, }, required: ['secretKey'], },