Skip to content
PluginStats

@ai-sdk/mcp weekly downloads statistics

By ai-sdk (3 listings) · npm · MCP servers

The **Model Context Protocol (MCP) client** for the [AI SDK](https://ai-sdk.dev/docs) lets you connect to MCP servers and use their tools with AI SDK functions like `generateText` and `streamText`.

View on npm Fresh · Oct 18, 2026

@ai-sdk/mcp has 3,134,474 recorded weekly downloads on npm, a decrease of 10.6% over the past 30 days, ranking #148 of 2,322 tracked listings.

Weekly downloads
3,134,474
Official API · Oct 18, 2026
7-day growth
-39.1%
-2M weekly downloads
30-day growth
-10.6%
-373.1K weekly downloads
90-day growth
+79.8%
+1.4M weekly downloads
Rank
#148
Among tracked npm listings

About @ai-sdk/mcp

AI SDK - Model Context Protocol Client

The Model Context Protocol (MCP) client for the AI SDK lets you connect to MCP servers and use their tools with AI SDK functions like generateText and streamText.

Setup

The MCP client is available in the @ai-sdk/mcp module. You can install it with

npm i @ai-sdk/mcp ai zod

Skill for Coding Agents

If you use coding agents such as Claude Code or Cursor, we highly recommend adding the AI SDK skill to your repository:

npx skills add vercel/ai

Usage

Create an MCP client with createMCPClient(), fetch the server tools with mcpClient.tools(), and pass them to an AI SDK call:

import { createMCPClient } from '@ai-sdk/mcp';
import { generateText, isStepCount } from 'ai';

const mcpClient = await createMCPClient({
  transport: {
    type: 'http',
    url: 'https://your-server.com/mcp',
    headers: {
      Authorization: `Bearer ${process.env.MCP_API_KEY}`,
    },
  },
});

try {
  const tools = await mcpClient.tools();

  const { text } = await generateText({
    model: 'openai/gpt-6-astra',
    tools,
    stopWhen: isStepCount(10),
    prompt: 'Use the available tools to answer the user question.',
  });

  console.log(text);
} finally {
  await mcpClient.close();
}

The client converts MCP tool definitions into AI SDK tools, so model calls can use them through the standard tools option.

Experimental webhook events

Use list, subscribe, refresh, and unsubscribe through client.experimental_events on the same createMCPClient instance. Configure experimental_events: { store } with private durable storage shared with experimental_createMCPEventWebhook, which you mount at your callback URL.

Subscription creation persists delivery.url and the generated signing secret before contacting the server, enabling signed callback verification during the subscribe request. The receiver verifies raw request bytes and checks event envelopes before invoking your handler. Optional callbacks let your application validate filters and event data. Agent execution and durable deduplication remain application concerns; closing the client does not unsubscribe.

See the MCP Events guide and the local server/client example.

Protocol versions

The client supports legacy MCP protocol versions through the initialize handshake and MCP 2026-07-28 through stateless protocol discovery. The built-in stdio transport probes with server/discover and falls back to the legacy handshake when connected to an older server.

Custom transports can opt into the same negotiation by setting supportsProtocolVersionDiscovery to true. Modern requests include the protocol version, client capabilities, and client information in _meta.

For streaming responses, close the MCP client when the stream finishes:

import { createMCPClient } from '@ai-sdk/mcp';
import { streamText } from 'ai';

const mcpClient = await createMCPClient({
  transport: {
    type: 'http',
    url: 'https://your-server.com/mcp',
  },
});

const result = streamText({
  model: 'openai/gpt-6-astra',
  tools: await mcpClient.tools(),
  prompt: 'Use the available tools to answer the user question.',
  onEnd: async () => {
    await mcpClient.close();
  },
});

for await (const textPart of result.textStream) {
  process.stdout.write(textPart);
}

Transports

HTTP is recommended for production deployments:

Session persistence applies only to legacy MCP protocol versions. MCP 2026-07-28 is stateless and does not use session ids or cached initialize results.

import { createMCPClient } from '@ai-sdk/mcp';

const savedSession = await loadMcpSession();
let currentSessionId = savedSession?.sessionId;

const mcpClient = await createMCPClient({
  transport: {
    type: 'http',
    url: 'https://your-server.com/mcp',
    initialSessionId: savedSession?.sessionId,
    initialProtocolVersion: savedSession?.initializeResult.protocolVersion,
    terminateSessionOnClose: false,
    onSessionIdChange: sessionId => {
      currentSessionId = sessionId;
    },
    onSessionExpired: sessionId => {
      if (currentSessionId === sessionId) {
        currentSessionId = undefined;
        void clearMcpSession();
      }
    },
  },
  initialInitializeResult: savedSession?.initializeResult,
});

if (currentSessionId) {
  await saveMcpSession({
    sessionId: currentSessionId,
    initializeResult: mcpClient.initializeResult,
  });
}

SSE is also supported for MCP servers that use Server-Sent Events:

const mcpClient = await createMCPClient({
  transport: {
    type: 'sse',
    url: 'https://your-server.com/sse',
  },
});

For local MCP servers, you can use stdio transport from the @ai-sdk/mcp/mcp-stdio subpath:

import { createMCPClient } from '@ai-sdk/mcp';
import { Experimental_StdioMCPTransport } from '@ai-sdk/mcp/mcp-stdio';

const mcpClient = await createMCPClient({
  transport: new Experimental_StdioMCPTransport({
    command: 'node',
    args: ['server.js'],
  }),
});

Documentation

Please check out the AI SDK MCP documentation for more information.

Managed backends can implement Experimental_MCPEventAdapter and configure experimental_events: { adapter } instead of a store. Its createAdapter() method receives { transport } metadata (HTTP/SSE type and URL, or { type: 'custom' } for custom transports) and returns Experimental_MCPEventOperations bound to the authorized account. Catalog discovery still uses the authenticated MCP transport; subscribe/get/list/unsubscribe delegate to the backend, which owns renewal and webhook delivery. Managed clients do not expose refresh(). See the managed subscription reference.

Description from the npm listing.

  • ai
  • mcp

README badge

Show your rank in a README or on your website. The badge updates automatically.

Charts

Images: 30d · 1y · all time · 1600×900 dark

Adoption over time

@ai-sdk/mcp weekly downloads on npm, last 90 days: 3,134,474 weekly downloads as of Oct 18, 2026, +79.8% over 90 days.@ai-sdk/mcpWeekly downloads on npm · Last 90 days3,134,474downloads / week+79.8% over 90 days01M2M3M4M5M6MJul 20Aug 4Aug 19Sep 3Sep 18Oct 3Oct 18downloads / weekobservedarchived (Internet Archive)no observationsJul 22, 2026 – Oct 18, 2026 · 89 observations · Updated Oc…pluginstats.com
@ai-sdk/mcp weekly downloads on npm, last 90 days: 3,134,474 weekly downloads as of Oct 18, 2026, +79.8% over 90 days.

7/30/90-day growth

@ai-sdk/mcp weekly downloads growth on npm: -39.1% over 7 days, -10.6% over 30 days, +79.8% over 90 days.@ai-sdk/mcpWeekly downloads growth on npm3,134,474downloads / week now7-day growth-2,015,503 weekly downlo…-39.1%30-day growth-373,090 weekly downloads-10.6%90-day growth+1,390,704 weekly downlo…+79.8%Growth vs. nearest observation to each baseline date · Updated Oct 18, 2026pluginstats.com
@ai-sdk/mcp weekly downloads growth on npm: -39.1% over 7 days, -10.6% over 30 days, +79.8% over 90 days.

Ranking history

@ai-sdk/mcp npm ranking history: currently #148 (by weekly downloads).@ai-sdk/mcpnpm ranking · by weekly downloads · Last 90 days#148current rank#40#60#80#100#120#140#160Jul 22Aug 6Aug 21Sep 5Sep 20Oct 5Oct 20rankOct 17, 2026 – Oct 20, 2026 · 4 observations · Updated Oct 18, 2026pluginstats.com
@ai-sdk/mcp npm ranking history: currently #148 (by weekly downloads).

Listing placement

All npm2,320 listings · 116 pages · 1,162 shown · page 8, #8 (overall #148)
All npm: every listing in weekly downloads order

Listing placement

MCP servers277 listings · 14 pages · page 1, #7 (overall #7)
MCP servers: every listing in weekly downloads order

Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.

Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.

Recent observations

Full history (544)
Recent weekly downloads observations for @ai-sdk/mcp
Date (UTC)Weekly downloadsChange vs. previous
3,134,474+514.5K
2,620,015-514.2K
3,134,177+134.9K
2,999,285-1.1M
4,108,473-1.1M
5,178,7340
5,178,734+28.8K
5,149,977+104.4K
5,045,585+31.8K
5,013,821+88.9K
4,924,926+142.4K
4,782,500+128.8K
4,653,712-973.5K
5,627,167—

Similar npm MCP servers plugins

All 20 @ai-sdk/mcp alternatives

Data source

Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.

Listing: https://www.npmjs.com/package/@ai-sdk/mcp. First seen Oct 16, 2026; last successful collection Oct 20, 2026. See the methodology.