MCP AI Agent

v1.0.0Coding Agentsstable

A TypeScript library that enables AI agents to leverage MCP (Model Context Protocol) servers for enhanced capabilities. This library integrates with the AI SDK to provide a seamless way to connect to MCP servers and use their tools in AI-powered appl

agentic-aiai-agentautogencrewaimcp-client
Share:
21
Stars
0
Downloads
0
Weekly
0/5

What is MCP AI Agent?

MCP AI Agent is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to typescript library that enables ai agents to leverage mcp (model context protocol) servers for enhanced capabilities. this library integrates with the ai sdk to provide a seamless way to connect to mc...

A TypeScript library that enables AI agents to leverage MCP (Model Context Protocol) servers for enhanced capabilities. This library integrates with the AI SDK to provide a seamless way to connect to MCP servers and use their tools in AI-powered appl

This server falls under the Coding Agents category on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • A TypeScript library that enables AI agents to leverage MCP

Use Cases

Enable AI agents to leverage MCP tools with autogen and CrewAI.
Integrate MCP servers seamlessly with the AI SDK for tool calling.
fkesheh

Maintainer

LicenseMIT
Languagetypescript
Versionv1.0.0
UpdatedMay 15, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx mcp-ai-agent

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

How to Set Up and Use MCP AI Agent

MCP AI Agent is a TypeScript library that lets you build AI agents that transparently connect to any MCP server and use its tools as native capabilities — integrating with AI SDK v5 for text generation and tool calling. It supports multiple transport methods (STDIO and SSE), multi-agent composition where specialized agents can call each other, custom tool definitions alongside MCP tools, and a CrewAI-style workflow pattern. Developers building agentic applications use it to wire together MCP servers and LLMs without managing the underlying protocol plumbing.

Prerequisites

  • Node.js 18 or higher
  • An npm project with TypeScript support
  • API keys for the LLM provider you want to use (e.g. OPENAI_API_KEY for OpenAI models via @ai-sdk/openai, or equivalent for Anthropic/other providers)
  • At least one MCP server to connect to (e.g. @modelcontextprotocol/server-memory, or any other MCP server)
1

Install the library

Install mcp-ai-agent and an AI SDK provider package in your Node.js project.

npm install mcp-ai-agent
npm install @ai-sdk/openai  # or @ai-sdk/anthropic, etc.
2

Create a basic agent with a preconfigured MCP server

Import AIAgent and use one of the preconfigured Servers or define your own MCP server config. The agent auto-initializes — no explicit initialize() call needed.

import { AIAgent, Servers } from "mcp-ai-agent";
import { openai } from "@ai-sdk/openai";

const agent = new AIAgent({
  name: "My Agent",
  description: "An agent with sequential thinking",
  model: openai("gpt-4o-mini"),
  toolsConfigs: [Servers.sequentialThinking],
});

const response = await agent.generateResponse({
  prompt: "Break down the steps to build a REST API",
});
console.log(response.text);
3

Define a custom MCP server connection

You can connect to any MCP server by providing its command and args directly in toolsConfigs, just like a standard MCP client configuration.

import { AIAgent } from "mcp-ai-agent";
import { openai } from "@ai-sdk/openai";

const agent = new AIAgent({
  name: "Memory Agent",
  description: "Stores and retrieves memories",
  model: openai("gpt-4o-mini"),
  toolsConfigs: [
    {
      mcpServers: {
        memory: {
          command: "npx",
          args: ["-y", "@modelcontextprotocol/server-memory"],
        },
      },
    },
  ],
});
4

Compose multi-agent workflows

Create specialized agents and compose them under a master agent that can delegate tasks. Each sub-agent becomes a callable tool for the master agent.

import { AIAgent, Servers } from "mcp-ai-agent";
import { openai } from "@ai-sdk/openai";

const searchAgent = new AIAgent({
  name: "Search Agent",
  description: "Searches the web for information",
  model: openai("gpt-4o-mini"),
  toolsConfigs: [Servers.braveSearch],
});

const masterAgent = new AIAgent({
  name: "Master Agent",
  description: "Orchestrates specialized agents",
  model: openai("gpt-4o"),
  toolsConfigs: [{ type: "agent", agent: searchAgent }],
});
5

Set your LLM provider API key and run

Export your API key as an environment variable and run your agent script.

export OPENAI_API_KEY=sk-...
node --loader ts-node/esm your_agent.ts

MCP AI Agent Examples

Client configuration

This is a library, not a standalone server. The equivalent config shows how to reference a custom MCP server within the library's toolsConfigs.

{
  "toolsConfigs": [
    {
      "mcpServers": {
        "memory": {
          "command": "npx",
          "args": ["-y", "@modelcontextprotocol/server-memory"]
        }
      }
    }
  ]
}

Prompts to try

Example prompts you can pass to agent.generateResponse() in your application code.

- "What is the latest Bitcoin price? Store the answer in memory."
- "What information have we stored about Bitcoin price?"
- "Break down the Website project requirements into tasks and estimate time for each"
- "Search the web for the current status of the Node.js v22 LTS release"
- "Use sequential thinking to solve: I have 3 apples, give away 2, buy 5 more. How many do I have?"

Troubleshooting MCP AI Agent

Agent throws 'Cannot find module mcp-ai-agent' or TypeScript import errors

Run 'npm install mcp-ai-agent' to ensure the package is installed. For TypeScript, ensure your tsconfig.json has 'moduleResolution' set to 'bundler' or 'node16' and 'module' set to 'ESNext' or 'NodeNext'. Check the mcp-ai-agent-example repo for a working tsconfig reference.

MCP server subprocess fails to start inside the agent

The command specified in mcpServers (e.g. 'npx') must be available in the PATH of the Node.js process running your agent. Test the command manually in your terminal first. For STDIO transport, the MCP server must read from stdin and write to stdout in JSON-RPC format.

Multi-agent workflow: sub-agent is never called by the master agent

Ensure the sub-agent has a clear 'description' field — the master agent's LLM uses this to decide when to delegate. Also confirm the master agent's model is powerful enough for tool orchestration (gpt-4o or equivalent is recommended over gpt-4o-mini for routing decisions).

Frequently Asked Questions about MCP AI Agent

What is MCP AI Agent?

MCP AI Agent is a Model Context Protocol (MCP) server that typescript library that enables ai agents to leverage mcp (model context protocol) servers for enhanced capabilities. this library integrates with the ai sdk to provide a seamless way to connect to mcp servers and use their tools in ai-powered appl It connects AI assistants to external tools and data sources through a standardized interface.

How do I install MCP AI Agent?

Follow the installation instructions on the MCP AI Agent GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.

Which AI clients work with MCP AI Agent?

MCP AI Agent works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is MCP AI Agent free to use?

Yes, MCP AI Agent is open source and available under the MIT license. You can use it freely in both personal and commercial projects.

Browse More Coding Agents MCP Servers

Explore all coding agents servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.

Quick Config Preview

{ "mcpServers": { "mcp-ai-agent": { "command": "npx", "args": ["-y", "mcp-ai-agent"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

Ready to use MCP AI Agent?

Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.

33,000+ ServersFree & Open SourceStep-by-Step Guides