Create a reusable service configuration that points to the MCP server and standardizes how you pass arguments and read results. This lets your agent easily interact with the Filestore tools in a consistent manner.
Create a client using an ATXP account by importing the ATXP client SDK and other dependencies.
// Import the ATXP client SDKimport { atxpClient, ATXPAccount } from '@atxp/client';// Read the ATXP account details from environment variablesconst atxpConnectionString = process.env.ATXP_CONNECTION;// Create a client using the `atxpClient` functionconst client = await atxpClient({ mcpServer: filestoreService.mcpServer, account: new ATXPAccount(atxpConnectionString),});
Create a client using a Base account by importing the ATXP client SDK and other dependencies.
// Import the ATXP client SDK and Base accountimport { atxpClient } from '@atxp/client';import { BaseAccount } from '@atxp/base';// Read the Base account details from the environment variablesconst baseRpcUrl = process.env.BASE_RPC_URL;const basePrivateKey = process.env.BASE_PRIVATE_KEY;// Create a client using the `atxpClient` functionconst client = await atxpClient({ mcpServer: filestoreService.mcpServer, account: new BaseAccount(baseRpcUrl, basePrivateKey),});
Create a client using a Solana account by importing the ATXP client SDK and other dependencies.
// Import the ATXP client SDK and Solana accountimport { atxpClient } from '@atxp/client';import { SolanaAccount } from '@atxp/solana';// Read the Solana account details from the environment variablesconst solanaRpcUrl = process.env.SOLANA_RPC_URL;const solanaPrivateKey = process.env.SOLANA_PRIVATE_KEY;// Create a client using the `atxpClient` functionconst client = await atxpClient({ mcpServer: filestoreService.mcpServer, account: new SolanaAccount(solanaRpcUrl, solanaPrivateKey),});
Create a client using a Worldchain account with MiniKit integration.
// Import the ATXP client SDK and Worldchain account creatorimport { atxpClient } from '@atxp/client';import { createMiniKitWorldchainAccount } from '@atxp/worldchain';import { MiniKit } from '@worldcoin/minikit-js';// Create a Worldchain account using MiniKitconst account = await createMiniKitWorldchainAccount({ walletAddress: '0x1234...', // User's wallet address miniKit: MiniKit});// Create a client using the `atxpClient` functionconst client = await atxpClient({ mcpServer: filestoreService.mcpServer, account,});
Browser applications:
// Import the ATXP client SDK and Polygon browser accountimport { atxpClient } from '@atxp/client';import { PolygonBrowserAccount } from '@atxp/polygon';// Initialize the Polygon browser account with wallet providerconst account = await PolygonBrowserAccount.initialize({ provider: window.ethereum, // or any EIP-1193 provider walletAddress: '0x1234...', // User's wallet address});// Create a client using the `atxpClient` functionconst client = await atxpClient({ mcpServer: filestoreService.mcpServer, account,});
Server/CLI applications:
// Import the ATXP client SDK and Polygon server accountimport { atxpClient } from '@atxp/client';import { PolygonServerAccount } from '@atxp/polygon';// Read the Polygon account details from the environment variablesconst polygonRpcUrl = process.env.POLYGON_RPC_URL;const polygonPrivateKey = process.env.POLYGON_PRIVATE_KEY;// Create a Polygon server accountconst account = new PolygonServerAccount( polygonRpcUrl, polygonPrivateKey, 137 // Chain ID: 137 = Polygon mainnet, 80002 = Amoy testnet);// Create a client using the `atxpClient` functionconst client = await atxpClient({ mcpServer: filestoreService.mcpServer, account,});
3
Use the Filestore service in your agent
Call the Filestore tool by passing your natural-language instruction as the argument the getArguments method.Read the response using the getResult method.