Skip to main content
Glama

bnbchain-mcp

Official
by bnb-chain
account.ts1.49 kB
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js" import type { Hex } from "viem" import { z } from "zod" import * as services from "@/gnfd/services" import { getAddressFromPrivateKey } from "@/gnfd/services" import { mcpToolRes } from "@/utils/helper" import { networkParam, privateKeyParam } from "./common" export function registerAccountTools(server: McpServer) { // Get account balance server.tool( "gnfd_get_account_balance", "Get the balance for an account", { network: networkParam, address: z .string() .optional() .describe("The address of the account to get balance for"), privateKey: privateKeyParam }, async ({ network, address, privateKey }) => { try { const balance = await services.getAccountBalance(network, { address: address || getAddressFromPrivateKey(privateKey as Hex) }) return mcpToolRes.success(balance) } catch (error) { return mcpToolRes.error(error, "fetching account balance") } } ) // Get all storage providers server.tool( "gnfd_get_all_sps", "Get a list of all storage providers in the Greenfield network", { network: networkParam }, async ({ network }) => { try { const sps = await services.getAllSps(network) return mcpToolRes.success(sps) } catch (error) { return mcpToolRes.error(error, "fetching storage providers") } } ) }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/bnb-chain/bnbchain-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server