{"name":"@ai-sdk/mcp","version":"2.0.80","keywords":["ai","mcp"],"license":"Apache-2.0","_id":"@ai-sdk/mcp@2.0.80","maintainers":[{"name":"vercel-release-bot","email":"infra+release@vercel.com"},{"name":"matheuss","email":"matheus.frndes@gmail.com"},{"name":"matt.straka","email":"matt.j.straka@gmail.com"}],"homepage":"https://ai-sdk.dev/docs","bugs":{"url":"https://github.com/vercel/ai/issues"},"dist":{"shasum":"4c46fc9a91ab942100afa78b197dbece247cb5af","tarball":"http://registry-npm.ywwl.com/@ai-sdk/mcp/download/@ai-sdk/mcp-2.0.80.tgz","fileCount":39,"integrity":"sha512-sgOTk2gWIvzRwmWbA+F7kmGYnZ6s69sM0ipRxmMh7zrs7YkwKDukHTOeSSDJRrCun3V4Go434v0v/zZEHv5spw==","signatures":[{"sig":"MEQCIBZvq/mNyhxAc3YmimFaGBZxB7SDMON/nyNcQrQnSUc9AiBnUMjPMdSalaS36C6tetrtAkSfM0sdsawxHsOg6Ba3Gw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEYCIQD9Tl12hsvphUSiJwjAFswPh94MS5PiuzFKp6CW1RJsBgIhANaATlU8BTmMEW8Th0rWFwy+MeFhWTEDcQ1P8rja1F2V","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ai-sdk%2fmcp@2.0.80","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":796805,"size":177695,"noattachment":false,"key":"/@ai-sdk/mcp/-/@ai-sdk/mcp-2.0.80.tgz"},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=22"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"},"./mcp-stdio":{"types":"./dist/mcp-stdio/index.d.ts","import":"./dist/mcp-stdio/index.js","default":"./dist/mcp-stdio/index.js"},"./package.json":"./package.json"},"scripts":{"test":"pnpm test:node && pnpm test:edge","build":"pnpm clean && tsdown","clean":"del-cli *.tsbuildinfo","test:edge":"vitest --config vitest.edge.config.js --run","test:node":"vitest --config vitest.node.config.js --run","test:watch":"vitest --config vitest.node.config.js","type-check":"tsc --build","build:watch":"pnpm clean && tsdown --watch","test:update":"pnpm test:node -u"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"f54ba994-4951-4247-8d06-59680158fd55"}},"repository":{"url":"https://github.com/vercel/ai","type":"git","directory":"packages/mcp"},"directories":{},"sideEffects":false,"_nodeVersion":"24.22.0","dependencies":{"cross-spawn":"^7.0.6","pkce-challenge":"^5.0.1","@ai-sdk/provider":"4.0.31","@ai-sdk/provider-utils":"5.0.64"},"publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"zod":"3.25.76","tsdown":"^0.23.0","vitest":"^4.1.11","typescript":"6.0.3","@types/node":"22.19.19","@types/cross-spawn":"^6.0.6","@ai-sdk/test-server":"2.0.4","@vercel/ai-tsconfig":"0.0.0","@vercel/ai-tsdown-config":"0.0.0"},"peerDependencies":{"zod":"^3.25.76 || ^4.1.8"},"_npmOperationalInternal":{"tmp":"tmp/mcp_2.0.80_1792469493074_0.8946517990838623","host":"s3://npm-registry-packages-npm-production"},"readme":"# AI SDK - Model Context Protocol Client\n\nThe **Model Context Protocol (MCP) client** for the\n[AI SDK](https://ai-sdk.dev/docs) lets you connect to MCP servers and use their\ntools with AI SDK functions like `generateText` and `streamText`.\n\n## Setup\n\n```bash\nnpm i ai @ai-sdk/mcp\n```\n\n## Skill for Coding Agents\n\nIf you use coding agents such as Claude Code or Cursor, we highly recommend\nadding the AI SDK skill to your repository:\n\n```shell\nnpx skills add vercel/ai\n```\n\n## Usage\n\n```ts\nimport { createMCPClient } from '@ai-sdk/mcp';\nimport { generateText, isStepCount } from 'ai';\n\nconst mcpClient = await createMCPClient({\n  transport: {\n    type: 'http',\n    url: 'https://your-server.com/mcp',\n    headers: {\n      Authorization: `Bearer ${process.env.MCP_API_KEY}`,\n    },\n  },\n});\n\ntry {\n  const tools = await mcpClient.tools();\n\n  const { text } = await generateText({\n    model: 'openai/gpt-6-astra',\n    tools,\n    stopWhen: isStepCount(10),\n    prompt: 'Use the available tools to answer the user question.',\n  });\n\n  console.log(text);\n} finally {\n  await mcpClient.close();\n}\n```\n\nSee the [Model Context Protocol Client documentation](https://ai-sdk.dev/docs/ai-sdk-core/mcp-tools) for more information.\n","publish_time":1792469493182,"_cnpm_publish_time":1792469493182,"dist-tags":{"ai-v5":"0.0.43","ai-v6":"1.0.101","beta":"2.0.0-beta.67","canary":"2.0.0-canary.65","latest":"2.0.91","snapshot":"0.0.0-f1630544-20260811180950"}}