connect_wallet
Connect to a Stellar wallet securely by providing the secret key, enabling access to blockchain features like balance queries and fund transfers via 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)Executes the connect_wallet tool: derives public key from env secret, verifies account on Stellar network, sets analytics tracking, and returns JSON success or error 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:67-80 (registration)Registers the connect_wallet tool in the ListTools handler with name, description, and input schema (note: code uses env secretKey, not arg).{ 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)Dispatches connect_wallet tool calls in the CallToolRequestSchema handler by invoking the private handleConnectWallet 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 connect_wallet tool expecting a secretKey parameter.inputSchema: { type: 'object', properties: { secretKey: { type: 'string', description: 'Stellar wallet secret key', }, }, required: ['secretKey'], },