TypeScriptADK-TS

MCP Servers

Connect ADK-TS agents to IQ AI's built-in MCP servers and any external MCP server from the ecosystem

ADK-TS provides comprehensive support for the Model Context Protocol (MCP), an open standard for connecting AI agents with external systems, data sources, and services. You can use IQ AI's pre-built MCP servers for blockchain, DeFi, and AI operations, integrate any external MCP server from the ecosystem (Anthropic's official servers, community servers, etc.), or create your own custom MCP servers.

Three Ways to Use MCP with ADK-TS

  1. IQ AI Built-in Servers - Use our pre-built MCP servers with convenient wrapper functions
  2. External MCP Servers - Connect to any MCP server from the ecosystem using McpToolset
  3. Custom MCP Servers - Build and deploy your own MCP servers with our FastMCP template

IQ AI's Built-in MCP Servers

IQ AI has developed a comprehensive collection of specialized MCP servers for blockchain, DeFi, messaging, and AI operations. These servers provide seamless integration with various external services and come with convenient wrapper functions for quick setup.

Available Categories:

  • Blockchain & DeFi: ABI, ATP, BAMM, Fraxlend, NEAR Agent, NEAR Intents, ODOS
  • Market Data: CoinGecko, CoinGecko Pro, DeBank, DefiLlama, Upbit
  • Prediction Markets: Kalshi, Limitless, Opinion, Polymarket
  • Messaging & Social: Discord, Telegram
  • Information: IQWiki

View all IQ AI MCP servers →

IQ AI's Third-Party MCP Wrappers

ADK-TS also provides convenience wrappers for popular third-party MCP servers:

  • Utilities: Filesystem, Memory

View all third-party wrappers →

Working with MCP Servers

Getting Started

ADK-TS makes it easy to work with MCP servers through three approaches:

1. Using IQ AI's Built-in MCP Servers

For IQ AI's pre-built servers, use convenient wrapper functions that handle all configuration automatically:

import { McpAtp } from "@iqai/adk";

// Simple wrapper function setup
const toolset = McpAtp({
  env: {
    ATP_WALLET_PRIVATE_KEY: process.env.WALLET_PRIVATE_KEY,
    ATP_API_KEY: process.env.ATP_API_KEY,
  },
});

const tools = await toolset.getTools();

2. Integrating External MCP Servers

