Skip to main content

What is the MCP Server?

@gizatech/mcp-server exposes the Giza Agent SDK as tools that any LLM can call through the Model Context Protocol (MCP). Instead of writing TypeScript to interact with the SDK, an LLM like Claude or GPT calls tools directly — creating smart accounts, activating agents, checking portfolios, and running optimizations through natural language. The server ships as both a library (import and customize in your own code) and a CLI (run directly via npx).

Architecture

The MCP server sits between the LLM client and the Giza SDK. It:
  1. Receives tool calls from the LLM over stdio or HTTP transport
  2. Validates inputs using Zod schemas
  3. Delegates to the Giza SDK
  4. Returns structured results the LLM can interpret and present to the user

Supported Clients

The MCP server works with any client that implements the Model Context Protocol:
ClientTransportSetup
Claude DesktopstdioQuickstart
CursorstdioQuickstart
Claude CodestdioQuickstart
Custom backendHTTPTransport
Any MCP clientstdio or HTTPProgrammatic Usage

How It Works

Wallet Session Model

The MCP server uses a connect-then-operate pattern. Before calling any agent-specific tool (portfolio, lifecycle, financial), the LLM must first connect a wallet address to the session:
User: "Check my portfolio for 0x742d...f44e"

LLM calls: connect_wallet({ wallet: "0x742d...f44e" })
LLM calls: get_portfolio()  ← wallet is resolved from session
This avoids the LLM having to pass the wallet address on every tool call. The session stores one wallet at a time, and all subsequent tool calls use it automatically.

Error Handling

All tool errors are caught and converted to messages the LLM can work with. No raw stack traces — just actionable text like:
  • "No wallet connected. Use connect_wallet first to set your wallet address for this session."
  • "Validation error: Invalid Ethereum address"
  • "Request timed out. Please try again."
This lets the LLM communicate failures and recover (e.g., by calling connect_wallet when it gets a wallet-not-connected error).

What’s Included

The server registers 22 tools across 8 groups:
GroupToolsWallet Required
Walletconnect_wallet, disconnect_walletNo
Accountcreate_smart_account, get_smart_accountNo
Protocolget_protocols, get_tokens, get_stats, get_tvlNo
Lifecycleactivate_agent, deactivate_agent, top_up, run_agentYes
Portfolioget_portfolio, get_performance, get_apr, get_depositsYes
Financialwithdraw, get_withdrawal_status, get_transactions, get_feesYes
Rewardsclaim_rewardsYes
OptimizeroptimizeNo

Next Steps