Connect to any MCP server from the ecosystem (Anthropic's official servers, community servers, etc.) using McpToolset:

import { McpToolset } from "@iqai/adk";

// Connect to Anthropic's filesystem server
const toolset = new McpToolset({
  name: "Filesystem MCP",
  description: "Local file system operations",
  transport: {
    mode: "stdio",
    command: "npx",
    args: ["-y", "@modelcontextprotocol/server-filesystem", "/allowed/path"],
    env: { PATH: process.env.PATH || "" },
  },
});

const tools = await toolset.getTools();

3. Creating Custom MCP Servers

Build your own MCP servers with our FastMCP starter template:

# Create new MCP server project
adk new --template mcp-starter my-weather-server
cd my-weather-server
pnpm install

Learn more in the Creating Custom MCPs guide.

Prerequisites

Make sure you have the basic MCP integration set up in your ADK-TS project. See the MCP Tools section for detailed integration guidance.

Integration Example

Here's how to connect to IQ AI's MCP servers using ADK-TS:

For supported MCP servers, use the convenient wrapper functions:

import { McpAtp, AgentBuilder } from "@iqai/adk";

// Create ATP toolset with wrapper function
const toolset = McpAtp({
  env: {
    ATP_WALLET_PRIVATE_KEY: process.env.WALLET_PRIVATE_KEY,
    ATP_API_KEY: process.env.ATP_API_KEY,
  },
  debug: false,
  retryOptions: {
    maxRetries: 2,
    initialDelay: 200,
  },
});

// Get available tools
const mcpTools = await toolset.getTools();

// Create agent with MCP tools using AgentBuilder
const { runner } = await AgentBuilder.create("mcp_assistant_agent")
  .withModel("gemini-2.5-flash")
  .withDescription("An assistant with MCP server capabilities")
  .withTools(...mcpTools)
  .build();

// Use the agent
const response = await runner.ask("Get ATP statistics for contract 0x123...");

You can find all the wrapper mcp servers in the framework from here

Using McpToolset (For External MCP Servers)

When connecting to external MCP servers from the ecosystem (like Anthropic's official servers, community servers, or third-party MCP implementations), use the McpToolset class:

import { McpToolset, AgentBuilder, type McpConfig } from "@iqai/adk";

// Configure MCP connection for an external server (e.g., Anthropic's filesystem server)
const mcpConfig: McpConfig = {
  name: "Filesystem MCP Client",
  description: "Client for Anthropic's filesystem MCP server",
  debug: false,
  retryOptions: {
    maxRetries: 2,
    initialDelay: 200,
  },
  transport: {
    mode: "stdio",
    command: "npx",
    args: ["-y", "@modelcontextprotocol/server-filesystem", "/workspace"],
    env: {
      PATH: process.env.PATH || "",
    },
  },
};

// Initialize toolset
const toolset = new McpToolset(mcpConfig);

// Get available tools
const mcpTools = await toolset.getTools();

// Create agent with MCP tools
const { runner } = await AgentBuilder.create("filesystem_assistant_agent")
  .withModel("gemini-2.5-flash")
  .withDescription("An assistant with filesystem access via MCP")
  .withTools(...mcpTools)
  .build();

See the Integrating External MCPs guide for more examples of connecting to Anthropic's official servers and community MCP servers.

Multiple MCP Servers

You can connect to multiple MCP servers simultaneously, mixing IQ AI's built-in servers with external servers:

import { McpAtp, McpFraxlend, McpNearAgent, AgentBuilder } from "@iqai/adk";

// Connect to multiple servers with wrapper functions
const atpToolset = McpAtp({
  env: {
    ATP_WALLET_PRIVATE_KEY: process.env.WALLET_PRIVATE_KEY,
    ATP_API_KEY: process.env.ATP_API_KEY,
  },
});

const fraxlendToolset = McpFraxlend({
  env: {
    WALLET_PRIVATE_KEY: process.env.WALLET_PRIVATE_KEY,
  },
});

const nearToolset = McpNearAgent({
  env: {
    ACCOUNT_ID: process.env.NEAR_ACCOUNT_ID,
    ACCOUNT_KEY: process.env.NEAR_ACCOUNT_KEY,
    NEAR_NETWORK_ID: "testnet",
  },
});

// Combine tools from multiple servers
const atpTools = await atpToolset.getTools();
const fraxlendTools = await fraxlendToolset.getTools();
const nearTools = await nearToolset.getTools();
const allTools = [...atpTools, ...fraxlendTools, ...nearTools];

// Create agent with combined tools
const { runner } = await AgentBuilder.create("multi_mcp_assistant_agent")
  .withModel("gemini-2.5-flash")
  .withDescription("An assistant with multiple MCP server capabilities")
  .withTools(...allTools)
  .build();

Mixed Approach (Built-in + External Servers)

Combine IQ AI's wrapper functions with McpToolset for external servers:

import { McpAtp, McpToolset, AgentBuilder } from "@iqai/adk";

// Use wrapper for IQ AI's built-in server
const atpToolset = McpAtp({
  env: {
    ATP_WALLET_PRIVATE_KEY: process.env.WALLET_PRIVATE_KEY,
    ATP_API_KEY: process.env.ATP_API_KEY,
  },
});

// Use McpToolset for external server (e.g., Anthropic's Brave Search)
const braveSearchToolset = new McpToolset({
  name: "Brave Search",
  description: "Web search via Brave Search MCP server",
  transport: {
    mode: "stdio",
    command: "npx",
    args: ["-y", "@modelcontextprotocol/server-brave-search"],
    env: {
      BRAVE_API_KEY: process.env.BRAVE_API_KEY || "",
      PATH: process.env.PATH || "",
    },
  },
});

// Combine tools from both approaches
const atpTools = await atpToolset.getTools();
const braveTools = await braveSearchToolset.getTools();
const allTools = [...atpTools, ...braveTools];

// Create agent with combined tools
const { runner } = await AgentBuilder.create("mixed_assistant_agent")
  .withModel("gemini-2.5-flash")
  .withDescription("An assistant with blockchain and web search capabilities")
  .withTools(...allTools)
  .build();

Resource Cleanup

Always clean up MCP resources when done:

try {
  // Use your agent and tools
  const response = await runner.ask("Get ATP statistics for contract 0x123...");
} finally {
  // Clean up resources
  await toolset.close();
}

Integration with ADK-TS

All MCP servers (both IQ AI's built-in servers and external servers) work seamlessly with ADK-TS through:

  • Wrapper functions like McpAtp(), McpNearAgent(), etc. for IQ AI's built-in servers
  • McpToolset class for connecting to any external MCP server from the ecosystem

Both approaches provide:

  • Automatic tool discovery and registration
  • Type-safe tool usage
  • Error handling and retry logic
  • Resource management and cleanup

Support and Documentation

Each IQ AI MCP server includes comprehensive documentation covering:

  • Installation and setup instructions
  • Configuration options (both wrapper functions and McpToolset syntax)
  • Available tools and their parameters
  • Usage examples and best practices
  • Troubleshooting and common issues

For external MCP servers, refer to:

For creating your own MCP servers: