<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: PluginStack</title>
    <description>The latest articles on DEV Community by PluginStack (@pluginstackai).</description>
    <link>https://dev.to/pluginstackai</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4243500%2F187a6205-39ba-4676-ab61-9779fb2c6236.png</url>
      <title>DEV Community: PluginStack</title>
      <link>https://dev.to/pluginstackai</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pluginstackai"/>
    <language>en</language>
    <item>
      <title>Fix "MCP error -32001: Request timed out" (Claude Code, Codex, Gemini CLI)</title>
      <dc:creator>PluginStack</dc:creator>
      <pubDate>Wed, 02 Dec 2026 18:29:32 +0000</pubDate>
      <link>https://dev.to/pluginstackai/fix-mcp-error-32001-request-timed-out-claude-code-codex-gemini-cli-kjm</link>
      <guid>https://dev.to/pluginstackai/fix-mcp-error-32001-request-timed-out-claude-code-codex-gemini-cli-kjm</guid>
      <description>&lt;h1&gt;
  
  
  How to fix "MCP error -32001: Request timed out"
&lt;/h1&gt;

&lt;p&gt;Checked against the official docs: Dec 2, 2026&lt;/p&gt;

&lt;p&gt;"MCP error -32001: Request timed out" means the app you're using gave up waiting for an MCP server to answer. It usually isn't a crash: the server may still be working, or it may never have received the request. This guide explains where the error comes from, how to tell a slow tool from a server that isn't answering at all, and where the timeout setting lives in each app. It was checked against the official MCP TypeScript SDK (1.32.2) and the Claude Code, Codex and Gemini CLI docs on 2 December 2026, and we reproduced the error and the fix ourselves.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick answer
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Work out when it happens: when the app starts (the server never connects), or when a tool runs (a long job such as a big scrape, search or build).&lt;/li&gt;
&lt;li&gt;If a tool is slow, raise that app's tool timeout (the settings for each app are below).&lt;/li&gt;
&lt;li&gt;If it happens at startup, raise the startup timeout, and run the server's command once by hand so a first-time download isn't slowing it down.&lt;/li&gt;
&lt;li&gt;If even listing the tools times out, the server isn't answering at all. Test it on its own with MCP Inspector.&lt;/li&gt;
&lt;li&gt;If you wrote the server, make long tools send progress updates or return sooner.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Where the error comes from
&lt;/h2&gt;

&lt;p&gt;The text comes from the official MCP TypeScript SDK, which many MCP apps and servers are built on. When a request gets no answer in time, the SDK stops waiting and raises a "Request timed out" error with the code -32001. Its default wait is 60 seconds per request unless the app sets its own.&lt;/p&gt;

&lt;p&gt;The MCP specification itself doesn't give local timeouts an official code. So -32001 is created inside your app, not sent by the server. That's why the fix is usually a setting in the app, or making the server answer faster.&lt;/p&gt;

&lt;p&gt;We reproduced it with the SDK and the official "everything" test server: a tool that ran for 5 seconds, called with a 1-second timeout, failed with exactly &lt;code&gt;MCP error -32001: Request timed out&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Not the same as -32000. "MCP error -32000: Connection closed" means the server process exited or the connection dropped. See &lt;a href="https://www.pluginstackai.com/guides/fix-mcp-error-32000-connection-closed/" rel="noopener noreferrer"&gt;fix MCP error -32000: Connection closed&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Raise the timeout in your app
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Claude Code
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Startup:&lt;/strong&gt; &lt;code&gt;MCP_TIMEOUT&lt;/code&gt; in milliseconds (default 30,000). Example: &lt;code&gt;MCP_TIMEOUT=60000 claude&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One server's tool calls:&lt;/strong&gt; add &lt;code&gt;"timeout"&lt;/code&gt; in milliseconds to that server's entry in &lt;code&gt;.mcp.json&lt;/code&gt;, for example &lt;code&gt;"timeout": 600000&lt;/code&gt; for ten minutes. Values below 1000 are ignored.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;All servers:&lt;/strong&gt; &lt;code&gt;MCP_TOOL_TIMEOUT&lt;/code&gt; in milliseconds. The per-server &lt;code&gt;timeout&lt;/code&gt; wins for that server.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hosted (HTTP or SSE) servers:&lt;/strong&gt; each request also has its own timer of at least 60 seconds. Set the tool timeout (per-server &lt;code&gt;timeout&lt;/code&gt; or &lt;code&gt;MCP_TOOL_TIMEOUT&lt;/code&gt;) above 60,000 to raise it. Local (stdio) servers don't have this timer.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Idle limit:&lt;/strong&gt; a call that sends no reply and no progress for 5 minutes (hosted servers) or 30 minutes (local servers) is stopped. &lt;code&gt;CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT&lt;/code&gt; changes that, or &lt;code&gt;0&lt;/code&gt; turns it off.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;.mcp.json&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"mcpServers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"my-server"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"npx"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"-y"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"some-mcp-server"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"timeout"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;600000&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In Claude Code, a tool call that is still running after two minutes moves to a background task (you can see it in &lt;code&gt;/tasks&lt;/code&gt;), so a long call doesn't block the chat. The limits above still apply.&lt;/p&gt;

&lt;h3&gt;
  
  
  Codex
&lt;/h3&gt;

&lt;p&gt;Set these per server in &lt;code&gt;~/.codex/config.toml&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;~/.codex/config.toml&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[mcp_servers.my-server]
command = "npx"
args = ["-y", "some-mcp-server"]
startup_timeout_sec = 30   # default 10
tool_timeout_sec = 300     # default 60
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Full Codex setup: &lt;a href="https://www.pluginstackai.com/guides/add-mcp-server-to-codex-config-toml/" rel="noopener noreferrer"&gt;how to add an MCP server to Codex&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Gemini CLI
&lt;/h3&gt;

&lt;p&gt;Add &lt;code&gt;"timeout"&lt;/code&gt; in milliseconds to the server in &lt;code&gt;settings.json&lt;/code&gt; (the default is 600,000, ten minutes), or use &lt;code&gt;--timeout&lt;/code&gt; with &lt;code&gt;gemini mcp add&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;~/.gemini/settings.json&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"mcpServers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"my-server"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"npx"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"-y"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"some-mcp-server"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"timeout"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;900000&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Full Gemini CLI setup: &lt;a href="https://www.pluginstackai.com/guides/add-mcp-server-to-gemini-cli/" rel="noopener noreferrer"&gt;how to add an MCP server to Gemini CLI&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  MCP Inspector
&lt;/h3&gt;

&lt;p&gt;For a server saved in the Inspector's config file, set &lt;code&gt;requestTimeout&lt;/code&gt; (milliseconds; if it's missing, the SDK default is used) and &lt;code&gt;connectionTimeout&lt;/code&gt; (default 30,000). The CLI also takes &lt;code&gt;--connect-timeout &amp;lt;ms&amp;gt;&lt;/code&gt; for the connection.&lt;/p&gt;

&lt;h3&gt;
  
  
  Cursor and VS Code
&lt;/h3&gt;

&lt;p&gt;Cursor's and VS Code's MCP docs don't list a timeout setting (checked 2 December 2026). In those apps, read the MCP logs to see which request timed out, then fix the server side (below). In Cursor, open the Output panel and pick &lt;strong&gt;MCP Logs&lt;/strong&gt;; see &lt;a href="https://www.pluginstackai.com/guides/add-mcp-server-to-cursor/" rel="noopener noreferrer"&gt;how to add an MCP server to Cursor&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  If even listing tools times out
&lt;/h2&gt;

&lt;p&gt;A short request like listing tools should answer in well under a second. If that times out too, raising the timeout won't help, because the server isn't answering at all. Common causes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A first-time download.&lt;/strong&gt; &lt;code&gt;npx -y&lt;/code&gt; or &lt;code&gt;uvx&lt;/code&gt; downloads the server the first time, which can be slow or stuck behind a proxy. Run the command once in a terminal so it's cached, then restart the app.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The server is waiting for something.&lt;/strong&gt; A missing API key, a sign-in it can't show you, or a database it can't reach can leave it hanging. Run the command by hand and read what it prints.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A hosted server is unreachable&lt;/strong&gt; from your network (VPN, firewall, company proxy) or is down.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Test the server on its own with MCP Inspector. The CLI exits with code 4 if the server can't be reached, which tells you quickly whether the problem is the server or your app:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx @modelcontextprotocol/inspector --cli npx -y some-mcp-server --method tools/list

&lt;span class="c"&gt;# a hosted server&lt;/span&gt;
npx @modelcontextprotocol/inspector --cli https://example.com/mcp --method tools/list
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;More on the Inspector: &lt;a href="https://www.pluginstackai.com/guides/how-to-use-mcp-inspector/" rel="noopener noreferrer"&gt;how to use MCP Inspector&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  If you wrote the server or the client
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Send progress on long tools
&lt;/h3&gt;

&lt;p&gt;MCP lets a server send progress notifications while it works on a request. With the TypeScript SDK, a client can choose to restart its timer each time progress arrives (&lt;code&gt;resetTimeoutOnProgress&lt;/code&gt;), and set a hard upper limit with &lt;code&gt;maxTotalTimeout&lt;/code&gt;. In our test, the same 1-second timeout that failed before let a 3-second tool finish once the server sent progress and the client reset the timer:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;TypeScript SDK client&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const result = await client.callTool(
  { name: "my_long_tool", arguments: { query: "..." } },
  undefined,
  {
    timeout: 120000,              // per-request wait in ms (SDK default 60000)
    resetTimeoutOnProgress: true, // restart the timer when progress arrives
    maxTotalTimeout: 600000,      // never wait longer than this in total
    onprogress: (p) =&amp;gt; console.log(p.progress, p.total),
  },
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Progress only helps where the app restarts its timer. Claude Code's per-server &lt;code&gt;timeout&lt;/code&gt; is a hard limit that progress doesn't extend, but progress does stop its idle limit from firing.&lt;/p&gt;

&lt;h3&gt;
  
  
  Return sooner
&lt;/h3&gt;

&lt;p&gt;If a job can take minutes, consider starting it in one tool call, returning an ID straight away, and offering a second tool that checks the result. Every app's timeout is then a non-issue.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Is -32001 a bug in the server?
&lt;/h3&gt;

&lt;p&gt;Not necessarily. It means the app stopped waiting. The server may be slow, stuck or unreachable, or the app's limit may just be shorter than the job.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why 60 seconds?
&lt;/h3&gt;

&lt;p&gt;That's the default request timeout in the official TypeScript SDK. Apps can set their own: Codex uses 60 seconds for tool calls, Gemini CLI 10 minutes, and Claude Code has separate startup, tool and idle limits.&lt;/p&gt;

&lt;h3&gt;
  
  
  Is it safe to set a very long timeout?
&lt;/h3&gt;

&lt;p&gt;It's safe, but you'll wait longer when a server is truly stuck. Raise it for the one slow server rather than for all of them.&lt;/p&gt;

&lt;h3&gt;
  
  
  I'm getting "Connection closed" instead
&lt;/h3&gt;

&lt;p&gt;That's error -32000, a different problem: see &lt;a href="https://www.pluginstackai.com/guides/fix-mcp-error-32000-connection-closed/" rel="noopener noreferrer"&gt;fix MCP error -32000&lt;/a&gt;. For Claude Code sign-in problems, see &lt;a href="https://www.pluginstackai.com/guides/fix-claude-code-mcp-needs-authentication/" rel="noopener noreferrer"&gt;Claude Code MCP "needs authentication"&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/modelcontextprotocol/typescript-sdk" rel="noopener noreferrer"&gt;MCP TypeScript SDK (RequestTimeout = -32001, DEFAULT_REQUEST_TIMEOUT_MSEC = 60000, resetTimeoutOnProgress, maxTotalTimeout; version 1.32.2)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://modelcontextprotocol.io/specification/latest/basic/index" rel="noopener noreferrer"&gt;MCP specification: Base protocol (local errors such as SDK timeouts have no assigned code)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://modelcontextprotocol.io/specification/latest/basic/utilities/progress" rel="noopener noreferrer"&gt;MCP specification: Progress notifications&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://code.claude.com/docs/en/mcp" rel="noopener noreferrer"&gt;Claude Code docs: MCP (time limits on MCP tool calls, backgrounding)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://code.claude.com/docs/en/env-vars" rel="noopener noreferrer"&gt;Claude Code docs: Environment variables (MCP_TIMEOUT, MCP_TOOL_TIMEOUT, CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://learn.chatgpt.com/docs/config-file/config-reference" rel="noopener noreferrer"&gt;OpenAI docs: Codex configuration reference (startup_timeout_sec, tool_timeout_sec)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/google-gemini/gemini-cli/blob/main/docs/tools/mcp-server.md" rel="noopener noreferrer"&gt;Gemini CLI docs: MCP servers (timeout)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/modelcontextprotocol/inspector/blob/main/docs/mcp-server-configuration.md" rel="noopener noreferrer"&gt;Inspector docs: MCP server configuration (requestTimeout, connectionTimeout)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Tools in this guide
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.pluginstackai.com/plugins/mcp-inspector/" rel="noopener noreferrer"&gt;MCP Inspector&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.pluginstackai.com/plugins/claude-code/" rel="noopener noreferrer"&gt;Claude Code&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.pluginstackai.com/plugins/codex-cli/" rel="noopener noreferrer"&gt;Codex CLI&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.pluginstackai.com/plugins/fastmcp/" rel="noopener noreferrer"&gt;FastMCP&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;PluginStack is independent and not affiliated with or endorsed by the companies mentioned. Spotted something out of date? Email &lt;a href="mailto:pluginstackai@gmail.com"&gt;pluginstackai@gmail.com&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This guide was first published on &lt;a href="https://www.pluginstackai.com/guides/fix-mcp-error-32001-request-timed-out/" rel="noopener noreferrer"&gt;PluginStack&lt;/a&gt;. Browse the &lt;a href="https://www.pluginstackai.com/" rel="noopener noreferrer"&gt;PluginStack directory&lt;/a&gt; for more hand-checked MCP servers, plugins and setup guides.&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>ai</category>
      <category>debugging</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How to use MCP Inspector to test an MCP server (web UI, CLI and v2 changes)</title>
      <dc:creator>PluginStack</dc:creator>
      <pubDate>Wed, 02 Dec 2026 18:29:05 +0000</pubDate>
      <link>https://dev.to/pluginstackai/how-to-use-mcp-inspector-to-test-an-mcp-server-web-ui-cli-and-v2-changes-3coh</link>
      <guid>https://dev.to/pluginstackai/how-to-use-mcp-inspector-to-test-an-mcp-server-web-ui-cli-and-v2-changes-3coh</guid>
      <description>&lt;h1&gt;
  
  
  How to use MCP Inspector to test an MCP server
&lt;/h1&gt;

&lt;p&gt;Checked against the official docs: Dec 2, 2026&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.pluginstackai.com/plugins/mcp-inspector/" rel="noopener noreferrer"&gt;MCP Inspector&lt;/a&gt; is the official tool from the Model Context Protocol project for testing MCP servers. It connects to a server on its own, without Claude, Cursor or any other app, and shows you exactly which tools, resources and prompts the server offers. You can call a tool and see the raw result. That makes it the quickest way to tell whether a problem is in the server or in your app's settings. Version 2 changed a lot, so older tutorials often don't match what you see. This guide was checked against the Inspector's own docs on 2 December 2026, and the commands were run on version 2.17.0.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick answer
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Check &lt;code&gt;node -v&lt;/code&gt;. Version 2 needs a recent patched Node.js (details below).&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;npx @modelcontextprotocol/inspector&lt;/code&gt;. The web UI opens in your browser at &lt;code&gt;http://127.0.0.1:6274&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;To test one specific server, add its command after the package name, for example &lt;code&gt;npx @modelcontextprotocol/inspector node build/index.js&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Connect, open the Tools screen, pick a tool, fill in its inputs and run it.&lt;/li&gt;
&lt;li&gt;For scripts and quick checks, use the CLI: &lt;code&gt;npx @modelcontextprotocol/inspector --cli node build/index.js --method tools/list&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  What you need
&lt;/h2&gt;

&lt;p&gt;Inspector 2 needs Node.js &lt;code&gt;^22.23.4 || ^24.22.1 || &amp;gt;=26.12.1&lt;/code&gt;: the patched release on each supported line (22.23.4 or newer on 22, 24.22.1 or newer on 24, or 26.12.1 or newer). The docs explain why: older Node versions miss security fixes for TLS and DNS. npm only warns about an older Node when you install (an &lt;code&gt;EBADENGINE&lt;/code&gt; warning), and the Inspector then fails later in confusing ways, so check &lt;code&gt;node -v&lt;/code&gt; first.&lt;/p&gt;

&lt;p&gt;You don't need to install anything else. &lt;code&gt;npx&lt;/code&gt; downloads the current version each time.&lt;/p&gt;

&lt;h2&gt;
  
  
  Open the web UI
&lt;/h2&gt;

&lt;p&gt;With no arguments, the Inspector opens its web UI with a list of servers saved in &lt;code&gt;~/.mcp-inspector/mcp.json&lt;/code&gt;. On first launch it fills that list with three sample servers (a filesystem server, the "everything" test server and a hosted example server), so you have something to click on straight away:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx @modelcontextprotocol/inspector
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The terminal prints the address, &lt;code&gt;http://127.0.0.1:6274&lt;/code&gt;, with a one-time access token in the link, and opens your browser. If you open the page by hand, use the full link from the terminal, token included. Set &lt;code&gt;MCP_AUTO_OPEN_ENABLED=false&lt;/code&gt; if you don't want a browser window to open.&lt;/p&gt;

&lt;h3&gt;
  
  
  Test your own local server
&lt;/h3&gt;

&lt;p&gt;Put the command that starts your server after the package name. Use &lt;code&gt;-e&lt;/code&gt; for environment variables, and &lt;code&gt;--&lt;/code&gt; before your server's own flags:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx @modelcontextprotocol/inspector node build/index.js

&lt;span class="c"&gt;# with an environment variable and a server flag&lt;/span&gt;
npx @modelcontextprotocol/inspector -e &lt;span class="nv"&gt;API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;your-key -- node build/index.js --server-flag
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Test a hosted server
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx @modelcontextprotocol/inspector --server-url https://example.com/mcp --transport http
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add &lt;code&gt;--header "Name: Value"&lt;/code&gt; if the server needs an API key in a header. Servers that use OAuth sign-in walk you through it in the browser.&lt;/p&gt;

&lt;h3&gt;
  
  
  What to check
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Tools&lt;/strong&gt;: every tool the server offers, with its inputs. Fill in the form and run it to see the exact result your agent would get, including errors.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Resources&lt;/strong&gt; and &lt;strong&gt;Prompts&lt;/strong&gt;: the other things a server can offer, if it has any.&lt;/li&gt;
&lt;li&gt;The connection status and logs: if the server fails to start or connect, the error shows here before you ever open your agent.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If a tool works here but not in your app, the server is fine and the problem is your app's settings (wrong file, a missing key, a path your app can't see).&lt;/p&gt;

&lt;h2&gt;
  
  
  Use the CLI for quick checks and scripts
&lt;/h2&gt;

&lt;p&gt;Add &lt;code&gt;--cli&lt;/code&gt; right after the package name. It connects, runs one request, prints JSON and exits. These ran on version 2.17.0 against the official "everything" test server and the hosted Context7 server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# list the tools of a local server&lt;/span&gt;
npx @modelcontextprotocol/inspector --cli node build/index.js --method tools/list

&lt;span class="c"&gt;# call a tool with arguments&lt;/span&gt;
npx @modelcontextprotocol/inspector --cli node build/index.js --method tools/call --tool-name mytool --tool-arg &lt;span class="nv"&gt;key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;value

&lt;span class="c"&gt;# a hosted server (the transport is guessed from a URL ending in /mcp or /sse)&lt;/span&gt;
npx @modelcontextprotocol/inspector --cli https://mcp.context7.com/mcp --method tools/list

&lt;span class="c"&gt;# resources and prompts&lt;/span&gt;
npx @modelcontextprotocol/inspector --cli node build/index.js --method resources/list
npx @modelcontextprotocol/inspector --cli node build/index.js --method prompts/list
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two rules catch people out. The server command or URL has to come before the other flags. And if a URL doesn't end in &lt;code&gt;/mcp&lt;/code&gt; or &lt;code&gt;/sse&lt;/code&gt;, add &lt;code&gt;--transport http&lt;/code&gt; (or &lt;code&gt;--transport sse&lt;/code&gt;), because version 2 doesn't guess.&lt;/p&gt;

&lt;h3&gt;
  
  
  Exit codes
&lt;/h3&gt;

&lt;p&gt;The CLI exits with a code that says why it failed, and prints one line of JSON describing the error on stderr. The ones you'll see most:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;0&lt;/code&gt;: success.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;1&lt;/code&gt;: wrong usage or an unexpected error.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;3&lt;/code&gt;: sign-in failed or is needed (for example a 401 or 403).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;4&lt;/code&gt;: the server couldn't be reached (DNS, connection refused, timeout).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;5&lt;/code&gt;: the tool returned an error, or there is no tool with that name. In our test, calling a tool that doesn't exist printed &lt;code&gt;{"error":{"code":"tool_not_found",...}}&lt;/code&gt; and exited with 5.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That makes the CLI handy in CI: a step that lists tools or calls one fails the job when the server breaks.&lt;/p&gt;

&lt;h3&gt;
  
  
  Terminal UI
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;npx @modelcontextprotocol/inspector --tui&lt;/code&gt; opens an interactive version in the terminal, for machines without a browser.&lt;/p&gt;

&lt;h2&gt;
  
  
  Saved servers and config files
&lt;/h2&gt;

&lt;p&gt;Version 2 keeps its own list of servers in a file on disk, &lt;code&gt;~/.mcp-inspector/mcp.json&lt;/code&gt;, in the same &lt;code&gt;mcpServers&lt;/code&gt; format Claude Desktop and Cursor use. Two flags choose a different file:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;--catalog ./mcp.json&lt;/code&gt;: use this file as the Inspector's own list. It can add, edit and remove servers in it, and creates it if it's missing.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;--config ./mcp.json&lt;/code&gt;: open this file read-only. The Inspector never writes to it, which is the safe choice for your app's real config file. It errors if the file doesn't exist.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With the CLI, &lt;code&gt;--server &amp;lt;name&amp;gt;&lt;/code&gt; picks one entry from the file: &lt;code&gt;npx @modelcontextprotocol/inspector --cli --config ./mcp.json --server myserver --method tools/list&lt;/code&gt;. In the web UI, &lt;code&gt;--server&lt;/code&gt; is ignored and you pick the server from the list.&lt;/p&gt;

&lt;p&gt;Each saved server can also set &lt;code&gt;connectionTimeout&lt;/code&gt; (default 30,000 milliseconds) and &lt;code&gt;requestTimeout&lt;/code&gt; in milliseconds, which helps when you are chasing timeouts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where your keys are stored
&lt;/h2&gt;

&lt;p&gt;The Inspector saves OAuth tokens, client secrets and the &lt;code&gt;-e&lt;/code&gt; values for local servers in your system keychain when there is one. On a machine without a keychain (many Linux setups, SSH sessions, containers) it saves them to &lt;code&gt;~/.mcp-inspector/secrets.json&lt;/code&gt; instead, unencrypted, and prints a warning when it starts. Set &lt;code&gt;MCP_INSPECTOR_SECRET_KEY&lt;/code&gt; (or &lt;code&gt;MCP_INSPECTOR_SECRET_KEY_FILE&lt;/code&gt;) to a long random passphrase to encrypt that file.&lt;/p&gt;

&lt;p&gt;If you want more help, the (paid) &lt;a href="https://www.pluginstackai.com/packs/" rel="noopener noreferrer"&gt;Agent Builder Rules + Prompts&lt;/a&gt; pack: If you're testing an MCP server you're building yourself, the pack has 10 scaffolding prompts for TypeScript or Python servers, Cursor and Claude Code rules, and 12 eval prompt templates. You don't need it to use the Inspector.&lt;/p&gt;

&lt;h2&gt;
  
  
  What changed from version 1
&lt;/h2&gt;

&lt;p&gt;Version 2 is a rewrite. The &lt;code&gt;npx @modelcontextprotocol/inspector&lt;/code&gt; command is the same, but older tutorials can mislead you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;One port.&lt;/strong&gt; Version 1 ran the UI on 6274 and a proxy on 6277. Version 2 has no proxy, so you no longer need port 6277. (The Apps tab uses a separate port, 6275, which only matters in Docker, dev containers or over SSH.)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;New token name.&lt;/strong&gt; &lt;code&gt;MCP_PROXY_AUTH_TOKEN&lt;/code&gt; is now &lt;code&gt;MCP_INSPECTOR_API_TOKEN&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;--config&lt;/code&gt; means read-only.&lt;/strong&gt; Use &lt;code&gt;--catalog&lt;/code&gt; if you want the Inspector to manage the file.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A failing tool call now fails the command&lt;/strong&gt; (exit code 5). In version 1 it exited 0, so CI scripts that relied on that start failing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One package.&lt;/strong&gt; &lt;code&gt;@modelcontextprotocol/inspector-cli&lt;/code&gt;, &lt;code&gt;-client&lt;/code&gt; and &lt;code&gt;-server&lt;/code&gt; are deprecated. Use &lt;code&gt;@modelcontextprotocol/inspector&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Version 1 still gets security fixes only. If you really need it: &lt;code&gt;npx @modelcontextprotocol/inspector@v1-latest&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common problems
&lt;/h2&gt;

&lt;h3&gt;
  
  
  "Transport type not specified and could not be determined from URL"
&lt;/h3&gt;

&lt;p&gt;The URL doesn't end in &lt;code&gt;/mcp&lt;/code&gt; or &lt;code&gt;/sse&lt;/code&gt;. Add &lt;code&gt;--transport http&lt;/code&gt; or &lt;code&gt;--transport sse&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  The CLI connects to the wrong server, or ignores your command
&lt;/h3&gt;

&lt;p&gt;Under &lt;code&gt;--cli&lt;/code&gt;, put the server command or URL before every other flag. Otherwise it may be dropped in favor of your saved list.&lt;/p&gt;

&lt;h3&gt;
  
  
  The page never loads in a VS Code dev container or over an SSH tunnel
&lt;/h3&gt;

&lt;p&gt;The docs say this was fixed in a later v2 release, so update first (&lt;code&gt;npx&lt;/code&gt; gets the latest unless you pinned a version). On an older version, start it with &lt;code&gt;HOST=127.0.0.1&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  "HOST=0.0.0.0" stops with an error
&lt;/h3&gt;

&lt;p&gt;Version 2 refuses to listen on every network interface by accident. Use a specific address instead. Only set &lt;code&gt;DANGEROUSLY_BIND_ALL_INTERFACES=true&lt;/code&gt; if you really need the Inspector reachable from other machines.&lt;/p&gt;

&lt;h3&gt;
  
  
  Strange errors right after starting
&lt;/h3&gt;

&lt;p&gt;Check &lt;code&gt;node -v&lt;/code&gt; against the version list at the top. An older Node is the usual cause.&lt;/p&gt;

&lt;h3&gt;
  
  
  My server fails in the Inspector too
&lt;/h3&gt;

&lt;p&gt;Then the problem is the server itself, not your app. For a local server that exits right away, see &lt;a href="https://www.pluginstackai.com/guides/fix-mcp-error-32000-connection-closed/" rel="noopener noreferrer"&gt;fix MCP error -32000: Connection closed&lt;/a&gt;. For a call that hangs and gives up, see &lt;a href="https://www.pluginstackai.com/guides/fix-mcp-error-32001-request-timed-out/" rel="noopener noreferrer"&gt;fix MCP error -32001: Request timed out&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Is MCP Inspector free?
&lt;/h3&gt;

&lt;p&gt;Yes. It is open source from the Model Context Protocol project. The repository's license file covers Apache-2.0 for new code and MIT for older contributions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Do I need it to use MCP servers in Claude, Cursor or Gemini CLI?
&lt;/h3&gt;

&lt;p&gt;No. It is a testing tool. It helps most when a server doesn't work in your app and you need to know why.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I use my Claude Desktop or Cursor config with it?
&lt;/h3&gt;

&lt;p&gt;Yes. It reads the same &lt;code&gt;mcpServers&lt;/code&gt; format. Open it read-only with &lt;code&gt;--config&lt;/code&gt; so the Inspector never changes your real file.&lt;/p&gt;

&lt;h3&gt;
  
  
  Next step: add the working server to your app
&lt;/h3&gt;

&lt;p&gt;See &lt;a href="https://www.pluginstackai.com/guides/add-mcp-server-to-cursor/" rel="noopener noreferrer"&gt;how to add an MCP server to Cursor&lt;/a&gt;, &lt;a href="https://www.pluginstackai.com/guides/add-mcp-server-to-vs-code/" rel="noopener noreferrer"&gt;VS Code&lt;/a&gt;, &lt;a href="https://www.pluginstackai.com/guides/add-mcp-server-to-claude-desktop/" rel="noopener noreferrer"&gt;Claude Desktop&lt;/a&gt;, &lt;a href="https://www.pluginstackai.com/guides/add-mcp-server-to-codex-config-toml/" rel="noopener noreferrer"&gt;Codex&lt;/a&gt; or &lt;a href="https://www.pluginstackai.com/guides/add-mcp-server-to-gemini-cli/" rel="noopener noreferrer"&gt;Gemini CLI&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/modelcontextprotocol/inspector" rel="noopener noreferrer"&gt;modelcontextprotocol/inspector README (modes, secrets warning, v1 status, license)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/modelcontextprotocol/inspector/blob/main/docs/v1-to-v2-migration.md" rel="noopener noreferrer"&gt;Inspector docs: Migrating from v1 to v2 (Node requirement, ports, --config vs --catalog, troubleshooting)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/modelcontextprotocol/inspector/blob/main/clients/cli/README.md" rel="noopener noreferrer"&gt;Inspector CLI README (examples, remote servers, exit codes)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/modelcontextprotocol/inspector/blob/main/clients/launcher/README.md" rel="noopener noreferrer"&gt;Inspector launcher README (web flags, default catalog and sample servers)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/modelcontextprotocol/inspector/blob/main/docs/mcp-server-configuration.md" rel="noopener noreferrer"&gt;Inspector docs: MCP server configuration (connectionTimeout, requestTimeout)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/modelcontextprotocol/inspector/blob/main/docs/environment-variables.md" rel="noopener noreferrer"&gt;Inspector docs: Environment variables (MCP_AUTO_OPEN_ENABLED, secret store)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.npmjs.com/package/@modelcontextprotocol/inspector" rel="noopener noreferrer"&gt;@modelcontextprotocol/inspector on npm (2.17.0)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Tools in this guide
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.pluginstackai.com/plugins/mcp-inspector/" rel="noopener noreferrer"&gt;MCP Inspector&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.pluginstackai.com/plugins/fastmcp/" rel="noopener noreferrer"&gt;FastMCP&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.pluginstackai.com/plugins/context7/" rel="noopener noreferrer"&gt;Context7&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.pluginstackai.com/plugins/filesystem-mcp/" rel="noopener noreferrer"&gt;Filesystem MCP Server&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;PluginStack is independent and not affiliated with or endorsed by the companies mentioned. Spotted something out of date? Email &lt;a href="mailto:pluginstackai@gmail.com"&gt;pluginstackai@gmail.com&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This guide was first published on &lt;a href="https://www.pluginstackai.com/guides/how-to-use-mcp-inspector/" rel="noopener noreferrer"&gt;PluginStack&lt;/a&gt;. Browse the &lt;a href="https://www.pluginstackai.com/" rel="noopener noreferrer"&gt;PluginStack directory&lt;/a&gt; for more hand-checked MCP servers, plugins and setup guides.&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>ai</category>
      <category>testing</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How to add an MCP server to Gemini CLI (gemini mcp add, settings.json, fixes)</title>
      <dc:creator>PluginStack</dc:creator>
      <pubDate>Wed, 02 Dec 2026 18:28:34 +0000</pubDate>
      <link>https://dev.to/pluginstackai/how-to-add-an-mcp-server-to-gemini-cli-gemini-mcp-add-settingsjson-fixes-2io0</link>
      <guid>https://dev.to/pluginstackai/how-to-add-an-mcp-server-to-gemini-cli-gemini-mcp-add-settingsjson-fixes-2io0</guid>
      <description>&lt;h1&gt;
  
  
  How to add an MCP server to Gemini CLI
&lt;/h1&gt;

&lt;p&gt;Checked against the official docs: Dec 2, 2026&lt;/p&gt;

&lt;p&gt;Gemini CLI is Google's open-source coding agent for the terminal. MCP (Model Context Protocol) servers give it extra tools, such as driving a browser or looking up current library docs. You can add one with a single &lt;code&gt;gemini mcp add&lt;/code&gt; command or by editing &lt;code&gt;settings.json&lt;/code&gt;. This guide covers both, how to check the server really connected, and the folder trust setting that blocks MCP servers for a lot of people. It was checked against Google's Gemini CLI docs on 2 December 2026, and the commands were run on Gemini CLI 0.72.0.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick answer
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Open a terminal in your project folder.&lt;/li&gt;
&lt;li&gt;For a server you run on your computer: &lt;code&gt;gemini mcp add playwright npx @playwright/mcp@latest&lt;/code&gt;. For a hosted server with a URL: &lt;code&gt;gemini mcp add --transport http context7 https://mcp.context7.com/mcp&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Add &lt;code&gt;-s user&lt;/code&gt; if you want the server in every folder. Without it, the server is saved for this project only.&lt;/li&gt;
&lt;li&gt;Start &lt;code&gt;gemini&lt;/code&gt; and type &lt;code&gt;/mcp&lt;/code&gt;. The server should be listed as connected, with its tools.&lt;/li&gt;
&lt;li&gt;If it says the servers are disabled because the folder is untrusted, run &lt;code&gt;/permissions&lt;/code&gt; and trust the folder.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Before you start
&lt;/h2&gt;

&lt;p&gt;You need Gemini CLI installed (it needs Node.js 20 or newer). Google lists npm and Homebrew among the install options:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# npm&lt;/span&gt;
npm install -g @google/gemini-cli

&lt;span class="c"&gt;# Homebrew (macOS / Linux)&lt;/span&gt;
brew install gemini-cli
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Local servers started with &lt;code&gt;npx&lt;/code&gt; need Node.js too, and servers started with &lt;code&gt;uvx&lt;/code&gt; need uv. Check what the server you want asks for before adding it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Option 1: gemini mcp add
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;gemini mcp add&lt;/code&gt; command writes the entry into your settings file for you. The pattern is &lt;code&gt;gemini mcp add [options] &amp;lt;name&amp;gt; &amp;lt;command-or-url&amp;gt; [args...]&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  A local server (runs on your computer)
&lt;/h3&gt;

&lt;p&gt;This adds &lt;a href="https://www.pluginstackai.com/plugins/playwright-mcp/" rel="noopener noreferrer"&gt;Playwright MCP&lt;/a&gt;, which lets Gemini open and control a browser:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gemini mcp add playwright npx @playwright/mcp@latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the server needs its own flags, put &lt;code&gt;--&lt;/code&gt; before them so Gemini CLI doesn't read them as its own. Google's example: &lt;code&gt;gemini mcp add python-server python server.py -- --server-arg my-value&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  A hosted server (a URL)
&lt;/h3&gt;

&lt;p&gt;Use &lt;code&gt;--transport http&lt;/code&gt; for servers that give you a normal MCP URL (Streamable HTTP), or &lt;code&gt;--transport sse&lt;/code&gt; for older SSE URLs. This adds &lt;a href="https://www.pluginstackai.com/plugins/context7/" rel="noopener noreferrer"&gt;Context7&lt;/a&gt;, which looks up current library docs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gemini mcp add --transport http context7 https://mcp.context7.com/mcp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To send an API key in a header, add &lt;code&gt;-H&lt;/code&gt;, for example &lt;code&gt;-H "Authorization: Bearer YOUR_KEY"&lt;/code&gt;. That saves the key in the settings file as plain text, so for anything shared, use an environment variable in &lt;code&gt;settings.json&lt;/code&gt; instead (shown below).&lt;/p&gt;

&lt;h3&gt;
  
  
  Project or user scope
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Project&lt;/strong&gt; (the default): saved in &lt;code&gt;.gemini/settings.json&lt;/code&gt; in the current folder. Good for a server only one project needs, or one your team shares through git.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;User&lt;/strong&gt; (&lt;code&gt;-s user&lt;/code&gt;): saved in &lt;code&gt;~/.gemini/settings.json&lt;/code&gt; and used in every folder.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you run &lt;code&gt;gemini mcp add&lt;/code&gt; in your home folder without &lt;code&gt;-s user&lt;/code&gt;, it stops with "Please use --scope user to edit settings in the home directory."&lt;/p&gt;

&lt;h3&gt;
  
  
  Other useful flags
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;-e KEY=value&lt;/code&gt;: set an environment variable for a local server.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;--timeout 60000&lt;/code&gt;: timeout in milliseconds.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;--include-tools a,b&lt;/code&gt; or &lt;code&gt;--exclude-tools c&lt;/code&gt;: only allow some of the server's tools.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;--trust&lt;/code&gt;: skip the confirmation prompt for every tool from this server. Only use it for servers you fully control.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Option 2: edit settings.json
&lt;/h2&gt;

&lt;p&gt;Gemini CLI reads servers from an &lt;code&gt;mcpServers&lt;/code&gt; object in &lt;code&gt;settings.json&lt;/code&gt;. The two files you'll normally use are &lt;code&gt;~/.gemini/settings.json&lt;/code&gt; (just you, every folder) and &lt;code&gt;.gemini/settings.json&lt;/code&gt; in a project (that project only; project settings override user settings). There are also system-wide files for admins.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;~/.gemini/settings.json or .gemini/settings.json&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"mcpServers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"playwright"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"npx"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"@playwright/mcp@latest"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"context7"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;"httpUrl"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"https://mcp.context7.com/mcp"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The fields that matter most:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;command&lt;/code&gt;, &lt;code&gt;args&lt;/code&gt;, &lt;code&gt;env&lt;/code&gt;, &lt;code&gt;cwd&lt;/code&gt;: for a local server.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;httpUrl&lt;/code&gt;: a hosted server that uses Streamable HTTP (most current servers).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;url&lt;/code&gt;: a hosted server that uses SSE. If an entry has more than one of these, Gemini CLI uses &lt;code&gt;httpUrl&lt;/code&gt; first, then &lt;code&gt;url&lt;/code&gt;, then &lt;code&gt;command&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;headers&lt;/code&gt;: extra HTTP headers, such as an API key, for &lt;code&gt;httpUrl&lt;/code&gt; or &lt;code&gt;url&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;timeout&lt;/code&gt;: request timeout in milliseconds. The default is 600,000 (10 minutes).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;trust&lt;/code&gt;, &lt;code&gt;includeTools&lt;/code&gt;, &lt;code&gt;excludeTools&lt;/code&gt;: the same as the flags above.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Entries written by &lt;code&gt;gemini mcp add --transport http&lt;/code&gt; look slightly different: a &lt;code&gt;url&lt;/code&gt; plus &lt;code&gt;"type": "http"&lt;/code&gt;. Both forms connected in our test, so you don't need to change one into the other.&lt;/p&gt;

&lt;p&gt;Google warns against underscores in server names (use &lt;code&gt;my-server&lt;/code&gt;, not &lt;code&gt;my_server&lt;/code&gt;). Gemini CLI names each tool &lt;code&gt;mcp_&amp;lt;server&amp;gt;_&amp;lt;tool&amp;gt;&lt;/code&gt;, and an underscore in the server name can make permission rules silently fail.&lt;/p&gt;

&lt;p&gt;Coming from Cursor or Claude Desktop? Local server entries use the same &lt;code&gt;command&lt;/code&gt; and &lt;code&gt;args&lt;/code&gt; shape, so you can usually copy them across. For hosted servers, Gemini CLI uses &lt;code&gt;httpUrl&lt;/code&gt; where Cursor uses &lt;code&gt;url&lt;/code&gt;. See &lt;a href="https://www.pluginstackai.com/guides/add-mcp-server-to-cursor/" rel="noopener noreferrer"&gt;how to add an MCP server to Cursor&lt;/a&gt; for Cursor's version.&lt;/p&gt;

&lt;h2&gt;
  
  
  API keys and environment variables
&lt;/h2&gt;

&lt;p&gt;Don't paste keys straight into &lt;code&gt;settings.json&lt;/code&gt;. Gemini CLI fills in &lt;code&gt;$NAME&lt;/code&gt; or &lt;code&gt;${NAME}&lt;/code&gt; from your environment when it loads the file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"mcpServers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"my-server"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"npx"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"-y"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"some-mcp-server"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"env"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nl"&gt;"API_KEY"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"$MY_API_KEY"&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This matters more than in other apps. To protect your secrets, Gemini CLI removes sensitive variables from what a local server inherits, including names that contain TOKEN, SECRET, PASSWORD, KEY, AUTH or CREDENTIAL. A key that is set in your shell is not passed on unless you list it in that server's &lt;code&gt;env&lt;/code&gt;. If a server says its API key is missing, this is the first thing to check.&lt;/p&gt;

&lt;p&gt;A variable that isn't set becomes an empty string, so set it (for example &lt;code&gt;export MY_API_KEY=...&lt;/code&gt; in your shell profile) and open a new terminal before starting &lt;code&gt;gemini&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Servers that ask you to sign in
&lt;/h2&gt;

&lt;p&gt;Many hosted servers use OAuth sign-in instead of a key. You only need the URL. When the server answers that sign-in is needed, Gemini CLI finds the sign-in details, opens your browser and saves the tokens. Inside Gemini CLI, &lt;code&gt;/mcp auth&lt;/code&gt; lists servers that support sign-in, and &lt;code&gt;/mcp auth &amp;lt;name&amp;gt;&lt;/code&gt; signs in again, for example when a token has expired.&lt;/p&gt;

&lt;p&gt;The browser has to be able to reach &lt;code&gt;localhost&lt;/code&gt; on the same computer. Sign-in doesn't work over a plain SSH session, in a container without a browser, or on a headless server.&lt;/p&gt;

&lt;h2&gt;
  
  
  Check that it works
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Start &lt;code&gt;gemini&lt;/code&gt; in the folder and type &lt;code&gt;/mcp&lt;/code&gt;. Each server shows as connected or disconnected, with its tools. &lt;code&gt;/mcp desc&lt;/code&gt; adds tool descriptions.&lt;/li&gt;
&lt;li&gt;From a normal terminal, &lt;code&gt;gemini mcp list&lt;/code&gt; shows the same status for every configured server.&lt;/li&gt;
&lt;li&gt;Ask for something only that server can do, for example "Use playwright to open &lt;a href="https://example.com" rel="noopener noreferrer"&gt;https://example.com&lt;/a&gt; and tell me the page title". Gemini CLI asks you to confirm each tool call unless the server is trusted.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;After editing &lt;code&gt;settings.json&lt;/code&gt; while Gemini CLI is running, &lt;code&gt;/mcp reload&lt;/code&gt; reconnects the servers. To turn a server off without deleting it, use &lt;code&gt;gemini mcp disable &amp;lt;name&amp;gt;&lt;/code&gt; (add &lt;code&gt;--session&lt;/code&gt; for this session only) and &lt;code&gt;gemini mcp enable &amp;lt;name&amp;gt;&lt;/code&gt; to turn it back on. &lt;code&gt;gemini mcp remove &amp;lt;name&amp;gt;&lt;/code&gt; deletes it; add &lt;code&gt;-s user&lt;/code&gt; for a user-scope server.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common errors and fixes
&lt;/h2&gt;

&lt;h3&gt;
  
  
  "MCP servers are configured but disabled because this folder is untrusted"
&lt;/h3&gt;

&lt;p&gt;Gemini CLI's Trusted Folders setting is on by default in current versions (the settings reference lists it as on, and our test on 0.72.0 matched). The first time you start &lt;code&gt;gemini&lt;/code&gt; in a new folder, it asks whether to trust it. In a folder you haven't trusted, it doesn't load the project's &lt;code&gt;.gemini/settings.json&lt;/code&gt; and doesn't connect to MCP servers at all, including ones in your user settings. Start &lt;code&gt;gemini&lt;/code&gt; in the folder, run &lt;code&gt;/permissions&lt;/code&gt; and choose to trust it. Your choices are saved in &lt;code&gt;~/.gemini/trustedFolders.json&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;For scripts and CI, where there is nobody to answer the prompt, setting &lt;code&gt;GEMINI_CLI_TRUST_WORKSPACE=true&lt;/code&gt; trusts the current folder for that run.&lt;/p&gt;

&lt;h3&gt;
  
  
  "Cannot modify settings in an untrusted workspace"
&lt;/h3&gt;

&lt;p&gt;This comes from &lt;code&gt;gemini mcp add&lt;/code&gt; in a folder that isn't trusted. Trust the folder first (above), or add the server to your user settings with &lt;code&gt;-s user&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  The server shows as disconnected
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Run the same command in a terminal (for example &lt;code&gt;npx @playwright/mcp@latest&lt;/code&gt;). If it fails there, the error tells you what's missing. If it starts and waits quietly, the server is fine and the problem is in the settings.&lt;/li&gt;
&lt;li&gt;Check the JSON. A missing comma or quote makes the whole file invalid.&lt;/li&gt;
&lt;li&gt;Start Gemini CLI with &lt;code&gt;gemini --debug&lt;/code&gt; for detailed output (press F12 for the debug console in interactive mode).&lt;/li&gt;
&lt;li&gt;At startup, connection errors are quiet by default. If you only see "MCP issues detected. Run /mcp list for status.", run &lt;code&gt;/mcp list&lt;/code&gt; to see the real error.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The server connects but has no tools
&lt;/h3&gt;

&lt;p&gt;Check &lt;code&gt;includeTools&lt;/code&gt; and &lt;code&gt;excludeTools&lt;/code&gt; in the entry. If the server is your own, make sure it registers its tools. Gemini CLI also closes connections to servers that offer no tools.&lt;/p&gt;

&lt;h3&gt;
  
  
  Tool calls time out
&lt;/h3&gt;

&lt;p&gt;Raise &lt;code&gt;timeout&lt;/code&gt; (milliseconds) on that server. More on timeouts in every client: &lt;a href="https://www.pluginstackai.com/guides/fix-mcp-error-32001-request-timed-out/" rel="noopener noreferrer"&gt;fix MCP error -32001: Request timed out&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Testing a server outside Gemini CLI
&lt;/h3&gt;

&lt;p&gt;The official &lt;a href="https://www.pluginstackai.com/plugins/mcp-inspector/" rel="noopener noreferrer"&gt;MCP Inspector&lt;/a&gt; connects to a server on its own and lists its tools, which tells you whether the problem is the server or the Gemini CLI settings. See &lt;a href="https://www.pluginstackai.com/guides/how-to-use-mcp-inspector/" rel="noopener noreferrer"&gt;how to use MCP Inspector&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Where is the Gemini CLI MCP config file?
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;~/.gemini/settings.json&lt;/code&gt; for your user, or &lt;code&gt;.gemini/settings.json&lt;/code&gt; in a project folder. Servers go under the top-level &lt;code&gt;mcpServers&lt;/code&gt; key.&lt;/p&gt;

&lt;h3&gt;
  
  
  Does Gemini CLI support remote MCP servers?
&lt;/h3&gt;

&lt;p&gt;Yes. Use &lt;code&gt;httpUrl&lt;/code&gt; for Streamable HTTP or &lt;code&gt;url&lt;/code&gt; for SSE, or &lt;code&gt;gemini mcp add --transport http&lt;/code&gt; or &lt;code&gt;--transport sse&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can my team share the same servers?
&lt;/h3&gt;

&lt;p&gt;Yes. Put them in &lt;code&gt;.gemini/settings.json&lt;/code&gt; in the project and commit it, with keys coming from environment variables. Each person still has to trust the folder before the servers connect.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I stop Gemini CLI asking before every tool call?
&lt;/h3&gt;

&lt;p&gt;Setting &lt;code&gt;"trust": true&lt;/code&gt; on a server (or &lt;code&gt;--trust&lt;/code&gt; when adding it) skips the prompts for that server. Google's docs say to use it only for servers you completely control.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/google-gemini/gemini-cli/blob/main/docs/tools/mcp-server.md" rel="noopener noreferrer"&gt;Gemini CLI docs: MCP servers with Gemini CLI (settings, gemini mcp commands, OAuth, troubleshooting)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/google-gemini/gemini-cli/blob/main/docs/reference/configuration.md" rel="noopener noreferrer"&gt;Gemini CLI docs: Configuration reference (settings file locations, mcpServers, folder trust default)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/trusted-folders.md" rel="noopener noreferrer"&gt;Gemini CLI docs: Trusted Folders&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/google-gemini/gemini-cli/blob/main/docs/reference/commands.md" rel="noopener noreferrer"&gt;Gemini CLI docs: Commands (/mcp, /permissions)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/google-gemini/gemini-cli/blob/main/docs/get-started/installation.mdx" rel="noopener noreferrer"&gt;Gemini CLI docs: Installation (requirements, npm and Homebrew)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/google-gemini/gemini-cli/blob/main/packages/cli/src/commands/mcp/add.ts" rel="noopener noreferrer"&gt;Gemini CLI source: gemini mcp add (scopes and what it writes)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/google-gemini/gemini-cli/releases" rel="noopener noreferrer"&gt;Gemini CLI releases (0.72.0)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Tools in this guide
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.pluginstackai.com/plugins/playwright-mcp/" rel="noopener noreferrer"&gt;Playwright MCP&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.pluginstackai.com/plugins/context7/" rel="noopener noreferrer"&gt;Context7&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.pluginstackai.com/plugins/mcp-inspector/" rel="noopener noreferrer"&gt;MCP Inspector&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.pluginstackai.com/plugins/github-mcp-server/" rel="noopener noreferrer"&gt;GitHub MCP Server&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;PluginStack is independent and not affiliated with or endorsed by the companies mentioned. Spotted something out of date? Email &lt;a href="mailto:pluginstackai@gmail.com"&gt;pluginstackai@gmail.com&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This guide was first published on &lt;a href="https://www.pluginstackai.com/guides/add-mcp-server-to-gemini-cli/" rel="noopener noreferrer"&gt;PluginStack&lt;/a&gt;. Browse the &lt;a href="https://www.pluginstackai.com/" rel="noopener noreferrer"&gt;PluginStack directory&lt;/a&gt; for more hand-checked MCP servers, plugins and setup guides.&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>ai</category>
      <category>gemini</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>MCP reference servers v2.0 and v2.1: what changed and how to update</title>
      <dc:creator>PluginStack</dc:creator>
      <pubDate>Tue, 01 Dec 2026 17:22:21 +0000</pubDate>
      <link>https://dev.to/pluginstackai/mcp-reference-servers-v20-and-v21-what-changed-and-how-to-update-6o8</link>
      <guid>https://dev.to/pluginstackai/mcp-reference-servers-v20-and-v21-what-changed-and-how-to-update-6o8</guid>
      <description>&lt;h1&gt;
  
  
  MCP reference servers v2.0 and v2.1: what changed and what to do
&lt;/h1&gt;

&lt;p&gt;Checked against the official docs: Oct 27, 2026&lt;/p&gt;

&lt;p&gt;On 19 October 2026 the official &lt;code&gt;modelcontextprotocol/servers&lt;/code&gt; repository shipped v2.0.0, and a security-focused v2.1.0 followed on 25 October (UTC). If you run the Filesystem, Memory, Sequential Thinking or Fetch server from a Claude, Cursor, VS Code or Codex config, this is what changed, whether it affects you, and how to update. Everything below comes from the official release notes, changelogs and package registries; sources are listed at the end.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick answer
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The TypeScript servers now declare Node.js 24 or newer.&lt;/strong&gt; Filesystem, Memory, Sequential Thinking and Everything all list &lt;code&gt;"node": "&amp;gt;=24"&lt;/code&gt; in their package &lt;code&gt;engines&lt;/code&gt;. Run &lt;code&gt;node --version&lt;/code&gt;; if it is below 24, install Node 24 or newer before you restart your client.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fetch is a Python package, so the Node change does not apply to it.&lt;/strong&gt; It is published on PyPI as &lt;code&gt;mcp-server-fetch&lt;/code&gt; and needs Python 3.10 or newer.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;v2.1.0 is a security release.&lt;/strong&gt; It fixes eight vulnerabilities across three servers. Move Filesystem to 2.0.1 (the first version with the fixes) and Fetch to 2026.10.24, or newer.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The setup commands in the READMEs did not change.&lt;/strong&gt; &lt;code&gt;npx -y @modelcontextprotocol/server-filesystem &amp;lt;folders&amp;gt;&lt;/code&gt; and &lt;code&gt;uvx mcp-server-fetch&lt;/code&gt; are still the launch commands, so an existing config usually keeps working once the runtime is current.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If a server stops starting after an update, the cause is almost always the runtime or a stale cached version. See "How to update" and "What can break" below, and our guide to &lt;a href="https://www.pluginstackai.com/guides/fix-mcp-error-32000-connection-closed/" rel="noopener noreferrer"&gt;MCP error -32000 "Connection closed"&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What v2.0 and v2.1 are
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;v2.0.0 (19 October 2026)&lt;/strong&gt; refactored every server in the repository so that it supports the "modern era" of the MCP specification (the 2026-07-28 revision) while still answering clients that speak the older 2025-era protocol. The TypeScript servers moved onto the v2 TypeScript SDK packages and the Python servers onto the Python SDK 2.x line.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;v2.1.0 (tagged 25 October 2026, UTC)&lt;/strong&gt; is a security release: eight vulnerabilities fixed across Filesystem, Fetch and Everything (the Everything server is a test server for client developers, not something most people configure). The release notes link a GitHub security advisory for each one. We do not repeat the advisory details here; read the release notes if you need them.&lt;/p&gt;

&lt;p&gt;The versions that were current on 27 October 2026, checked against the npm and PyPI registries:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;@modelcontextprotocol/server-filesystem&lt;/code&gt; &lt;strong&gt;2.0.1&lt;/strong&gt; (npm, &lt;code&gt;engines.node&lt;/code&gt; &lt;code&gt;&amp;gt;=24&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;@modelcontextprotocol/server-memory&lt;/code&gt; &lt;strong&gt;2.0.0&lt;/strong&gt; (npm, &lt;code&gt;&amp;gt;=24&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;@modelcontextprotocol/server-sequential-thinking&lt;/code&gt; &lt;strong&gt;2.0.0&lt;/strong&gt; (npm, &lt;code&gt;&amp;gt;=24&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;mcp-server-fetch&lt;/code&gt; &lt;strong&gt;2026.10.24&lt;/strong&gt; (PyPI, Python &lt;code&gt;&amp;gt;=3.10&lt;/code&gt;, depends on &lt;code&gt;mcp&amp;gt;=2.3,&amp;lt;3&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Git and Time, the other two Python servers, use the same date-style versions (2026.10.19 at the v2.0.0 release). Details for each server are on its listing: &lt;a href="https://www.pluginstackai.com/plugins/filesystem-mcp/" rel="noopener noreferrer"&gt;Filesystem&lt;/a&gt;, &lt;a href="https://www.pluginstackai.com/plugins/memory-mcp/" rel="noopener noreferrer"&gt;Memory&lt;/a&gt;, &lt;a href="https://www.pluginstackai.com/plugins/sequential-thinking-mcp/" rel="noopener noreferrer"&gt;Sequential Thinking&lt;/a&gt; and &lt;a href="https://www.pluginstackai.com/plugins/fetch-mcp/" rel="noopener noreferrer"&gt;Fetch&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Who this affects
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Anyone launching a TypeScript reference server with &lt;code&gt;npx&lt;/code&gt;&lt;/strong&gt;, which is how most Claude Desktop, Cursor, VS Code and Codex configs do it. You need Node 24 or newer on the machine that runs the client.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Filesystem server users on any platform&lt;/strong&gt;, because the security fixes landed in 2.0.1. The release notes list every earlier version as affected (1.0.0 through 2.0.0, and the date versions up to 2026.8.31). The v2.1.0 release notes call the Windows fix partial, so on Windows treat the allowed-folder list as something to review, not a guarantee.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fetch server users&lt;/strong&gt;, for the 2026.10.24 security fixes. Fetch can reach any URL you let the model request, so keep it current.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;People who pinned an old version&lt;/strong&gt; or installed a global copy. Nothing updates those automatically.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Developers who call the servers from their own client code&lt;/strong&gt;, because several behaviours changed (see "What can break").&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It does not affect remote MCP servers run by other companies, such as the &lt;a href="https://www.pluginstackai.com/plugins/notion-mcp/" rel="noopener noreferrer"&gt;Notion&lt;/a&gt; or &lt;a href="https://www.pluginstackai.com/plugins/linear-mcp/" rel="noopener noreferrer"&gt;Linear&lt;/a&gt; ones, and it does not change servers from other publishers. Those have their own release notes and runtime requirements.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to update
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Check your Node version
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;Node 24 or newer, and the engines the package declares&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;node --version
npm view @modelcontextprotocol/server-filesystem engines
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If &lt;code&gt;node --version&lt;/code&gt; prints something below v24, install a current Node (the official download page, or a version manager such as nvm or fnm) and restart your terminal and your AI client. A client launched from a desktop icon uses the Node that was on its PATH when it started, so quit and reopen it fully.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Get the new server version
&lt;/h3&gt;

&lt;p&gt;With &lt;code&gt;npx -y &amp;lt;package&amp;gt;&lt;/code&gt; in your config there is nothing to install: npx fetches the latest published version when it launches the server. Restart your client after upgrading Node, and the new version starts. If you want to be explicit, or you are jumping from an old date-style version, pin it:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Pin Filesystem to the first security-fixed version (change the folder to yours)&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx -y @modelcontextprotocol/server-filesystem@2.0.1 &lt;span class="nv"&gt;$HOME&lt;/span&gt;/projects
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In a client config the same pin goes in the &lt;code&gt;args&lt;/code&gt; array, for example &lt;code&gt;"args": ["-y", "@modelcontextprotocol/server-filesystem@2.0.1", "&amp;lt;absolute-path-to-your-projects&amp;gt;"]&lt;/code&gt;. If Cursor keeps launching an old copy, its docs suggest removing the server in Customize, running &lt;code&gt;npm cache clean --force&lt;/code&gt;, then adding it again.&lt;/p&gt;

&lt;p&gt;For Fetch, run it through &lt;code&gt;uvx&lt;/code&gt; (or &lt;code&gt;pip&lt;/code&gt;), and ask for the latest:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;uvx mcp-server-fetch@latest
&lt;span class="c"&gt;# or, if you installed it with pip:&lt;/span&gt;
pip install -U mcp-server-fetch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. Restart your client and check
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Claude Code:&lt;/strong&gt; run &lt;code&gt;claude mcp list&lt;/code&gt; and look for &lt;code&gt;✔ Connected&lt;/code&gt; next to the server.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cursor:&lt;/strong&gt; open &lt;strong&gt;Customize&lt;/strong&gt; then &lt;strong&gt;MCPs&lt;/strong&gt; (the server should be listed with its toggle on).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;VS Code:&lt;/strong&gt; run &lt;strong&gt;MCP: List Servers&lt;/strong&gt; from the Command Palette and check the server is running.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Codex:&lt;/strong&gt; run &lt;code&gt;codex mcp list&lt;/code&gt;, or type &lt;code&gt;/mcp&lt;/code&gt; inside the Codex terminal UI.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What can break
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Node older than 24
&lt;/h3&gt;

&lt;p&gt;The maintainers declare Node 24 or newer, so treat anything older as unsupported. npm prints an &lt;code&gt;EBADENGINE&lt;/code&gt; warning for it. In a quick test we ran on 27 October 2026, Node 20 and 22 still completed an MCP handshake with the new servers, so an old Node does not always fail outright. That is luck, not a promise: the declared requirement is 24, and a later release can use a Node 24 feature without notice. If a server will not start after the update, check this first.&lt;/p&gt;

&lt;h3&gt;
  
  
  Changes that matter if you write or run your own client
&lt;/h3&gt;

&lt;p&gt;These come from the v2.0.0 notes and the per-server changelogs. Most people using Claude, Cursor, VS Code or Codex never see them.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A stdio message larger than 10 MiB now closes the connection.&lt;/li&gt;
&lt;li&gt;Calling a tool name the server does not have now returns a JSON-RPC &lt;code&gt;-32602&lt;/code&gt; error instead of a tool result flagged &lt;code&gt;isError&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Error messages no longer start with an &lt;code&gt;MCP error &amp;lt;code&amp;gt;:&lt;/code&gt; prefix, and validation errors now name the field first.&lt;/li&gt;
&lt;li&gt;Tool input schemas declare JSON Schema 2020-12 rather than draft-07.&lt;/li&gt;
&lt;li&gt;Tools no longer advertise &lt;code&gt;execution.taskSupport&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Filesystem: Roots are deprecated
&lt;/h3&gt;

&lt;p&gt;On a connection that uses the 2026-07-28 protocol, the Filesystem server does not use MCP Roots (the &lt;code&gt;roots/list&lt;/code&gt; mechanism). The allowed folders are exactly the ones you pass on the command line. A server started with no folders answers each tool call on such a connection with an error. Clients still on the 2025-era protocol keep the older Roots behaviour.&lt;/p&gt;

&lt;p&gt;If you are jumping from an older date-versioned release, the Filesystem changelog for 1.0.0 also lists behaviour changes (for example, an update to roots that leaves no valid folder now revokes access, &lt;code&gt;edit_file&lt;/code&gt; keeps CRLF line endings, and &lt;code&gt;write_file&lt;/code&gt; overwrites in place). Read the changelog before upgrading a setup you rely on.&lt;/p&gt;

&lt;h3&gt;
  
  
  The date-versus-semver trap on npm
&lt;/h3&gt;

&lt;p&gt;The TypeScript servers were date-versioned (&lt;code&gt;2025.x&lt;/code&gt; and &lt;code&gt;2026.x&lt;/code&gt;) until they moved to semantic versions at 1.0.0. Package managers rank 2.0.1 below every 2025.x and 2026.x version, so they will not offer it as an upgrade. The release notes say that if you are on a date version you should install 2.0.1 explicitly, for example &lt;code&gt;npm install @modelcontextprotocol/server-filesystem@2.0.1&lt;/code&gt;, or pin it as shown above.&lt;/p&gt;

&lt;h3&gt;
  
  
  Windows launch problems are separate
&lt;/h3&gt;

&lt;p&gt;If your server fails on Windows with &lt;code&gt;spawn npx ENOENT&lt;/code&gt;, that is not a v2 problem; &lt;code&gt;npx&lt;/code&gt; needs a &lt;code&gt;cmd /c&lt;/code&gt; wrapper in some clients. See &lt;a href="https://www.pluginstackai.com/guides/fix-spawn-npx-enoent-windows-mcp/" rel="noopener noreferrer"&gt;Fix "spawn npx ENOENT" for MCP servers on Windows&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Do I need to change my MCP config?
&lt;/h3&gt;

&lt;p&gt;Usually not. The launch commands in the READMEs are the same. What you may need to change is the machine: Node 24 or newer for the TypeScript servers, and a restart.&lt;/p&gt;

&lt;h3&gt;
  
  
  Is Fetch affected by the Node 24 requirement?
&lt;/h3&gt;

&lt;p&gt;No. Fetch is a Python package launched with &lt;code&gt;uvx&lt;/code&gt; or &lt;code&gt;python -m mcp_server_fetch&lt;/code&gt;. It needs Python 3.10 or newer, and its own update is 2026.10.24.&lt;/p&gt;

&lt;h3&gt;
  
  
  Which version should I run?
&lt;/h3&gt;

&lt;p&gt;The latest published one: Filesystem 2.0.1 or newer, Memory and Sequential Thinking 2.0.0 or newer, Fetch 2026.10.24 or newer, as of 27 October 2026. Check the GitHub releases page for anything newer.&lt;/p&gt;

&lt;h3&gt;
  
  
  Where do I add these servers to my client?
&lt;/h3&gt;

&lt;p&gt;See &lt;a href="https://www.pluginstackai.com/guides/add-mcp-server-to-cursor/" rel="noopener noreferrer"&gt;how to add an MCP server to Cursor&lt;/a&gt;, &lt;a href="https://www.pluginstackai.com/guides/best-mcp-servers-for-claude-code/" rel="noopener noreferrer"&gt;the best MCP servers for Claude Code&lt;/a&gt; and &lt;a href="https://www.pluginstackai.com/guides/add-mcp-server-to-codex-config-toml/" rel="noopener noreferrer"&gt;how to add an MCP server to Codex with config.toml&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;p&gt;Commands and config above come from these official docs. Tools change often, so check them for the latest steps.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/modelcontextprotocol/servers/releases/tag/v2.0.0" rel="noopener noreferrer"&gt;modelcontextprotocol/servers release v2.0.0&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/modelcontextprotocol/servers/releases/tag/v2.1.0" rel="noopener noreferrer"&gt;modelcontextprotocol/servers release v2.1.0 (security fixes)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/modelcontextprotocol/servers/tree/main/src/filesystem" rel="noopener noreferrer"&gt;Filesystem server README and changelog&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/modelcontextprotocol/servers/tree/main/src/memory" rel="noopener noreferrer"&gt;Memory server README and changelog&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/modelcontextprotocol/servers/tree/main/src/sequentialthinking" rel="noopener noreferrer"&gt;Sequential Thinking server README and changelog&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/modelcontextprotocol/servers/tree/main/src/fetch" rel="noopener noreferrer"&gt;Fetch server README and changelog&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.npmjs.com/package/@modelcontextprotocol/server-filesystem" rel="noopener noreferrer"&gt;npm: @modelcontextprotocol/server-filesystem (version and engines)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://pypi.org/project/mcp-server-fetch/" rel="noopener noreferrer"&gt;PyPI: mcp-server-fetch (version, Python and mcp requirements)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://cursor.com/docs/mcp" rel="noopener noreferrer"&gt;Cursor docs: MCP&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Tools in this guide
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.pluginstackai.com/plugins/filesystem-mcp/" rel="noopener noreferrer"&gt;Filesystem MCP Server&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.pluginstackai.com/plugins/fetch-mcp/" rel="noopener noreferrer"&gt;Fetch MCP Server&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.pluginstackai.com/plugins/memory-mcp/" rel="noopener noreferrer"&gt;Memory MCP Server&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.pluginstackai.com/plugins/sequential-thinking-mcp/" rel="noopener noreferrer"&gt;Sequential Thinking MCP Server&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.pluginstackai.com/plugins/mcp-inspector/" rel="noopener noreferrer"&gt;MCP Inspector&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;PluginStack is independent and not affiliated with or endorsed by the companies mentioned. Spotted something out of date? Email &lt;a href="mailto:pluginstackai@gmail.com"&gt;pluginstackai@gmail.com&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This guide was first published on &lt;a href="https://www.pluginstackai.com/guides/mcp-reference-servers-v2-whats-changed/" rel="noopener noreferrer"&gt;PluginStack&lt;/a&gt;. Browse the &lt;a href="https://www.pluginstackai.com/" rel="noopener noreferrer"&gt;PluginStack directory&lt;/a&gt; for more hand-checked MCP servers, plugins and setup guides.&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>ai</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>OpenAI Agents SDK tutorial (Python): first agent, tools, handoffs, MCP</title>
      <dc:creator>PluginStack</dc:creator>
      <pubDate>Tue, 01 Dec 2026 17:21:32 +0000</pubDate>
      <link>https://dev.to/pluginstackai/openai-agents-sdk-tutorial-python-first-agent-tools-handoffs-mcp-11i2</link>
      <guid>https://dev.to/pluginstackai/openai-agents-sdk-tutorial-python-first-agent-tools-handoffs-mcp-11i2</guid>
      <description>&lt;h1&gt;
  
  
  OpenAI Agents SDK tutorial for Python
&lt;/h1&gt;

&lt;p&gt;Checked against the official docs: Nov 4, 2026&lt;/p&gt;

&lt;p&gt;The OpenAI Agents SDK (&lt;code&gt;openai-agents&lt;/code&gt; on PyPI) is OpenAI's open-source Python framework for building agents: a model with instructions, tools it can call, and the option to hand a conversation to another agent. This tutorial goes from an empty folder to an agent that uses your own Python functions, routes questions between specialists, remembers earlier turns and calls an MCP server. Every snippet follows the SDK's official docs, and the imports were checked against &lt;code&gt;openai-agents&lt;/code&gt; 0.24.0 (the current release on 4 November 2026).&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick answer
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Use Python 3.10 or newer. Make a virtual environment and run &lt;code&gt;pip install openai-agents&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Set &lt;code&gt;OPENAI_API_KEY&lt;/code&gt; in your environment.&lt;/li&gt;
&lt;li&gt;Create an &lt;code&gt;Agent(name=..., instructions=...)&lt;/code&gt; and run it with &lt;code&gt;Runner.run(agent, "your question")&lt;/code&gt; inside &lt;code&gt;asyncio.run(...)&lt;/code&gt;, or &lt;code&gt;Runner.run_sync(...)&lt;/code&gt; in a plain script.&lt;/li&gt;
&lt;li&gt;Read the answer from &lt;code&gt;result.final_output&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  1. Install the SDK
&lt;/h2&gt;

&lt;p&gt;The package needs Python 3.10 or newer. Make a project folder with its own virtual environment so the SDK and its dependencies stay out of your system Python:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;mkdir my_project
&lt;span class="nb"&gt;cd&lt;/span&gt; my_project
python -m venv .venv
&lt;span class="nb"&gt;source&lt;/span&gt; .venv/bin/activate   &lt;span class="c"&gt;# Windows: .venv\Scripts\activate&lt;/span&gt;
pip install openai-agents
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you use uv, &lt;code&gt;uv init&lt;/code&gt; and then &lt;code&gt;uv add openai-agents&lt;/code&gt; does the same thing. The package is called &lt;code&gt;openai-agents&lt;/code&gt;, but you import it as &lt;code&gt;agents&lt;/code&gt;. Don't install the &lt;code&gt;agents&lt;/code&gt; package from PyPI by mistake: that is a different project (TensorFlow Agents).&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Set your API key
&lt;/h2&gt;

&lt;p&gt;The SDK reads your key from the &lt;code&gt;OPENAI_API_KEY&lt;/code&gt; environment variable. Create a key in the OpenAI dashboard, then set it in the terminal you run the script from:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;macOS / Linux&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="kd"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;OPENAI_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;sk-...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Windows PowerShell&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$env&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="no"&gt;OPENAI_API_KEY&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"sk-..."&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That only lasts for the current terminal session. Keep the key out of your code and out of git. One option is a &lt;code&gt;.env&lt;/code&gt; file that you load yourself and list in &lt;code&gt;.gitignore&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Your first agent
&lt;/h2&gt;

&lt;p&gt;An agent is a model plus instructions. &lt;code&gt;Runner&lt;/code&gt; runs the loop: it calls the model, runs any tools the model asks for, and stops when the model gives a final answer. Save this as &lt;code&gt;main.py&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;main.py&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;asyncio&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;agents&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Agent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Runner&lt;/span&gt;

&lt;span class="n"&gt;agent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Agent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"History Tutor"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;instructions&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"You answer history questions clearly and concisely."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nc"&gt;Runner&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;agent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"When did the Roman Empire fall?"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;final_output&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;"__main__"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;asyncio&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python main.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No &lt;code&gt;model&lt;/code&gt; is set here, so the SDK uses its default model. To choose one, pass &lt;code&gt;model="..."&lt;/code&gt; to &lt;code&gt;Agent&lt;/code&gt;, or set &lt;code&gt;OPENAI_DEFAULT_MODEL&lt;/code&gt; for every agent that doesn't name one. The models page in the SDK docs lists the current default.&lt;/p&gt;

&lt;h3&gt;
  
  
  run, run_sync or run_streamed?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;await Runner.run(...)&lt;/code&gt; is async. Use it in async code, web servers and anything that runs several agents at once.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Runner.run_sync(...)&lt;/code&gt; wraps the same thing for plain scripts. It won't work inside an event loop that is already running, such as a Jupyter notebook. Use &lt;code&gt;await Runner.run(...)&lt;/code&gt; there.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Runner.run_streamed(...)&lt;/code&gt; returns straight away and gives you events as they happen, so you can print text as it is written.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Streaming text as it arrives (inside an async function)&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;openai&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;types&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;responses&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;ResponseTextDeltaEvent&lt;/span&gt;

&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Runner&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run_streamed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;agent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;input&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Tell me three facts about Rome."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stream_events&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;"raw_response_event"&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="nb"&gt;isinstance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;ResponseTextDeltaEvent&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;delta&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;end&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;flush&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. Give the agent tools
&lt;/h2&gt;

&lt;p&gt;A function tool is an ordinary Python function the model can decide to call. The SDK builds the tool's schema from the function name, the type hints and the docstring, so write the docstring for the model: say what the tool does and when to use it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;asyncio&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;agents&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Agent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Runner&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;agents&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;decorators&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;tool&lt;/span&gt;

&lt;span class="nd"&gt;@tool&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_order_status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;order_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="s2"&gt;"""Look up the shipping status of an order by its ID."""&lt;/span&gt;
    &lt;span class="c1"&gt;# Replace this with a real database or API call.&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"Order {order_id} shipped yesterday."&lt;/span&gt;

&lt;span class="n"&gt;agent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Agent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Support Agent"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;instructions&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Help customers with their orders. Use the tools to look things up."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;tools&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;get_order_status&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nc"&gt;Runner&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;agent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Where is order 1042?"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;final_output&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;asyncio&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The quickstart imports &lt;code&gt;tool&lt;/code&gt; from &lt;code&gt;agents.decorators&lt;/code&gt;. In 0.24.0, &lt;code&gt;tool&lt;/code&gt; is an alias for &lt;code&gt;function_tool&lt;/code&gt;, so code that uses &lt;code&gt;from agents import function_tool&lt;/code&gt; and &lt;code&gt;@function_tool&lt;/code&gt; works the same way.&lt;/p&gt;

&lt;p&gt;The SDK also has hosted tools that run on OpenAI's side, such as &lt;code&gt;WebSearchTool()&lt;/code&gt; and &lt;code&gt;FileSearchTool(...)&lt;/code&gt;, which you add to &lt;code&gt;tools&lt;/code&gt; the same way. The docs list them as built-in tools for OpenAI's Responses models.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A tool can do anything your Python code can do. If it deletes, sends or pays for something, check the inputs inside the function and think about requiring a human approval step. The SDK's human-in-the-loop guide shows how to pause a run for approval.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  5. Hand off between agents
&lt;/h2&gt;

&lt;p&gt;A handoff lets one agent pass the conversation to another that is better suited to it. Give each specialist a &lt;code&gt;handoff_description&lt;/code&gt; so the routing agent knows when to use it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;agents&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Agent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Runner&lt;/span&gt;

&lt;span class="n"&gt;history_tutor&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Agent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"History Tutor"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;handoff_description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Specialist agent for historical questions"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;instructions&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"You answer history questions clearly and concisely."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;math_tutor&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Agent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Math Tutor"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;handoff_description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Specialist agent for math questions"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;instructions&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"You explain math step by step."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;triage_agent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Agent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Triage Agent"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;instructions&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Route each homework question to the right specialist."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;handoffs&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;history_tutor&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;math_tutor&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Runner&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run_sync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;triage_agent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"What is 15% of 80?"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;last_agent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   &lt;span class="c1"&gt;# which agent answered&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;final_output&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After a handoff, the specialist owns the rest of the conversation. If you want a manager agent that stays in charge and calls specialists like functions, use agents as tools instead:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;manager&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Agent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Manager"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;instructions&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Answer the question. Use the tutors when you need them."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;tools&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="n"&gt;history_tutor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;as_tool&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tool_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"history_tutor"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;tool_description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Answers history questions"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;math_tutor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;as_tool&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tool_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"math_tutor"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;tool_description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Solves math problems"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  6. Get structured output
&lt;/h2&gt;

&lt;p&gt;Set &lt;code&gt;output_type&lt;/code&gt; to a Pydantic model and &lt;code&gt;final_output&lt;/code&gt; becomes an instance of it rather than plain text. That is much easier to use in code than parsing a sentence:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;pydantic&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;BaseModel&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;agents&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Agent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Runner&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Ticket&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;BaseModel&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;category&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;
    &lt;span class="n"&gt;urgent&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt;
    &lt;span class="n"&gt;summary&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;

&lt;span class="n"&gt;classifier&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Agent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Ticket Classifier"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;instructions&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Classify the support message."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;output_type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nc"&gt;Ticket&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Runner&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run_sync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;classifier&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"My card was charged twice and I need it fixed today."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;ticket&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;final_output&lt;/span&gt;   &lt;span class="c1"&gt;# a Ticket object&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ticket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;category&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ticket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;urgent&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  7. Remember earlier turns
&lt;/h2&gt;

&lt;p&gt;Each &lt;code&gt;Runner.run&lt;/code&gt; call starts fresh unless you pass the history back in. The simplest way is a session, which stores the conversation and adds it to the next run for you:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;agents&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Agent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Runner&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;SQLiteSession&lt;/span&gt;

&lt;span class="n"&gt;agent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Agent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Assistant"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;instructions&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Reply very concisely."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;session&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;SQLiteSession&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"conversation_123"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   &lt;span class="c1"&gt;# in memory&lt;/span&gt;
&lt;span class="c1"&gt;# session = SQLiteSession("user_123", "conversations.db")   # saved to a file&lt;/span&gt;

&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Runner&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run_sync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;agent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"What city is the Golden Gate Bridge in?"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;session&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;session&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;final_output&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Runner&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run_sync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;agent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"What state is it in?"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;session&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;session&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;final_output&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   &lt;span class="c1"&gt;# knows "it" means the bridge&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use one session ID per conversation (per user, per chat thread). Without a database file the history is lost when the program exits. If you want to manage history yourself, pass &lt;code&gt;result.to_input_list()&lt;/code&gt; plus the new message into the next run. You can also let OpenAI keep the state with &lt;code&gt;previous_response_id&lt;/code&gt; or &lt;code&gt;conversation_id&lt;/code&gt;. The SDK's running-agents guide compares the options.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. Connect an MCP server
&lt;/h2&gt;

&lt;p&gt;MCP (Model Context Protocol) servers give an agent ready-made tools. The SDK can start a local server and expose its tools to the agent. This example uses the official &lt;a href="https://www.pluginstackai.com/plugins/filesystem-mcp/" rel="noopener noreferrer"&gt;Filesystem MCP server&lt;/a&gt;, limited to one folder. It needs Node.js 24 or newer for &lt;code&gt;npx&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;asyncio&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;pathlib&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;agents&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Agent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Runner&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;agents&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;mcp&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;MCPServerStdio&lt;/span&gt;

&lt;span class="n"&gt;notes_dir&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;__file__&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;parent&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="s2"&gt;"notes"&lt;/span&gt;

&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nc"&gt;MCPServerStdio&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Filesystem"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="s2"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"npx"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s2"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"-y"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"@modelcontextprotocol/server-filesystem"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;notes_dir&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;client_session_timeout_seconds&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;agent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Agent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Notes Assistant"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;instructions&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Answer questions using the files in the notes folder."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;mcp_servers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nc"&gt;Runner&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;agent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"List the files you can see and summarize the newest one."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;final_output&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;asyncio&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;client_session_timeout_seconds&lt;/code&gt; defaults to 5 seconds. The example raises it to 30, as the example in the SDK's MCP docs does. &lt;code&gt;npx -y&lt;/code&gt; may download the package before the server starts, so the SDK docs recommend installing the package before connecting. One way is &lt;code&gt;npm install -g @modelcontextprotocol/server-filesystem&lt;/code&gt; and then &lt;code&gt;"command": "mcp-server-filesystem"&lt;/code&gt; with just the folder in &lt;code&gt;args&lt;/code&gt;. To give the agent only some of a server's tools, pass &lt;code&gt;tool_filter=create_static_tool_filter(allowed_tool_names=[...])&lt;/code&gt; (import it from &lt;code&gt;agents.mcp&lt;/code&gt;). For Filesystem, &lt;code&gt;["read_text_file", "list_directory", "search_files"]&lt;/code&gt; makes it read-only. The SDK docs' example uses &lt;code&gt;read_file&lt;/code&gt;. That name still works, but the server marks it deprecated in favor of &lt;code&gt;read_text_file&lt;/code&gt;. More on this server: &lt;a href="https://www.pluginstackai.com/guides/filesystem-mcp-server-setup/" rel="noopener noreferrer"&gt;Filesystem MCP server setup&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For a server that runs on the web, use &lt;code&gt;MCPServerStreamableHttp(name=..., params={"url": "https://...", "headers": {...}})&lt;/code&gt; the same way. With OpenAI's Responses models there is also &lt;code&gt;HostedMCPTool&lt;/code&gt;, where the Responses API connects to a remote MCP server and your code never connects to it. Only connect servers you trust: whatever a tool returns goes straight into the model's context.&lt;/p&gt;

&lt;h2&gt;
  
  
  9. See what happened with tracing
&lt;/h2&gt;

&lt;p&gt;Tracing is on by default. Each run records the model calls, tool calls and handoffs, and you can look through them in the OpenAI Traces dashboard. That shows you why an agent picked a tool or where it got stuck.&lt;/p&gt;

&lt;p&gt;To switch it off, set &lt;code&gt;OPENAI_AGENTS_DISABLE_TRACING=1&lt;/code&gt; in the environment, or call &lt;code&gt;set_tracing_disabled(True)&lt;/code&gt; (from &lt;code&gt;agents&lt;/code&gt;) at the start of your program. Tracing is unavailable for organizations that use OpenAI's APIs under a Zero Data Retention (ZDR) policy.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common errors
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;ModuleNotFoundError: No module named 'agents'&lt;/code&gt;:&lt;/strong&gt; the virtual environment isn't active, or you installed into a different Python. Activate &lt;code&gt;.venv&lt;/code&gt; and run &lt;code&gt;pip install openai-agents&lt;/code&gt; again.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;OpenAIError: Missing credentials. Please pass an&lt;/code&gt;api_key&lt;code&gt;...&lt;/code&gt;:&lt;/strong&gt; &lt;code&gt;OPENAI_API_KEY&lt;/code&gt; isn't set in the terminal that runs the script. Set it again after opening a new terminal.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;MaxTurnsExceeded&lt;/code&gt;:&lt;/strong&gt; the agent kept calling tools without finishing. The default limit is 10 turns. Tighten the instructions or tool descriptions, or pass &lt;code&gt;max_turns=&lt;/code&gt; to &lt;code&gt;Runner.run&lt;/code&gt; if the task really needs more steps.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;RuntimeError: AgentRunner.run_sync() cannot be called when an event loop is already running.&lt;/code&gt;:&lt;/strong&gt; you called &lt;code&gt;Runner.run_sync&lt;/code&gt; inside Jupyter or another async program. Use &lt;code&gt;await Runner.run(...)&lt;/code&gt; instead.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The MCP server times out on startup:&lt;/strong&gt; install the package before connecting, as the SDK docs recommend, and check &lt;code&gt;node --version&lt;/code&gt; (the Filesystem server has declared Node 24 or newer since v2.0.0).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Where to go next
&lt;/h2&gt;

&lt;p&gt;The SDK repo has runnable examples worth reading next: &lt;code&gt;examples/basic/hello_world.py&lt;/code&gt;, &lt;code&gt;examples/basic/tools.py&lt;/code&gt; and &lt;code&gt;examples/agent_patterns/routing.py&lt;/code&gt;. Guardrails (checks that run on input or output), human approval and voice agents each have their own page in the docs. For a shorter overview of the SDK, how it differs from the regular OpenAI SDK and the JavaScript version, see the &lt;a href="https://www.pluginstackai.com/plugins/openai-agents-sdk/" rel="noopener noreferrer"&gt;OpenAI Agents SDK listing&lt;/a&gt;. To give your agent more tools through MCP, &lt;a href="https://www.pluginstackai.com/guides/best-mcp-servers-for-claude-code/" rel="noopener noreferrer"&gt;the best MCP servers for Claude Code&lt;/a&gt; covers popular servers that work with any MCP client.&lt;/p&gt;

&lt;p&gt;If you want more help, the (paid) &lt;a href="https://www.pluginstackai.com/packs/" rel="noopener noreferrer"&gt;Agent Builder Rules + Prompts&lt;/a&gt; pack: Not needed for anything in this tutorial. If you go on to design your own agent tools, the pack has framework-agnostic rules for tool design and error handling, plus 12 eval prompt templates for testing an agent. It is not specific to the OpenAI Agents SDK.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Is the OpenAI Agents SDK free?
&lt;/h3&gt;

&lt;p&gt;The SDK is open source under the MIT license and free to install. You pay for the model calls it makes as normal API usage.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I use it with models from other providers?
&lt;/h3&gt;

&lt;p&gt;Yes. The models page in the docs covers non-OpenAI providers, including OpenAI-compatible endpoints and the LiteLLM and Any-LLM adapters (both marked beta). Hosted tools such as web search and file search are built-in tools for OpenAI's Responses models.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is the difference between the Agents SDK and the OpenAI Python SDK?
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;openai&lt;/code&gt; package sends single requests to the API. The Agents SDK is built on top of it and adds the agent loop: running tools, handoffs, sessions, guardrails and tracing. The &lt;a href="https://www.pluginstackai.com/plugins/openai-agents-sdk/" rel="noopener noreferrer"&gt;listing&lt;/a&gt; has a short comparison.&lt;/p&gt;

&lt;h3&gt;
  
  
  Is there a JavaScript or TypeScript version?
&lt;/h3&gt;

&lt;p&gt;Yes, &lt;code&gt;@openai/agents&lt;/code&gt; on npm, with similar concepts. This tutorial covers the Python package only.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;p&gt;Commands and config above come from these official docs. Tools change often, so check them for the latest steps.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://openai.github.io/openai-agents-python/quickstart/" rel="noopener noreferrer"&gt;OpenAI Agents SDK docs: Quickstart&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://openai.github.io/openai-agents-python/running_agents/" rel="noopener noreferrer"&gt;OpenAI Agents SDK docs: Running agents&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://openai.github.io/openai-agents-python/tools/" rel="noopener noreferrer"&gt;OpenAI Agents SDK docs: Tools&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://openai.github.io/openai-agents-python/sessions/" rel="noopener noreferrer"&gt;OpenAI Agents SDK docs: Sessions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://openai.github.io/openai-agents-python/mcp/" rel="noopener noreferrer"&gt;OpenAI Agents SDK docs: MCP&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://openai.github.io/openai-agents-python/streaming/" rel="noopener noreferrer"&gt;OpenAI Agents SDK docs: Streaming&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://openai.github.io/openai-agents-python/tracing/" rel="noopener noreferrer"&gt;OpenAI Agents SDK docs: Tracing&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://openai.github.io/openai-agents-python/models/" rel="noopener noreferrer"&gt;OpenAI Agents SDK docs: Models&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://pypi.org/project/openai-agents/" rel="noopener noreferrer"&gt;openai-agents on PyPI (version and Python requirement)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/openai/openai-agents-python" rel="noopener noreferrer"&gt;openai/openai-agents-python on GitHub (examples)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Tools in this guide
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.pluginstackai.com/plugins/openai-agents-sdk/" rel="noopener noreferrer"&gt;OpenAI Agents SDK&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.pluginstackai.com/plugins/filesystem-mcp/" rel="noopener noreferrer"&gt;Filesystem MCP Server&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.pluginstackai.com/plugins/mcp-inspector/" rel="noopener noreferrer"&gt;MCP Inspector&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;PluginStack is independent and not affiliated with or endorsed by the companies mentioned. Spotted something out of date? Email &lt;a href="mailto:pluginstackai@gmail.com"&gt;pluginstackai@gmail.com&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This guide was first published on &lt;a href="https://www.pluginstackai.com/guides/openai-agents-sdk-python-tutorial/" rel="noopener noreferrer"&gt;PluginStack&lt;/a&gt;. Browse the &lt;a href="https://www.pluginstackai.com/" rel="noopener noreferrer"&gt;PluginStack directory&lt;/a&gt; for more hand-checked MCP servers, plugins and setup guides.&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>ai</category>
      <category>python</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Best free AI courses (2026): beginner to builder</title>
      <dc:creator>PluginStack</dc:creator>
      <pubDate>Tue, 01 Dec 2026 17:20:32 +0000</pubDate>
      <link>https://dev.to/pluginstackai/best-free-ai-courses-2026-beginner-to-builder-fh9</link>
      <guid>https://dev.to/pluginstackai/best-free-ai-courses-2026-beginner-to-builder-fh9</guid>
      <description>&lt;h1&gt;
  
  
  Best free AI courses (2026)
&lt;/h1&gt;

&lt;p&gt;Checked against the official docs: Oct 27, 2026&lt;/p&gt;

&lt;p&gt;You don't need to pay to learn AI. These are the best free courses we found, from total beginner (no coding) to building your own agents and MCP servers. For each one we say who it's for, what's actually free, and whether you get a certificate.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick answer: where to start
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Never used AI tools much?&lt;/strong&gt; Start with &lt;a href="https://www.elementsofai.com/" rel="noopener noreferrer"&gt;Elements of AI&lt;/a&gt; or &lt;strong&gt;Claude 101&lt;/strong&gt; from Anthropic Academy. No coding needed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Want to use ChatGPT or Codex better at work?&lt;/strong&gt; &lt;a href="https://academy.openai.com/" rel="noopener noreferrer"&gt;OpenAI Academy&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Starting to code with AI?&lt;/strong&gt; &lt;strong&gt;Claude Code 101&lt;/strong&gt; from Anthropic Academy, then our &lt;a href="https://www.pluginstackai.com/start-here/" rel="noopener noreferrer"&gt;Start here&lt;/a&gt; page to set up your first tools.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Want to build agents?&lt;/strong&gt; The &lt;a href="https://huggingface.co/learn/agents-course/unit0/introduction" rel="noopener noreferrer"&gt;Hugging Face Agents Course&lt;/a&gt; (basic Python needed).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Want to build MCP servers?&lt;/strong&gt; &lt;strong&gt;Introduction to Model Context Protocol&lt;/strong&gt; from Anthropic Academy (Python).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Want the computer science behind it?&lt;/strong&gt; &lt;a href="https://cs50.harvard.edu/ai/" rel="noopener noreferrer"&gt;Harvard CS50 AI&lt;/a&gt; or &lt;a href="https://course.fast.ai/" rel="noopener noreferrer"&gt;fast.ai&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;How we picked: the lessons have to be free to take. Where a certificate or extras cost money, we say so. We don't earn anything from these links.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Beginner courses (no coding)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  OpenAI Academy
&lt;/h3&gt;

&lt;p&gt;OpenAI's free, self-paced courses on using AI at work, building with AI and Codex, leading AI adoption, and teaching and learning with AI. You can browse without signing in, but you need a ChatGPT account to enroll and save your progress.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cost:&lt;/strong&gt; free.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Certificate:&lt;/strong&gt; pass a course's assessment (80% or higher) to earn a shareable badge. Finish every course in a pathway (such as Foundations, Codex or API) for a certificate of completion. OpenAI says these are not formal certifications.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Link:&lt;/strong&gt; &lt;a href="https://academy.openai.com/" rel="noopener noreferrer"&gt;academy.openai.com&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Anthropic Academy: Claude 101 and AI Fluency
&lt;/h3&gt;

&lt;p&gt;Anthropic's free courses, hosted on Skilljar. (Anthropic's learning hub is now called &lt;a href="https://academy.claude.com/" rel="noopener noreferrer"&gt;Claude Academy&lt;/a&gt;; the course catalog is still headed Anthropic Academy.) Two good beginner picks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://anthropic.skilljar.com/claude-101" rel="noopener noreferrer"&gt;Claude 101&lt;/a&gt;: using Claude for everyday work, including projects, artifacts, skills and connecting your tools.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://anthropic.skilljar.com/ai-fluency-framework-foundations" rel="noopener noreferrer"&gt;AI Fluency: Framework &amp;amp; Foundations&lt;/a&gt;: how to work with any AI effectively, efficiently, ethically and safely. Made with professors from University College Cork and Ringling College.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cost:&lt;/strong&gt; free (you register for each course).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Certificate:&lt;/strong&gt; each course page lists a certificate of completion.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Elements of AI
&lt;/h3&gt;

&lt;p&gt;A free online course series from MinnaLearn and the University of Helsinki, taken by over 2 million people. &lt;strong&gt;Introduction to AI&lt;/strong&gt; explains what AI is and what it can and can't do, with no complicated math or programming. &lt;strong&gt;Building AI&lt;/strong&gt; is the follow-up and goes a step further (basic Python helps).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cost:&lt;/strong&gt; free, self-paced.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Link:&lt;/strong&gt; &lt;a href="https://www.elementsofai.com/" rel="noopener noreferrer"&gt;elementsofai.com&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Google: Introduction to Generative AI
&lt;/h3&gt;

&lt;p&gt;A short (about 45 minutes) introductory course on what generative AI is, how it works and how it differs from traditional machine learning. It's on Google Skills (formerly Google Cloud Skills Boost) and you can earn a badge.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cost:&lt;/strong&gt; free.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Link:&lt;/strong&gt; &lt;a href="https://www.skills.google/course_templates/536" rel="noopener noreferrer"&gt;Introduction to Generative AI on Google Skills&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Heads up: &lt;strong&gt;Google AI Essentials&lt;/strong&gt; is not free. Google says it costs $49 USD per month in the U.S. and Canada after a 7-day free trial (it may cost less in other countries). It's on Coursera. If you want a free Google option, take Introduction to Generative AI above.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  For people who code with AI
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Anthropic Academy: Claude Code 101
&lt;/h3&gt;

&lt;p&gt;For developers who are new to software engineering, or experienced engineers who haven't tried AI coding agents yet. It goes from installing &lt;a href="https://www.pluginstackai.com/plugins/claude-code/" rel="noopener noreferrer"&gt;Claude Code&lt;/a&gt; to customizing it for your daily work.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cost:&lt;/strong&gt; free. (Using Claude Code itself needs a paid Claude plan or a Console account.)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Certificate:&lt;/strong&gt; certificate of completion.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Link:&lt;/strong&gt; &lt;a href="https://anthropic.skilljar.com/claude-code-101" rel="noopener noreferrer"&gt;Claude Code 101&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  DeepLearning.AI short courses
&lt;/h3&gt;

&lt;p&gt;Short, hands-on courses on specific topics like prompting, agents, RAG and tools such as MCP, some made with the companies behind those tools (like Anthropic). A good way to learn one thing in an afternoon.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cost:&lt;/strong&gt; the course videos are free to watch. Quizzes, labs and certificates of completion need a paid Pro membership.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Link:&lt;/strong&gt; &lt;a href="https://www.deeplearning.ai/courses" rel="noopener noreferrer"&gt;deeplearning.ai/courses&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  For people who want to build agents and models
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Anthropic Academy: Introduction to Model Context Protocol
&lt;/h3&gt;

&lt;p&gt;Build MCP servers and clients from scratch in Python, covering MCP's three core parts: tools, resources and prompts. Take this after you've used a few MCP servers (see &lt;a href="https://www.pluginstackai.com/start-here/" rel="noopener noreferrer"&gt;what an MCP server is&lt;/a&gt;).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cost:&lt;/strong&gt; free. &lt;strong&gt;Certificate:&lt;/strong&gt; certificate of completion.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Link:&lt;/strong&gt; &lt;a href="https://anthropic.skilljar.com/introduction-to-model-context-protocol" rel="noopener noreferrer"&gt;Introduction to Model Context Protocol&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Hugging Face Agents Course
&lt;/h3&gt;

&lt;p&gt;A free course that takes you from beginner to building your own AI agents, using frameworks like smolagents, LlamaIndex and LangGraph, and ending with a final project. You need basic Python, a free Hugging Face account and an internet connection.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cost:&lt;/strong&gt; free.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Certificate:&lt;/strong&gt; follow along for free in "audit mode", or do the assignments to earn one of its two certificates.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Link:&lt;/strong&gt; &lt;a href="https://huggingface.co/learn/agents-course/unit0/introduction" rel="noopener noreferrer"&gt;Hugging Face Agents Course&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Hugging Face LLM Course
&lt;/h3&gt;

&lt;p&gt;How large language models work and how to use, fine-tune and share them with the Hugging Face libraries. It needs a good knowledge of Python, and Hugging Face suggests taking an intro deep learning course first (such as fast.ai below).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cost:&lt;/strong&gt; completely free, with no ads.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Certificate:&lt;/strong&gt; the course FAQ says there isn't a certification for it yet.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Link:&lt;/strong&gt; &lt;a href="https://huggingface.co/learn/llm-course/chapter1/1" rel="noopener noreferrer"&gt;Hugging Face LLM Course&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  fast.ai: Practical Deep Learning for Coders
&lt;/h3&gt;

&lt;p&gt;A free course for people with some coding experience (about a year, ideally in Python) and high-school math. There are 9 lessons of about 90 minutes each, and the book it's based on is free online too. You use free tools for building and running models.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cost:&lt;/strong&gt; free.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Link:&lt;/strong&gt; &lt;a href="https://course.fast.ai/" rel="noopener noreferrer"&gt;course.fast.ai&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Harvard CS50's Introduction to AI with Python
&lt;/h3&gt;

&lt;p&gt;Harvard's course on the ideas and algorithms behind modern AI: search, knowledge, uncertainty, optimization, machine learning, neural networks and language. It's seven weeks of lectures and projects. You need CS50x or at least a year of Python.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cost:&lt;/strong&gt; free through Harvard's OpenCourseWare.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Certificate:&lt;/strong&gt; score at least 70% on each project for a free CS50 Certificate. A verified certificate from edX costs extra.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Link:&lt;/strong&gt; &lt;a href="https://cs50.harvard.edu/ai/" rel="noopener noreferrer"&gt;cs50.harvard.edu/ai&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Which free AI course is best for a complete beginner?
&lt;/h3&gt;

&lt;p&gt;Elements of AI if you want to understand AI in general, or Claude 101 or OpenAI Academy if you want to get better at using an AI assistant. None of them need coding.&lt;/p&gt;

&lt;h3&gt;
  
  
  Do free courses give you a certificate?
&lt;/h3&gt;

&lt;p&gt;Some do. Anthropic Academy and the Hugging Face Agents Course offer free certificates, OpenAI Academy gives badges, and CS50 AI has a free CS50 Certificate. DeepLearning.AI certificates need a paid membership.&lt;/p&gt;

&lt;h3&gt;
  
  
  I finished a course. What next?
&lt;/h3&gt;

&lt;p&gt;Try it for real. Our &lt;a href="https://www.pluginstackai.com/start-here/" rel="noopener noreferrer"&gt;Start here&lt;/a&gt; page walks you through installing Cursor or Claude Code and adding your first MCP server. Then browse the &lt;a href="https://www.pluginstackai.com/" rel="noopener noreferrer"&gt;directory&lt;/a&gt; for tools to add.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;p&gt;Every course above was checked on these official pages. Prices and certificates change, so check the course page before you sign up.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://academy.openai.com/" rel="noopener noreferrer"&gt;OpenAI Academy&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://help.openai.com/en/articles/20001270-openai-academy-courses" rel="noopener noreferrer"&gt;OpenAI Help Center: OpenAI Academy courses (free, badges, pathways)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://anthropic.skilljar.com/" rel="noopener noreferrer"&gt;Anthropic Academy course catalog&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://academy.claude.com/" rel="noopener noreferrer"&gt;Claude Academy (Anthropic)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://anthropic.skilljar.com/claude-101" rel="noopener noreferrer"&gt;Anthropic Academy: Claude 101&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://anthropic.skilljar.com/ai-fluency-framework-foundations" rel="noopener noreferrer"&gt;Anthropic Academy: AI Fluency: Framework &amp;amp; Foundations&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://anthropic.skilljar.com/claude-code-101" rel="noopener noreferrer"&gt;Anthropic Academy: Claude Code 101&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://anthropic.skilljar.com/introduction-to-model-context-protocol" rel="noopener noreferrer"&gt;Anthropic Academy: Introduction to Model Context Protocol&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.elementsofai.com/" rel="noopener noreferrer"&gt;Elements of AI&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.skills.google/course_templates/536" rel="noopener noreferrer"&gt;Google Skills: Introduction to Generative AI&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://grow.google/ai-essentials/" rel="noopener noreferrer"&gt;Google AI Essentials (pricing FAQ)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.deeplearning.ai/courses" rel="noopener noreferrer"&gt;DeepLearning.AI courses&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://info.deeplearning.ai/knowledge-base/what-do-i-get-with-the-deeplearning.ai-pro-membership-that-i-dont-get-for-free" rel="noopener noreferrer"&gt;DeepLearning.AI: what Pro includes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://huggingface.co/learn/agents-course/unit0/introduction" rel="noopener noreferrer"&gt;Hugging Face Agents Course&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://huggingface.co/learn/llm-course/chapter1/1" rel="noopener noreferrer"&gt;Hugging Face LLM Course&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://course.fast.ai/" rel="noopener noreferrer"&gt;fast.ai: Practical Deep Learning for Coders&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://cs50.harvard.edu/ai/" rel="noopener noreferrer"&gt;Harvard CS50 AI&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://cs50.harvard.edu/ai/certificate/" rel="noopener noreferrer"&gt;Harvard CS50 AI: CS50 Certificate&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Tools in this guide
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.pluginstackai.com/plugins/claude-code/" rel="noopener noreferrer"&gt;Claude Code&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.pluginstackai.com/plugins/langgraph/" rel="noopener noreferrer"&gt;LangGraph&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;PluginStack is independent and not affiliated with or endorsed by the companies mentioned. Spotted something out of date? Email &lt;a href="mailto:pluginstackai@gmail.com"&gt;pluginstackai@gmail.com&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This guide was first published on &lt;a href="https://www.pluginstackai.com/guides/free-ai-courses/" rel="noopener noreferrer"&gt;PluginStack&lt;/a&gt;. Browse the &lt;a href="https://www.pluginstackai.com/" rel="noopener noreferrer"&gt;PluginStack directory&lt;/a&gt; for more hand-checked MCP servers, plugins and setup guides.&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>ai</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Fix Claude Code MCP "needs authentication" (sign in with /mcp)</title>
      <dc:creator>PluginStack</dc:creator>
      <pubDate>Mon, 30 Nov 2026 18:17:50 +0000</pubDate>
      <link>https://dev.to/pluginstackai/fix-claude-code-mcp-needs-authentication-sign-in-with-mcp-5c95</link>
      <guid>https://dev.to/pluginstackai/fix-claude-code-mcp-needs-authentication-sign-in-with-mcp-5c95</guid>
      <description>&lt;h1&gt;
  
  
  Fix Claude Code MCP "needs authentication"
&lt;/h1&gt;

&lt;p&gt;Checked against the official docs: Oct 27, 2026&lt;/p&gt;

&lt;p&gt;You added a remote MCP server to Claude Code and &lt;code&gt;claude mcp list&lt;/code&gt; shows &lt;code&gt;! Needs authentication&lt;/code&gt;, or a tool call fails and asks you to sign in again. That is not a broken install: Claude Code connected, the server answered 401 or 403, and it is waiting for you to log in. Here is how to finish the sign-in and what to check when it will not stick.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick answer
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Start Claude Code and run &lt;code&gt;/mcp&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Select the server that needs authentication and follow the steps in the browser window that opens to log in and approve access.&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;claude mcp list&lt;/code&gt; (or &lt;code&gt;/mcp&lt;/code&gt; again) and check the server now shows &lt;code&gt;✔ Connected&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Prefer the terminal, or working over SSH? Run &lt;code&gt;claude mcp login &amp;lt;name&amp;gt;&lt;/code&gt; instead (add &lt;code&gt;--no-browser&lt;/code&gt; to get a URL you can open on another machine and paste the redirect URL back). To sign out later, run &lt;code&gt;claude mcp logout &amp;lt;name&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why you see it
&lt;/h2&gt;

&lt;p&gt;Claude Code marks a remote server as needing authentication when the server responds with &lt;code&gt;401 Unauthorized&lt;/code&gt; or &lt;code&gt;403 Forbidden&lt;/code&gt;, so you can complete the OAuth flow. OAuth in Claude Code applies to remote HTTP servers. A local stdio server does not use it; those take keys through environment variables (&lt;code&gt;claude mcp add --env KEY=value ...&lt;/code&gt;), and a failing one is a different problem, covered in &lt;a href="https://www.pluginstackai.com/guides/fix-mcp-error-32000-connection-closed/" rel="noopener noreferrer"&gt;Fix MCP error -32000&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Claude Code stores the tokens it gets and refreshes them automatically. If a stored token is rejected, it refreshes and retries once before it flags the server again, so a flag that keeps returning usually means the refresh token was revoked or expired.&lt;/p&gt;

&lt;h2&gt;
  
  
  Add a server that needs sign-in, then authenticate
&lt;/h2&gt;

&lt;p&gt;The example from the Claude Code docs adds Sentry's remote server. See also the &lt;a href="https://www.pluginstackai.com/plugins/sentry-mcp/" rel="noopener noreferrer"&gt;Sentry MCP listing&lt;/a&gt; and the &lt;a href="https://www.pluginstackai.com/plugins/notion-mcp/" rel="noopener noreferrer"&gt;Notion&lt;/a&gt; and &lt;a href="https://www.pluginstackai.com/plugins/linear-mcp/" rel="noopener noreferrer"&gt;Linear&lt;/a&gt; servers, which use the same flow.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude mcp add --transport http sentry https://mcp.sentry.dev/mcp
claude
&lt;span class="c"&gt;# then inside Claude Code:&lt;/span&gt;
/mcp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you already added the server, running &lt;code&gt;claude mcp add&lt;/code&gt; again with the same name at the same scope fails with a message that the server already exists. Skip straight to &lt;code&gt;/mcp&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;More on adding servers to Claude Code is in &lt;a href="https://www.pluginstackai.com/guides/best-mcp-servers-for-claude-code/" rel="noopener noreferrer"&gt;the best MCP servers for Claude Code&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  If sign-in does not complete
&lt;/h2&gt;

&lt;h3&gt;
  
  
  The browser does not open, or the redirect fails
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;If the browser does not open on its own, copy the URL Claude Code shows and open it manually.&lt;/li&gt;
&lt;li&gt;If the redirect shows a connection error after you approve access, copy the full callback URL from your browser's address bar and paste it into the URL prompt that Claude Code shows.&lt;/li&gt;
&lt;li&gt;Over SSH, or on Linux with no display, &lt;code&gt;claude mcp login &amp;lt;name&amp;gt;&lt;/code&gt; detects there is no local browser and prints the URL instead. Open it on your own machine and paste the redirect URL back. It needs an interactive terminal for that paste step.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  "MCP server needs you to sign in again"
&lt;/h3&gt;

&lt;p&gt;The full message in the Claude Code docs is &lt;code&gt;MCP server "&amp;lt;name&amp;gt;" needs you to sign in again (run /mcp to re-authenticate)&lt;/code&gt;. It means a sign-in expired or was revoked, or the token lacks a permission the tool needs. Run &lt;code&gt;/mcp&lt;/code&gt;, select the server, and choose &lt;strong&gt;Re-authenticate&lt;/strong&gt;. If the same error returns for one specific tool, the token may be missing a scope; Claude Code requests the scopes pinned in the server's config (&lt;code&gt;oauth.scopes&lt;/code&gt;) when they are set, so add the missing scope there before signing in again.&lt;/p&gt;

&lt;h3&gt;
  
  
  You use claude -p or the Agent SDK
&lt;/h3&gt;

&lt;p&gt;Headless runs have no &lt;code&gt;/mcp&lt;/code&gt; panel, so Claude Code cannot run the OAuth flow there. Sign in once from an interactive session (&lt;code&gt;/mcp&lt;/code&gt;, or &lt;code&gt;claude mcp login &amp;lt;name&amp;gt;&lt;/code&gt; in your shell), then start the run again.&lt;/p&gt;

&lt;h3&gt;
  
  
  You set an Authorization header yourself
&lt;/h3&gt;

&lt;p&gt;If the server entry has &lt;code&gt;headers.Authorization&lt;/code&gt; (or a &lt;code&gt;headersHelper&lt;/code&gt;) and the server rejects it, Claude Code reports the connection as failed rather than falling back to OAuth. Fix the token, or remove the header to use the OAuth flow. If the header comes from a &lt;code&gt;${VAR}&lt;/code&gt;, check that the variable is set; Claude Code warns about unset ones in &lt;code&gt;claude mcp list&lt;/code&gt; and &lt;code&gt;/mcp&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  The server requires a pre-registered redirect URI or client
&lt;/h3&gt;

&lt;p&gt;By default Claude Code uses a random free port for the OAuth callback. Servers that only accept a redirect URI of the form &lt;code&gt;http://localhost:PORT/callback&lt;/code&gt; registered in advance need a fixed port, and some need a pre-registered client ID:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Replace the name, URL and ID with your server's&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude mcp add --transport http --callback-port 8080 my-server https://mcp.example.com/mcp

&lt;span class="c"&gt;# with a pre-registered OAuth client (the secret is prompted for, masked)&lt;/span&gt;
claude mcp add --transport http --client-id your-client-id --client-secret --callback-port 8080 my-server https://mcp.example.com/mcp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  The same server name is defined in two scopes
&lt;/h3&gt;

&lt;p&gt;Claude Code stores OAuth sign-ins per endpoint. If one name points at different URLs in different scopes (for example a user-level and a project-level entry), signing in to one does not sign you in to the other, and &lt;code&gt;claude mcp list&lt;/code&gt; warns about the conflict. Keep one definition and remove the rest with &lt;code&gt;claude mcp remove&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Google, Microsoft 365 and other Anthropic-hosted connectors
&lt;/h3&gt;

&lt;p&gt;Some Anthropic-hosted connectors, such as Gmail, Google Calendar and Microsoft 365, do not support local OAuth from Claude Code, because the identity provider only accepts the redirect URL registered by claude.ai. If Claude Code says so, connect the service at claude.ai under &lt;strong&gt;Customize&lt;/strong&gt;, then &lt;strong&gt;Connectors&lt;/strong&gt;, and remove your own entry with &lt;code&gt;claude mcp remove &amp;lt;name&amp;gt;&lt;/code&gt;; the connector then appears in Claude Code on its own.&lt;/p&gt;

&lt;h3&gt;
  
  
  Start fresh
&lt;/h3&gt;

&lt;p&gt;Choose &lt;strong&gt;Clear authentication&lt;/strong&gt; from the server's menu in &lt;code&gt;/mcp&lt;/code&gt;, or run &lt;code&gt;claude mcp logout &amp;lt;name&amp;gt;&lt;/code&gt;, then authenticate again. If that still fails, &lt;code&gt;claude mcp remove &amp;lt;name&amp;gt;&lt;/code&gt; and add the server again.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Is "needs authentication" the same as "Failed to connect"?
&lt;/h3&gt;

&lt;p&gt;No. &lt;code&gt;Failed to connect&lt;/code&gt; means Claude Code could not reach or start the server, and &lt;code&gt;claude mcp get &amp;lt;name&amp;gt;&lt;/code&gt; shows the HTTP status or error text. &lt;code&gt;Needs authentication&lt;/code&gt; means it reached the server, and the server asked for credentials.&lt;/p&gt;

&lt;h3&gt;
  
  
  Does a local server (npx, uvx) use /mcp to sign in?
&lt;/h3&gt;

&lt;p&gt;No. OAuth sign-in is for remote HTTP servers. For a local server, put the API key in its environment with &lt;code&gt;--env&lt;/code&gt; or the &lt;code&gt;env&lt;/code&gt; block of &lt;code&gt;.mcp.json&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I do this for a team without everyone clicking through?
&lt;/h3&gt;

&lt;p&gt;Each person signs in with their own account; tokens are stored per user. Teams can share the server definition through a project &lt;code&gt;.mcp.json&lt;/code&gt; file, but not the credentials.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;p&gt;Commands and config above come from these official docs. Tools change often, so check them for the latest steps.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://code.claude.com/docs/en/mcp" rel="noopener noreferrer"&gt;Claude Code docs: Authenticate with remote MCP servers&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://code.claude.com/docs/en/errors" rel="noopener noreferrer"&gt;Claude Code docs: Error reference (MCP server needs you to sign in again)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://code.claude.com/docs/en/debug-your-config" rel="noopener noreferrer"&gt;Claude Code docs: Debug your configuration (check MCP servers)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Tools in this guide
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.pluginstackai.com/plugins/claude-code/" rel="noopener noreferrer"&gt;Claude Code&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.pluginstackai.com/plugins/sentry-mcp/" rel="noopener noreferrer"&gt;Sentry MCP Server&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.pluginstackai.com/plugins/notion-mcp/" rel="noopener noreferrer"&gt;Notion MCP&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.pluginstackai.com/plugins/linear-mcp/" rel="noopener noreferrer"&gt;Linear MCP&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.pluginstackai.com/plugins/github-mcp-server/" rel="noopener noreferrer"&gt;GitHub MCP Server&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;PluginStack is independent and not affiliated with or endorsed by the companies mentioned. Spotted something out of date? Email &lt;a href="mailto:pluginstackai@gmail.com"&gt;pluginstackai@gmail.com&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This guide was first published on &lt;a href="https://www.pluginstackai.com/guides/fix-claude-code-mcp-needs-authentication/" rel="noopener noreferrer"&gt;PluginStack&lt;/a&gt;. Browse the &lt;a href="https://www.pluginstackai.com/" rel="noopener noreferrer"&gt;PluginStack directory&lt;/a&gt; for more hand-checked MCP servers, plugins and setup guides.&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>ai</category>
      <category>claude</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Fix MCP error -32000 "Connection closed" (causes and fixes)</title>
      <dc:creator>PluginStack</dc:creator>
      <pubDate>Mon, 30 Nov 2026 18:17:42 +0000</pubDate>
      <link>https://dev.to/pluginstackai/fix-mcp-error-32000-connection-closed-causes-and-fixes-3oe5</link>
      <guid>https://dev.to/pluginstackai/fix-mcp-error-32000-connection-closed-causes-and-fixes-3oe5</guid>
      <description>&lt;h1&gt;
  
  
  Fix MCP error -32000: "Connection closed"
&lt;/h1&gt;

&lt;p&gt;Checked against the official docs: Oct 27, 2026&lt;/p&gt;

&lt;p&gt;You add an MCP server, restart your client, and get &lt;code&gt;MCP error -32000: Connection closed&lt;/code&gt;. The message is accurate but unhelpful: it only says that the connection to the server ended. The cause is almost always on the server side, usually in the first second after it launches. This guide shows how to find it fast.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick answer
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;-32000&lt;/code&gt; is the code the MCP SDKs use for &lt;code&gt;ConnectionClosed&lt;/code&gt;. For a local (stdio) server it means the server process exited, or its pipe closed, before the client finished talking to it. So the job is to find out why the server stopped:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Copy the exact &lt;code&gt;command&lt;/code&gt;, &lt;code&gt;args&lt;/code&gt; and &lt;code&gt;env&lt;/code&gt; from your config and run that command yourself in a terminal.&lt;/li&gt;
&lt;li&gt;Read what it prints. A healthy stdio server starts and then waits silently for input. If it prints an error and returns to the prompt, that error is your answer (wrong Node version, missing package, missing API key, bad path).&lt;/li&gt;
&lt;li&gt;Fix that, then restart the client fully. If you are on Windows and the command starts with &lt;code&gt;npx&lt;/code&gt;, try the &lt;a href="https://www.pluginstackai.com/guides/fix-spawn-npx-enoent-windows-mcp/" rel="noopener noreferrer"&gt;&lt;code&gt;cmd /c&lt;/code&gt; fix&lt;/a&gt; first.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The rest of this page covers the usual causes, where to find each client's logs, and how to test a server without any client.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the error means
&lt;/h2&gt;

&lt;p&gt;MCP clients talk to a local server over its standard input and output. When the process behind that pipe ends, the SDK rejects every pending request with &lt;code&gt;MCP error -32000: Connection closed&lt;/code&gt;. We reproduced it with the official TypeScript SDK: a server command that starts and then exits with an error code produces exactly that message. A command that does not exist at all produces a different one, a &lt;code&gt;spawn ... ENOENT&lt;/code&gt; error, because the client could not even start the process.&lt;/p&gt;

&lt;p&gt;The error comes from the client, not the server, so the same server can show it in Claude Code, Claude Desktop, Cursor, VS Code and Codex. What differs between clients is only where the useful detail is logged.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: run the server by hand
&lt;/h2&gt;

&lt;p&gt;This is the same test the Claude Code docs recommend. Run the server's command exactly as written in your config, with the same environment variables:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# example: the official Memory server&lt;/span&gt;
npx -y @modelcontextprotocol/server-memory
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;It starts and sits there:&lt;/strong&gt; the server itself works (press Ctrl+C to stop it). The problem is how the client launches it: the path, the environment, the working directory, or Windows &lt;code&gt;npx&lt;/code&gt; (next section).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It prints an error and exits:&lt;/strong&gt; the message names what is missing, such as a Node.js version, a package, or an environment variable. That is the real cause.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Set any &lt;code&gt;env&lt;/code&gt; values from your config in the same terminal first (for example &lt;code&gt;export API_KEY=...&lt;/code&gt; on macOS and Linux, or &lt;code&gt;$env:API_KEY = "..."&lt;/code&gt; in PowerShell).&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: the common causes
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Windows and &lt;code&gt;npx&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;On native Windows, a client that launches &lt;code&gt;npx&lt;/code&gt; directly can fail to start it. One of the first reports of this exact &lt;code&gt;MCP error -32000: Connection closed&lt;/code&gt; was Claude Code issue #3369 on native Windows. Wrap the command in &lt;code&gt;cmd /c&lt;/code&gt;: see &lt;a href="https://www.pluginstackai.com/guides/fix-spawn-npx-enoent-windows-mcp/" rel="noopener noreferrer"&gt;Fix "spawn npx ENOENT" for MCP servers on Windows&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  The runtime is missing or too old
&lt;/h3&gt;

&lt;p&gt;The server needs Node.js, Python or uv, and the client cannot find it or finds an old copy. Check &lt;code&gt;node --version&lt;/code&gt; in the same environment the client uses. The official TypeScript reference servers declare Node 24 or newer from v2.0.0 (see &lt;a href="https://www.pluginstackai.com/guides/mcp-reference-servers-v2-whats-changed/" rel="noopener noreferrer"&gt;what changed in the MCP reference servers v2&lt;/a&gt;), and a server that needs &lt;code&gt;uvx&lt;/code&gt; needs uv installed. After installing a runtime, quit and reopen the client so it sees the new PATH.&lt;/p&gt;

&lt;h3&gt;
  
  
  A required API key or setting is missing
&lt;/h3&gt;

&lt;p&gt;Many servers exit immediately if a required environment variable is not set. Check the server's README for its variables, and set them in the config's &lt;code&gt;env&lt;/code&gt; block, not only in your shell. Claude Code's troubleshooting notes that a server may miss variables that are not in its own config entry, because the client passes a limited environment to stdio servers.&lt;/p&gt;

&lt;h3&gt;
  
  
  A wrong or relative path
&lt;/h3&gt;

&lt;p&gt;Use absolute paths for local scripts and folders. Claude Code's docs say relative paths in &lt;code&gt;command&lt;/code&gt; or &lt;code&gt;args&lt;/code&gt; are a frequent cause of failed starts, because they resolve against the folder you launched the client from, not the config file's folder. Programs on your PATH, such as &lt;code&gt;npx&lt;/code&gt; or &lt;code&gt;uvx&lt;/code&gt;, are fine as they are.&lt;/p&gt;

&lt;h3&gt;
  
  
  The command was added wrongly (Claude Code)
&lt;/h3&gt;

&lt;p&gt;With &lt;code&gt;claude mcp add&lt;/code&gt;, everything after the &lt;code&gt;--&lt;/code&gt; separator is the server command. If you leave out the &lt;code&gt;--&lt;/code&gt;, or quote the whole command as one string, Claude Code parses the pieces wrongly. Run &lt;code&gt;claude mcp get &amp;lt;name&amp;gt;&lt;/code&gt; and check that the command shown is what you intended; if not, &lt;code&gt;claude mcp remove &amp;lt;name&amp;gt;&lt;/code&gt; and add it again.&lt;/p&gt;

&lt;h3&gt;
  
  
  The package cannot be downloaded
&lt;/h3&gt;

&lt;p&gt;The first &lt;code&gt;npx -y&lt;/code&gt; run downloads the package, which can fail on an offline machine, behind a proxy, or with a broken npm cache. Running the command by hand (Step 1) shows the npm error. A slow first download can instead end as a startup timeout; Claude Code's default is 30 seconds and can be raised with &lt;code&gt;MCP_TIMEOUT=60000 claude&lt;/code&gt;, and Codex's default is 10 seconds, raised with &lt;code&gt;startup_timeout_sec&lt;/code&gt; in &lt;code&gt;config.toml&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  The server crashes on startup, or writes to stdout
&lt;/h3&gt;

&lt;p&gt;If you wrote the server yourself, remember that a stdio server must never print logs to standard output: the MCP docs warn that it corrupts the JSON-RPC messages and breaks the server. Use stderr (&lt;code&gt;console.error&lt;/code&gt; in Node, the &lt;code&gt;logging&lt;/code&gt; module in Python). A plain crash on startup, such as an import error, also ends the connection.&lt;/p&gt;

&lt;p&gt;If you want more help, the (paid) &lt;a href="https://www.pluginstackai.com/packs/" rel="noopener noreferrer"&gt;Agent Builder Rules + Prompts&lt;/a&gt; pack: Only relevant if you are building your own server: the pack has scaffolding prompts for MCP servers in TypeScript and Python, Claude Code skills for MCP work and evals. You do not need it to fix an error with a server someone else made.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: read the client's logs
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Claude Desktop:&lt;/strong&gt; logs are in &lt;code&gt;~/Library/Logs/Claude&lt;/code&gt; on macOS and &lt;code&gt;%APPDATA%\Claude\logs&lt;/code&gt; on Windows. &lt;code&gt;mcp.log&lt;/code&gt; covers connections and failures, and &lt;code&gt;mcp-server-&amp;lt;name&amp;gt;.log&lt;/code&gt; holds that server's stderr output.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Claude Code:&lt;/strong&gt; run &lt;code&gt;/mcp&lt;/code&gt; to see which server failed. &lt;code&gt;claude mcp list&lt;/code&gt; and &lt;code&gt;claude mcp get &amp;lt;name&amp;gt;&lt;/code&gt; show failure details. For a server's stderr, run &lt;code&gt;claude --debug=mcp&lt;/code&gt; and read the log under &lt;code&gt;~/.claude/debug/&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cursor:&lt;/strong&gt; open the Output panel (Cmd+Shift+U on Mac, Ctrl+Shift+U on Windows and Linux) and choose &lt;strong&gt;MCP Logs&lt;/strong&gt;. See &lt;a href="https://www.pluginstackai.com/guides/add-mcp-server-to-cursor/" rel="noopener noreferrer"&gt;how to add an MCP server to Cursor&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;VS Code:&lt;/strong&gt; run &lt;strong&gt;MCP: List Servers&lt;/strong&gt; from the Command Palette, pick the server, and choose to show its output.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Codex:&lt;/strong&gt; run &lt;code&gt;codex mcp list&lt;/code&gt; to check the entry, and type &lt;code&gt;/mcp&lt;/code&gt; in the terminal UI to see active servers.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 4: test the server without a client
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://www.pluginstackai.com/plugins/mcp-inspector/" rel="noopener noreferrer"&gt;MCP Inspector&lt;/a&gt; runs your server and lets you list and call its tools in a browser, with the client taken out of the picture. If the server works there, the problem is your client config; if it fails there too, the server is the problem.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Inspector, then your server's command and arguments (this example launches a locally built Node server)&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx @modelcontextprotocol/inspector node build/index.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Is -32000 always a local server problem?
&lt;/h3&gt;

&lt;p&gt;The code means "connection closed", which can also happen with a remote server if the connection drops. The advice above is for local stdio servers, which is where this error shows up most. For a remote server that needs sign-in, see &lt;a href="https://www.pluginstackai.com/guides/fix-claude-code-mcp-needs-authentication/" rel="noopener noreferrer"&gt;Claude Code MCP "needs authentication"&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  It worked yesterday. What changed?
&lt;/h3&gt;

&lt;p&gt;Usually the runtime or the package. With &lt;code&gt;npx -y&lt;/code&gt; and no version, npx fetches the latest release on each launch, so a server update (or a Node update on your machine) can change behaviour. The official reference servers moved to v2 in October 2026; pinning a version with &lt;code&gt;package@version&lt;/code&gt; is a quick way to test.&lt;/p&gt;

&lt;h3&gt;
  
  
  Does a stdout log line cause this error?
&lt;/h3&gt;

&lt;p&gt;The MCP docs say writing to stdout from a stdio server corrupts the protocol and breaks the server. We could not show that a stray stdout line by itself produces &lt;code&gt;-32000&lt;/code&gt; in our own test, so treat it as a likely cause for a custom server and rely on Step 1 to confirm it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;p&gt;Commands and config above come from these official docs. Tools change often, so check them for the latest steps.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/modelcontextprotocol/typescript-sdk" rel="noopener noreferrer"&gt;MCP TypeScript SDK (ConnectionClosed error code -32000)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://modelcontextprotocol.io/docs/tools/debugging" rel="noopener noreferrer"&gt;Model Context Protocol docs: Debugging&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://modelcontextprotocol.io/docs/develop/connect-local-servers" rel="noopener noreferrer"&gt;Model Context Protocol docs: Connect to local MCP servers (logs, troubleshooting)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://modelcontextprotocol.io/docs/develop/build-server" rel="noopener noreferrer"&gt;Model Context Protocol docs: Build an MCP server (logging to stdout)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://code.claude.com/docs/en/mcp" rel="noopener noreferrer"&gt;Claude Code docs: Connect Claude Code to tools via MCP&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://code.claude.com/docs/en/debug-your-config" rel="noopener noreferrer"&gt;Claude Code docs: Debug your configuration&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/anthropics/claude-code/issues/3369" rel="noopener noreferrer"&gt;Claude Code issue #3369: MCP fails on native Windows (user report)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://learn.chatgpt.com/docs/config-file/config-reference" rel="noopener noreferrer"&gt;OpenAI Codex docs: Configuration reference (startup_timeout_sec)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://code.visualstudio.com/docs/agent-customization/mcp-servers" rel="noopener noreferrer"&gt;VS Code docs: Add and manage MCP servers&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://cursor.com/docs/mcp" rel="noopener noreferrer"&gt;Cursor docs: MCP&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Tools in this guide
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.pluginstackai.com/plugins/mcp-inspector/" rel="noopener noreferrer"&gt;MCP Inspector&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.pluginstackai.com/plugins/filesystem-mcp/" rel="noopener noreferrer"&gt;Filesystem MCP Server&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.pluginstackai.com/plugins/memory-mcp/" rel="noopener noreferrer"&gt;Memory MCP Server&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.pluginstackai.com/plugins/claude-code/" rel="noopener noreferrer"&gt;Claude Code&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.pluginstackai.com/plugins/codex-cli/" rel="noopener noreferrer"&gt;Codex CLI&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;PluginStack is independent and not affiliated with or endorsed by the companies mentioned. Spotted something out of date? Email &lt;a href="mailto:pluginstackai@gmail.com"&gt;pluginstackai@gmail.com&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This guide was first published on &lt;a href="https://www.pluginstackai.com/guides/fix-mcp-error-32000-connection-closed/" rel="noopener noreferrer"&gt;PluginStack&lt;/a&gt;. Browse the &lt;a href="https://www.pluginstackai.com/" rel="noopener noreferrer"&gt;PluginStack directory&lt;/a&gt; for more hand-checked MCP servers, plugins and setup guides.&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>ai</category>
      <category>debugging</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How to connect the Cloudflare MCP server (Claude Code, Cursor, VS Code, Codex)</title>
      <dc:creator>PluginStack</dc:creator>
      <pubDate>Mon, 30 Nov 2026 18:17:13 +0000</pubDate>
      <link>https://dev.to/pluginstackai/how-to-connect-the-cloudflare-mcp-server-claude-code-cursor-vs-code-codex-jeh</link>
      <guid>https://dev.to/pluginstackai/how-to-connect-the-cloudflare-mcp-server-claude-code-cursor-vs-code-codex-jeh</guid>
      <description>&lt;h1&gt;
  
  
  How to connect the Cloudflare MCP server
&lt;/h1&gt;

&lt;p&gt;Checked against the official docs: Nov 2, 2026&lt;/p&gt;

&lt;p&gt;Cloudflare runs its own remote MCP servers, so you don't install anything: you add a URL to your client and sign in. This guide covers which of Cloudflare's servers to use, the exact setup in each client, when to use an API token instead of OAuth, how MCP server portals fit in, and the errors people hit. It's based on Cloudflare's developer docs and the &lt;code&gt;cloudflare/mcp&lt;/code&gt; and &lt;code&gt;cloudflare/mcp-server-cloudflare&lt;/code&gt; READMEs (checked 2 November 2026).&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick answer
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;URL:&lt;/strong&gt; &lt;code&gt;https://mcp.cloudflare.com/mcp&lt;/code&gt;. This server covers the whole Cloudflare API.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sign-in:&lt;/strong&gt; OAuth. Your client opens Cloudflare in the browser and you choose which permissions to grant. For CI, send a Cloudflare API token as a Bearer header instead.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Docs only:&lt;/strong&gt; &lt;code&gt;https://docs.mcp.cloudflare.com/mcp&lt;/code&gt; searches Cloudflare's documentation and needs no sign-in.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Old SSE URLs&lt;/strong&gt; now return 410 Gone. Replace them with the Streamable HTTP URL (it ends in mcp).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Which Cloudflare MCP server to use
&lt;/h2&gt;

&lt;p&gt;The API server at &lt;code&gt;mcp.cloudflare.com/mcp&lt;/code&gt; uses what Cloudflare calls Code Mode. Instead of one tool per API endpoint, it exposes a few tools: &lt;code&gt;search&lt;/code&gt; to find endpoints, &lt;code&gt;execute&lt;/code&gt; to run code against the API, &lt;code&gt;docs&lt;/code&gt; and &lt;code&gt;whoami&lt;/code&gt;. That covers about 2,500 endpoints in roughly a thousand tokens of tool definitions. Cloudflare recommends it for most account work: Workers, DNS, KV, R2, zones and so on.&lt;/p&gt;

&lt;p&gt;Cloudflare also runs product servers at &lt;code&gt;&amp;lt;name&amp;gt;.mcp.cloudflare.com/mcp&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;docs&lt;/code&gt;: searches the Cloudflare docs. No sign-in needed.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;browser&lt;/code&gt;: Browser Run, which fetches pages, takes screenshots and converts pages to markdown.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;containers&lt;/code&gt;: a sandbox container for running code.&lt;/li&gt;
&lt;li&gt;Others for Cloudflare One (&lt;code&gt;dex&lt;/code&gt;, &lt;code&gt;casb&lt;/code&gt;) and the Cloudflare blog.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Cloudflare's README marks several older servers as deprecated in favour of the API server, including observability, bindings, builds, logs, GraphQL, Radar and AI Gateway. If a tutorial tells you to add one of those, use &lt;code&gt;mcp.cloudflare.com/mcp&lt;/code&gt; instead. The full list of servers and what each does is on &lt;a href="https://www.pluginstackai.com/plugins/cloudflare-mcp/" rel="noopener noreferrer"&gt;the Cloudflare MCP listing&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Connect it to your client
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Claude Code
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude mcp add --transport http cloudflare-api https://mcp.cloudflare.com/mcp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;claude mcp list&lt;/code&gt; will show "Needs authentication" at first. That is expected. Run &lt;code&gt;/mcp&lt;/code&gt; inside Claude Code, pick &lt;code&gt;cloudflare-api&lt;/code&gt; and sign in in the browser. If it stays stuck, see &lt;a href="https://www.pluginstackai.com/guides/fix-claude-code-mcp-needs-authentication/" rel="noopener noreferrer"&gt;fixing "needs authentication" in Claude Code&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Cursor
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;~/.cursor/mcp.json&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"mcpServers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"cloudflare-api"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"https://mcp.cloudflare.com/mcp"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open &lt;strong&gt;Customize → MCPs&lt;/strong&gt;. Cursor offers to sign in when the server needs OAuth. More: &lt;a href="https://www.pluginstackai.com/guides/add-mcp-server-to-cursor/" rel="noopener noreferrer"&gt;how to add an MCP server to Cursor&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  VS Code (GitHub Copilot)
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;.vscode/mcp.json&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"servers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"cloudflare-api"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"http"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"https://mcp.cloudflare.com/mcp"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When the server starts, VS Code asks you to sign in to Cloudflare. Accept the prompt and finish the sign-in in the browser. More: &lt;a href="https://www.pluginstackai.com/guides/add-mcp-server-to-vs-code/" rel="noopener noreferrer"&gt;how to add an MCP server to VS Code&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Codex
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;codex mcp add cloudflare-api --url https://mcp.cloudflare.com/mcp
codex mcp login cloudflare-api   &lt;span class="c"&gt;# if the sign-in did not start on its own&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Codex may start the browser sign-in straight away when you add the server. &lt;code&gt;codex mcp list&lt;/code&gt; shows "Not logged in" until you finish it. More: &lt;a href="https://www.pluginstackai.com/guides/add-mcp-server-to-codex-config-toml/" rel="noopener noreferrer"&gt;how to add an MCP server to Codex&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Claude Desktop and claude.ai
&lt;/h3&gt;

&lt;p&gt;Add &lt;code&gt;https://mcp.cloudflare.com/mcp&lt;/code&gt; as a custom connector and sign in when asked. Don't put the URL in &lt;code&gt;claude_desktop_config.json&lt;/code&gt;, which is for local servers. Steps: &lt;a href="https://www.pluginstackai.com/guides/add-mcp-server-to-claude-desktop/" rel="noopener noreferrer"&gt;how to add an MCP server to Claude Desktop&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Clients that only support local (stdio) servers
&lt;/h3&gt;

&lt;p&gt;Use the community &lt;code&gt;mcp-remote&lt;/code&gt; package as a bridge. It runs locally, connects to the remote URL and handles the OAuth sign-in:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"mcpServers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"cloudflare-api"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"npx"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"-y"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"mcp-remote"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"https://mcp.cloudflare.com/mcp"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Only use it when your client can't connect to remote servers directly. Every client above can.&lt;/p&gt;

&lt;h2&gt;
  
  
  OAuth or an API token?
&lt;/h2&gt;

&lt;p&gt;Cloudflare recommends &lt;strong&gt;OAuth&lt;/strong&gt; for people. You choose permissions on Cloudflare's consent screen, and nothing secret is stored in your config file. If you later ask for something your grant doesn't cover, the server asks you to sign in again with the extra permission. In Claude this shows as a 403 &lt;code&gt;insufficient_scope&lt;/code&gt; challenge; Codex and ChatGPT show it in the tool result.&lt;/p&gt;

&lt;p&gt;Use an &lt;strong&gt;API token&lt;/strong&gt; for CI and scripts, where no one can click through a browser sign-in. Create one in the Cloudflare dashboard with only the permissions the job needs. Both user tokens and account tokens work. Account tokens also need the &lt;strong&gt;Account Resources : Read&lt;/strong&gt; permission so the server can find the account ID. Tokens with Client IP Address Filtering aren't supported.&lt;/p&gt;

&lt;p&gt;Send the token as a Bearer header. Keep it in an environment variable, not in the file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Claude Code: the shell fills in the variable now, so the token is saved in ~/.claude.json&lt;/span&gt;
claude mcp add --transport http cloudflare-api https://mcp.cloudflare.com/mcp \
  --header &lt;span class="s2"&gt;"Authorization: Bearer $CLOUDFLARE_API_TOKEN"&lt;/span&gt;

&lt;span class="c"&gt;# Codex: reads the variable each time it connects&lt;/span&gt;
codex mcp add cloudflare-api --url https://mcp.cloudflare.com/mcp --bearer-token-env-var CLOUDFLARE_API_TOKEN
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Cursor: ~/.cursor/mcp.json (VS Code accepts the same ${env:...} form in .vscode/mcp.json)&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"mcpServers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"cloudflare-api"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"https://mcp.cloudflare.com/mcp"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"headers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"Authorization"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Bearer ${env:CLOUDFLARE_API_TOKEN}"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Once a client sends an &lt;code&gt;Authorization&lt;/code&gt; header, it won't also try OAuth. A bad token fails with HTTP 401. Claude Code reports it as "Server rejected the configured Authorization header (HTTP 401)" and notes that OAuth fallback is disabled. Remove the header to go back to signing in.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Optional: one tool per endpoint
&lt;/h2&gt;

&lt;p&gt;Adding &lt;code&gt;?codemode=false&lt;/code&gt; to the URL (&lt;code&gt;https://mcp.cloudflare.com/mcp?codemode=false&lt;/code&gt;) registers a separate tool for every API endpoint. Cloudflare puts that at about 244,000 tokens of tool definitions, which is more than many models' whole context. Stick with the default unless your client needs plain tools.&lt;/p&gt;

&lt;h2&gt;
  
  
  MCP server portals (teams)
&lt;/h2&gt;

&lt;p&gt;An MCP server portal is a Cloudflare One (Zero Trust) feature that puts several remote MCP servers behind one URL, with Cloudflare Access deciding who can use which servers and tools. It suits teams that want one approved endpoint instead of every developer adding servers on their own. You need a domain on Cloudflare and an identity provider set up in Zero Trust.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In the Cloudflare One dashboard, go to &lt;strong&gt;Zero Trust → Access controls → MCP Portals&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;On the &lt;strong&gt;MCP servers&lt;/strong&gt; tab, add each server with a name and its HTTP URL (for example &lt;code&gt;https://docs.mcp.cloudflare.com/mcp&lt;/code&gt;), attach Access policies, then save and connect. The status changes to Ready once Cloudflare can reach it.&lt;/li&gt;
&lt;li&gt;Add a portal: give it a name and a custom domain on one of your zones, choose its servers and the tools and prompts to expose, and attach Access policies.&lt;/li&gt;
&lt;li&gt;Point clients at &lt;code&gt;https://&amp;lt;subdomain&amp;gt;.&amp;lt;your-domain&amp;gt;/mcp&lt;/code&gt;. Users sign in through Access the first time they connect.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Limits to know: portals only work with remote HTTP servers, not stdio-only ones. A portal holds up to 80 servers. Some Access features, such as independent MFA and purpose justification, aren't enforced through a portal. A portal policy also doesn't stop someone who has a server's direct URL, so lock down the servers themselves too. For automation, Access service tokens let a machine connect without a browser sign-in.&lt;/p&gt;

&lt;h2&gt;
  
  
  Check that it works
&lt;/h2&gt;

&lt;p&gt;Ask the agent "Which Cloudflare account am I connected to?", which should call &lt;code&gt;whoami&lt;/code&gt;. Then try something read-only, such as "List my Workers". To test the connection outside any client, list the docs server's tools with the &lt;a href="https://www.pluginstackai.com/plugins/mcp-inspector/" rel="noopener noreferrer"&gt;MCP Inspector&lt;/a&gt; CLI:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx -y @modelcontextprotocol/inspector --cli https://docs.mcp.cloudflare.com/mcp --transport http --method tools/list
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The output should include &lt;code&gt;search_cloudflare_documentation&lt;/code&gt;. The API server returns 401 to the Inspector until you sign in, which is expected.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The API server can change real settings: DNS records, Workers, firewall rules. Start with read-only requests, grant only the permissions you need, and read each &lt;code&gt;execute&lt;/code&gt; call before you approve it.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Troubleshooting
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;410 Gone:&lt;/strong&gt; you're using an old &lt;code&gt;/sse&lt;/code&gt; URL. Cloudflare retired SSE. Change the URL to end in &lt;code&gt;/mcp&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;401 Unauthorized:&lt;/strong&gt; you haven't signed in yet, or the token is wrong. Finish the OAuth sign-in (&lt;code&gt;/mcp&lt;/code&gt; in Claude Code, &lt;code&gt;codex mcp login&lt;/code&gt; in Codex), or check the token and the &lt;code&gt;Bearer&lt;/code&gt; prefix.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;403 or "insufficient scope":&lt;/strong&gt; your grant doesn't include what you asked for. Accept the re-authorization prompt, or add the permission to your API token.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The server can't find your account:&lt;/strong&gt; an account token is missing &lt;strong&gt;Account Resources : Read&lt;/strong&gt;. Add it, or use a user token.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A token that works in curl fails here:&lt;/strong&gt; it may have Client IP Address Filtering, which the server doesn't support.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;"Claude's response was interrupted":&lt;/strong&gt; usually the context filled up. Results are capped at about 6,000 tokens and marked &lt;code&gt;--- TRUNCATED ---&lt;/code&gt;, so ask a narrower question, such as one zone instead of all of them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A feature returns an error on a free account:&lt;/strong&gt; some products need a paid Workers plan.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Related: Cloudflare skills and building your own server
&lt;/h2&gt;

&lt;p&gt;Cloudflare also publishes agent skills for its platform. In Claude Code, add them with &lt;code&gt;/plugin marketplace add cloudflare/skills&lt;/code&gt;, or install them with &lt;code&gt;npx skills add https://github.com/cloudflare/skills&lt;/code&gt; (see &lt;a href="https://www.pluginstackai.com/guides/how-to-create-agent-skills/" rel="noopener noreferrer"&gt;how to create agent skills&lt;/a&gt;). To build and host your own MCP server on Workers, the &lt;a href="https://www.pluginstackai.com/plugins/cloudflare-mcp/" rel="noopener noreferrer"&gt;Cloudflare MCP listing&lt;/a&gt; has the starter template command.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Do I need a paid Cloudflare plan?
&lt;/h3&gt;

&lt;p&gt;You need a Cloudflare account. Anything you create or run through the server is billed like any other use of your account, and Cloudflare's README notes that some features need a paid Workers plan.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is the difference between cloudflare/mcp and cloudflare/mcp-server-cloudflare?
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;cloudflare/mcp&lt;/code&gt; is the repository for the Code Mode API server at &lt;code&gt;mcp.cloudflare.com/mcp&lt;/code&gt;. &lt;code&gt;cloudflare/mcp-server-cloudflare&lt;/code&gt; holds the product servers, such as docs, Browser Run and containers, plus the deprecated ones.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I run the Cloudflare MCP server locally?
&lt;/h3&gt;

&lt;p&gt;You don't need to. The servers are hosted, and clients connect over HTTP. If your client only runs local servers, use &lt;code&gt;mcp-remote&lt;/code&gt; as shown above.&lt;/p&gt;

&lt;h3&gt;
  
  
  Does it work with ChatGPT?
&lt;/h3&gt;

&lt;p&gt;Cloudflare's docs mention ChatGPT alongside Claude and Codex. Any client that can connect to a remote MCP server with OAuth can use it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;p&gt;Commands and config above come from these official docs. Tools change often, so check them for the latest steps.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://developers.cloudflare.com/agents/model-context-protocol/cloudflare/servers-for-cloudflare/" rel="noopener noreferrer"&gt;Cloudflare docs: Cloudflare's own MCP servers&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/cloudflare/mcp" rel="noopener noreferrer"&gt;cloudflare/mcp README (API server)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/cloudflare/mcp-server-cloudflare" rel="noopener noreferrer"&gt;cloudflare/mcp-server-cloudflare README&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developers.cloudflare.com/cloudflare-one/access-controls/ai-controls/mcp-portals/" rel="noopener noreferrer"&gt;Cloudflare One docs: MCP server portals&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/geelen/mcp-remote" rel="noopener noreferrer"&gt;mcp-remote README&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Tools in this guide
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.pluginstackai.com/plugins/cloudflare-mcp/" rel="noopener noreferrer"&gt;Cloudflare MCP Servers&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;PluginStack is independent and not affiliated with or endorsed by the companies mentioned. Spotted something out of date? Email &lt;a href="mailto:pluginstackai@gmail.com"&gt;pluginstackai@gmail.com&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This guide was first published on &lt;a href="https://www.pluginstackai.com/guides/cloudflare-mcp-server-setup/" rel="noopener noreferrer"&gt;PluginStack&lt;/a&gt;. Browse the &lt;a href="https://www.pluginstackai.com/" rel="noopener noreferrer"&gt;PluginStack directory&lt;/a&gt; for more hand-checked MCP servers, plugins and setup guides.&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>ai</category>
      <category>cloudflare</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How to set up the Memory MCP server (local knowledge graph memory)</title>
      <dc:creator>PluginStack</dc:creator>
      <pubDate>Mon, 30 Nov 2026 18:17:04 +0000</pubDate>
      <link>https://dev.to/pluginstackai/how-to-set-up-the-memory-mcp-server-local-knowledge-graph-memory-3kib</link>
      <guid>https://dev.to/pluginstackai/how-to-set-up-the-memory-mcp-server-local-knowledge-graph-memory-3kib</guid>
      <description>&lt;h1&gt;
  
  
  How to set up the Memory MCP server in Claude Code, Claude Desktop, Cursor, VS Code and Codex
&lt;/h1&gt;

&lt;p&gt;Checked against the official docs: Nov 11, 2026&lt;/p&gt;

&lt;p&gt;The Memory MCP server is one of the official reference servers from the Model Context Protocol project. It gives an assistant a simple long-term memory: a knowledge graph of people, projects and facts, saved in a local file and read back in later chats. This guide covers the one setting most setups get wrong (where the memory file lives), the config for each client, Docker, the tools it adds, and fixes for common problems. It's based on the server's README and the &lt;code&gt;@modelcontextprotocol/server-memory&lt;/code&gt; package on npm, version 2.1.1 (checked 11 November 2026).&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick answer
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Install Node.js 24 or later. The server needs it when it runs through &lt;code&gt;npx&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Create a folder for the memory file, for example &lt;code&gt;~/.mcp-memory&lt;/code&gt;. The server creates the file but not the folder.&lt;/li&gt;
&lt;li&gt;Add the server with &lt;code&gt;npx -y @modelcontextprotocol/server-memory&lt;/code&gt; and set &lt;code&gt;MEMORY_FILE_PATH&lt;/code&gt; to an absolute path such as &lt;code&gt;~/.mcp-memory/memory.jsonl&lt;/code&gt;. In Claude Code: &lt;code&gt;claude mcp add memory --scope user --env MEMORY_FILE_PATH=$HOME/.mcp-memory/memory.jsonl -- npx -y @modelcontextprotocol/server-memory&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Tell the assistant when to save and recall memories (a short instruction is enough), then restart the client.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Skipping &lt;code&gt;MEMORY_FILE_PATH&lt;/code&gt; is the classic mistake. The default file sits inside npm's package cache, so an update or a cleared npx cache can delete everything the assistant has remembered.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the Memory server does
&lt;/h2&gt;

&lt;p&gt;The server stores a knowledge graph with three kinds of data:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Entities:&lt;/strong&gt; named things with a type, such as a person, a project or an organization.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Relations:&lt;/strong&gt; directed links between entities, written in active voice, such as &lt;code&gt;works_at&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Observations:&lt;/strong&gt; short facts attached to an entity, one fact each, such as "Prefers morning meetings".&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The assistant reads and writes the graph through MCP tools. Nothing is stored in the cloud by the server itself: the graph lives in one local file in JSON Lines format. It is "memory" in a basic sense. The assistant has to decide to save something and to look it up again, which is why the instruction in step 4 matters. For a shorter overview, see the &lt;a href="https://www.pluginstackai.com/plugins/memory-mcp/" rel="noopener noreferrer"&gt;Memory MCP Server listing&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Before you start: choose where the memory file lives
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;MEMORY_FILE_PATH&lt;/code&gt; sets the file. If you leave it out, the server uses &lt;code&gt;memory.jsonl&lt;/code&gt; in its own package directory. Under &lt;code&gt;npx&lt;/code&gt; or an npm install, that directory is inside a &lt;code&gt;node_modules&lt;/code&gt; tree that npm manages, so reinstalling or updating the server, or clearing the npx cache, can delete the file. A relative path has the same problem, because it resolves against that same directory.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use an absolute path in a folder you own. A leading &lt;code&gt;~&lt;/code&gt; expands to your home directory, so &lt;code&gt;~/.mcp-memory/memory.jsonl&lt;/code&gt; works in the JSON and TOML configs below.&lt;/li&gt;
&lt;li&gt;Create the folder first: &lt;code&gt;mkdir -p ~/.mcp-memory&lt;/code&gt; on macOS or Linux. The server creates the file, not the folders above it.&lt;/li&gt;
&lt;li&gt;If the server finds its memory file inside &lt;code&gt;node_modules&lt;/code&gt;, it prints a warning on stderr at startup naming the file. Most clients show this in the server's log.&lt;/li&gt;
&lt;li&gt;Already have a graph in the default location? Move the file to the new path when you set the variable, or the server starts with an empty graph.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Claude Code
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;mkdir -p ~/.mcp-memory
claude mcp add memory --scope user --env &lt;span class="nv"&gt;MEMORY_FILE_PATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$HOME&lt;/span&gt;/.mcp-memory/memory.jsonl \
  -- npx -y @modelcontextprotocol/server-memory
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;--scope user&lt;/code&gt; makes the server available in every project. Leave it out to add it to the current project only. Everything after &lt;code&gt;--&lt;/code&gt; is the command that starts the server. Your shell fills in &lt;code&gt;$HOME&lt;/code&gt; when you run the command, so the saved config has the full path. Run &lt;code&gt;claude mcp get memory&lt;/code&gt; to check the command and path, then &lt;code&gt;/mcp&lt;/code&gt; inside Claude Code to see it connected. More on Claude Code: &lt;a href="https://www.pluginstackai.com/guides/best-mcp-servers-for-claude-code/" rel="noopener noreferrer"&gt;the best MCP servers for Claude Code&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Claude Desktop
&lt;/h2&gt;

&lt;p&gt;Add this to &lt;code&gt;claude_desktop_config.json&lt;/code&gt;, then fully quit and reopen Claude Desktop. If you haven't edited that file before, see &lt;a href="https://www.pluginstackai.com/guides/add-mcp-server-to-claude-desktop/" rel="noopener noreferrer"&gt;how to add an MCP server to Claude Desktop&lt;/a&gt; for where it is.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;macOS or Linux&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"mcpServers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"memory"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"npx"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"-y"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"@modelcontextprotocol/server-memory"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"env"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nl"&gt;"MEMORY_FILE_PATH"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"~/.mcp-memory/memory.jsonl"&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On Windows, the README launches &lt;code&gt;npx&lt;/code&gt; through &lt;code&gt;cmd /c&lt;/code&gt;. In JSON, backslashes in the path must be doubled:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Windows&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"mcpServers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"memory"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"cmd"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"/c"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"npx"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"-y"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"@modelcontextprotocol/server-memory"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"env"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nl"&gt;"MEMORY_FILE_PATH"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"C:\\Users\\you\\.mcp-memory\\memory.jsonl"&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Cursor
&lt;/h2&gt;

&lt;p&gt;Cursor uses the same &lt;code&gt;mcpServers&lt;/code&gt; block. Put it in &lt;code&gt;~/.cursor/mcp.json&lt;/code&gt; to use memory in all projects, or &lt;code&gt;.cursor/mcp.json&lt;/code&gt; in one project, then restart Cursor and check the server is switched on under &lt;strong&gt;Customize&lt;/strong&gt; &amp;gt; &lt;strong&gt;MCPs&lt;/strong&gt;. Details: &lt;a href="https://www.pluginstackai.com/guides/add-mcp-server-to-cursor/" rel="noopener noreferrer"&gt;how to add an MCP server to Cursor&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  VS Code
&lt;/h2&gt;

&lt;p&gt;The server's README gives this block for VS Code's own format (top-level &lt;code&gt;servers&lt;/code&gt;), in your user &lt;code&gt;mcp.json&lt;/code&gt; (Command Palette &amp;gt; &lt;strong&gt;MCP: Open User Configuration&lt;/strong&gt;) or &lt;code&gt;.vscode/mcp.json&lt;/code&gt; in a workspace:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"servers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"memory"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"npx"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"-y"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"@modelcontextprotocol/server-memory"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"env"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nl"&gt;"MEMORY_FILE_PATH"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"~/.mcp-memory/memory.jsonl"&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;VS Code also reads the portable &lt;code&gt;mcpServers&lt;/code&gt; format, and the two don't mix in one file. See &lt;a href="https://www.pluginstackai.com/guides/add-mcp-server-to-vs-code/" rel="noopener noreferrer"&gt;how to add an MCP server to VS Code&lt;/a&gt; for which file uses which key.&lt;/p&gt;

&lt;h2&gt;
  
  
  Codex
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;codex mcp add memory --env &lt;span class="nv"&gt;MEMORY_FILE_PATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$HOME&lt;/span&gt;/.mcp-memory/memory.jsonl -- npx -y @modelcontextprotocol/server-memory
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or add it to &lt;code&gt;~/.codex/config.toml&lt;/code&gt; yourself:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;~/.codex/config.toml&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[mcp_servers.memory]
command = "npx"
args = ["-y", "@modelcontextprotocol/server-memory"]

[mcp_servers.memory.env]
MEMORY_FILE_PATH = "~/.mcp-memory/memory.jsonl"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;More on Codex config: &lt;a href="https://www.pluginstackai.com/guides/add-mcp-server-to-codex-config-toml/" rel="noopener noreferrer"&gt;how to add an MCP server to Codex&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Docker
&lt;/h2&gt;

&lt;p&gt;The README's Docker setup mounts a named volume over the image's code directory, &lt;code&gt;/app/dist&lt;/code&gt;, so the graph survives restarts:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"mcpServers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"memory"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"docker"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"run"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"-i"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"-v"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"claude-memory:/app/dist"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"--rm"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"mcp/memory"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The catch: that volume also holds the server's code, and Docker only copies an image's files into a named volume while it is empty. After the first run, pulling a newer image does not update the server in the volume. The README's alternative keeps the graph in a volume of its own, so a new image takes effect with no extra step:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"mcpServers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"memory"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"docker"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"run"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"-i"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"-v"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"claude-memory-data:/data"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"-e"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"MEMORY_FILE_PATH=/data/memory.jsonl"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"--rm"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"mcp/memory"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To move an existing graph from the old volume to the new one, quit the clients that start the server, then run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run --rm -v claude-memory:/old -v claude-memory-data:/data \
  --entrypoint cp mcp/memory /old/memory.jsonl /data/memory.jsonl
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you stay on the original setup, the README has an upgrade command that replaces the code in the volume and keeps &lt;code&gt;memory.jsonl&lt;/code&gt; (see Troubleshooting below for the &lt;code&gt;EACCES&lt;/code&gt; error it also fixes).&lt;/p&gt;

&lt;h2&gt;
  
  
  Tell the assistant when to use memory
&lt;/h2&gt;

&lt;p&gt;The server only provides the tools. How often the assistant saves and recalls things depends on your instructions. The README's example is written for chat personalization and goes in a Claude.ai Project's custom instructions. For a coding agent, a few lines in the place it reads standing instructions (such as &lt;code&gt;CLAUDE.md&lt;/code&gt; or &lt;code&gt;AGENTS.md&lt;/code&gt;) do the same job. A short version:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;At the start of a task, search your memory for anything relevant to this project.
When I tell you a lasting preference or a fact about this project, save it to memory
as an observation on the right entity. Keep each observation to one fact.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Not sure which instructions file your tool reads? See &lt;a href="https://www.pluginstackai.com/guides/cursor-rules-vs-agents-md/" rel="noopener noreferrer"&gt;Cursor rules vs AGENTS.md&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The tools it adds
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;create_entities&lt;/code&gt;: add entities. Names that already exist are skipped (their observations are not added), and the result lists what was skipped.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;create_relations&lt;/code&gt;: link two existing entities. Duplicates are skipped; it fails if either entity doesn't exist.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;add_observations&lt;/code&gt;: add facts to existing entities.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;delete_entities&lt;/code&gt;: remove entities and every relation that touches them.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;delete_observations&lt;/code&gt; and &lt;code&gt;delete_relations&lt;/code&gt;: remove single facts or links. A relation is only deleted when &lt;code&gt;from&lt;/code&gt;, &lt;code&gt;to&lt;/code&gt; and &lt;code&gt;relationType&lt;/code&gt; all match exactly.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;read_graph&lt;/code&gt;: read the whole graph. &lt;code&gt;observationLimit: 0&lt;/code&gt; returns names, types and counts only, which is a cheap overview of a large graph. &lt;code&gt;entityTypes&lt;/code&gt; filters by type.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;search_nodes&lt;/code&gt;: search names, types and observation text. Optional &lt;code&gt;limit&lt;/code&gt; and &lt;code&gt;observationLimit&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;open_nodes&lt;/code&gt;: read specific entities by name.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The whole graph is also available as an MCP resource, &lt;code&gt;memory://knowledge-graph&lt;/code&gt;, and the write tools send update notifications for it to clients that subscribe.&lt;/p&gt;

&lt;h2&gt;
  
  
  Using one memory file from several clients
&lt;/h2&gt;

&lt;p&gt;Each client starts its own server process, so Claude Desktop and Claude Code pointed at the same &lt;code&gt;MEMORY_FILE_PATH&lt;/code&gt; are two processes writing one file. The write tools take a lock file (&lt;code&gt;&amp;lt;memory file&amp;gt;.lock&lt;/code&gt;) next to the memory file, so writes take turns instead of overwriting each other. Saves are atomic, so a server killed mid-save leaves the previous graph intact.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The folder holding the memory file must be writable, because the lock file and the temporary save file go there.&lt;/li&gt;
&lt;li&gt;A write that can't get the lock within 60 seconds fails with a tool error rather than overwriting the file.&lt;/li&gt;
&lt;li&gt;The lock relies on local-filesystem behavior. Don't share one memory file over a network drive.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Check that it works
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Restart the client and check the &lt;code&gt;memory&lt;/code&gt; server is connected (&lt;code&gt;/mcp&lt;/code&gt; in Claude Code, the MCP list in Cursor or VS Code).&lt;/li&gt;
&lt;li&gt;Ask: "Remember that my main project uses Next.js and Supabase." The assistant should call &lt;code&gt;create_entities&lt;/code&gt; or &lt;code&gt;add_observations&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Open the file at your &lt;code&gt;MEMORY_FILE_PATH&lt;/code&gt; and check the new entry is there.&lt;/li&gt;
&lt;li&gt;Start a new chat and ask: "What do you remember about my main project?" It should call &lt;code&gt;search_nodes&lt;/code&gt; or &lt;code&gt;open_nodes&lt;/code&gt; and answer from memory.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Troubleshooting
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The memory was gone after an update:&lt;/strong&gt; the file was in the default location inside &lt;code&gt;node_modules&lt;/code&gt;. Set &lt;code&gt;MEMORY_FILE_PATH&lt;/code&gt; to an absolute path outside it. Check the server log for the startup warning that names the file it is using.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The server won't start:&lt;/strong&gt; check &lt;code&gt;node --version&lt;/code&gt;. The current version needs Node.js 24 or later when it runs through &lt;code&gt;npx&lt;/code&gt;. Also check that the folder in &lt;code&gt;MEMORY_FILE_PATH&lt;/code&gt; exists.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;spawn npx ENOENT&lt;/code&gt; on Windows:&lt;/strong&gt; use the &lt;code&gt;cmd /c&lt;/code&gt; config above, or see &lt;a href="https://www.pluginstackai.com/guides/fix-spawn-npx-enoent-windows-mcp/" rel="noopener noreferrer"&gt;fix spawn npx ENOENT&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;"Connection closed" (MCP error -32000):&lt;/strong&gt; this usually means the server process exited at startup. Run the command from your config in a terminal to see the real error, and see &lt;a href="https://www.pluginstackai.com/guides/fix-mcp-error-32000-connection-closed/" rel="noopener noreferrer"&gt;fix MCP error -32000&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It exits with an error naming &lt;code&gt;memory.json&lt;/code&gt; and &lt;code&gt;memory.jsonl&lt;/code&gt;:&lt;/strong&gt; with no &lt;code&gt;MEMORY_FILE_PATH&lt;/code&gt;, the server renames an old &lt;code&gt;memory.json&lt;/code&gt; to &lt;code&gt;memory.jsonl&lt;/code&gt; at startup, and stops if that fails rather than starting on an empty graph. Fix the cause (often permissions) and restart, or set &lt;code&gt;MEMORY_FILE_PATH&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A write fails after about a minute:&lt;/strong&gt; another server process held the lock for 60 seconds. A lock left by a crashed server is removed automatically (at once if its process is known to have exited on the same machine, otherwise after 30 seconds without a refresh). Check that the file isn't on a network drive.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;delete_relations&lt;/code&gt; deletes nothing:&lt;/strong&gt; the &lt;code&gt;relationType&lt;/code&gt; must match the stored one exactly. Read it with &lt;code&gt;open_nodes&lt;/code&gt; first.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Docker save fails with &lt;code&gt;EACCES&lt;/code&gt;:&lt;/strong&gt; the image runs as the unprivileged &lt;code&gt;node&lt;/code&gt; user, and a volume created by an older image is owned by root. The README's upgrade command fixes ownership and replaces the code: &lt;code&gt;docker run --rm -v claude-memory:/volume --user root --entrypoint sh mcp/memory -c 'rm -f /volume/*.js &amp;amp;&amp;amp; cp /app/dist/*.js /volume/ &amp;amp;&amp;amp; chown -R node:node /volume'&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Is the Memory MCP server local and free?
&lt;/h3&gt;

&lt;p&gt;Yes. It runs on your machine and stores the graph in a local file, with no account or API key. Anything the assistant reads from memory becomes part of the conversation it sends to your model provider, so keep secrets out of it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Where is memory.jsonl stored by default?
&lt;/h3&gt;

&lt;p&gt;In the server's own package directory, which under &lt;code&gt;npx&lt;/code&gt; is inside npm's cache. That is why setting &lt;code&gt;MEMORY_FILE_PATH&lt;/code&gt; is worth the extra line.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I edit or back up the memory file?
&lt;/h3&gt;

&lt;p&gt;It's a plain file at the path you chose, so you can copy it like any other file. To change the graph, the safest route is to ask the assistant to use the delete and add tools, which take the write lock.&lt;/p&gt;

&lt;h3&gt;
  
  
  Does it work with Claude Desktop and Claude Code at the same time?
&lt;/h3&gt;

&lt;p&gt;Yes, if both point at the same absolute &lt;code&gt;MEMORY_FILE_PATH&lt;/code&gt;. The lock file keeps their writes from overwriting each other.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;p&gt;Commands and config above come from these official docs. Tools change often, so check them for the latest steps.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/modelcontextprotocol/servers/tree/main/src/memory" rel="noopener noreferrer"&gt;Memory server README (modelcontextprotocol/servers)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.npmjs.com/package/@modelcontextprotocol/server-memory" rel="noopener noreferrer"&gt;@modelcontextprotocol/server-memory on npm&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://code.claude.com/docs/en/mcp" rel="noopener noreferrer"&gt;Claude Code docs: Connect Claude Code to tools via MCP&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developers.openai.com/codex/mcp" rel="noopener noreferrer"&gt;OpenAI Codex docs: Model Context Protocol&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://code.visualstudio.com/docs/copilot/reference/mcp-configuration" rel="noopener noreferrer"&gt;VS Code docs: MCP configuration reference&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Tools in this guide
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.pluginstackai.com/plugins/memory-mcp/" rel="noopener noreferrer"&gt;Memory MCP Server&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;PluginStack is independent and not affiliated with or endorsed by the companies mentioned. Spotted something out of date? Email &lt;a href="mailto:pluginstackai@gmail.com"&gt;pluginstackai@gmail.com&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This guide was first published on &lt;a href="https://www.pluginstackai.com/guides/memory-mcp-server-setup/" rel="noopener noreferrer"&gt;PluginStack&lt;/a&gt;. Browse the &lt;a href="https://www.pluginstackai.com/" rel="noopener noreferrer"&gt;PluginStack directory&lt;/a&gt; for more hand-checked MCP servers, plugins and setup guides.&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>ai</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How to set up the Exa MCP server (Claude Code, Cursor, VS Code, Codex)</title>
      <dc:creator>PluginStack</dc:creator>
      <pubDate>Fri, 27 Nov 2026 17:22:23 +0000</pubDate>
      <link>https://dev.to/pluginstackai/how-to-set-up-the-exa-mcp-server-claude-code-cursor-vs-code-codex-4mg5</link>
      <guid>https://dev.to/pluginstackai/how-to-set-up-the-exa-mcp-server-claude-code-cursor-vs-code-codex-4mg5</guid>
      <description>&lt;h1&gt;
  
  
  How to set up the Exa MCP server in Claude Code, Cursor, VS Code and Codex
&lt;/h1&gt;

&lt;p&gt;Checked against the official docs: Nov 11, 2026&lt;/p&gt;

&lt;p&gt;Exa's MCP server gives an AI agent web search and page fetching from Exa, plus Exa Agent for multi-step research. This guide covers the plugin installs for Claude Code and Codex, adding the hosted server by hand in each client, the three ways to authenticate, choosing tools, running the npm package locally, and what to check when it fails. It's based on Exa's MCP docs, the exa-labs/exa-mcp-server README and the &lt;code&gt;exa-mcp-server&lt;/code&gt; package on npm (checked 11 November 2026).&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick answer
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Server URL:&lt;/strong&gt; &lt;code&gt;https://mcp.exa.ai/mcp&lt;/code&gt;. It works without an API key at a free rate limit, for search and fetch.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Claude Code:&lt;/strong&gt; &lt;code&gt;claude plugin install exa@claude-plugins-official&lt;/code&gt;. &lt;strong&gt;Codex:&lt;/strong&gt; &lt;code&gt;codex mcp add exa --url https://mcp.exa.ai/mcp&lt;/code&gt;, or the Exa plugin in OpenAI's plugin directory.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Higher limits and Exa Agent:&lt;/strong&gt; sign in with OAuth by connecting to &lt;code&gt;https://mcp.exa.ai/mcp?login&lt;/code&gt;, or send an API key in an &lt;code&gt;x-api-key&lt;/code&gt; header.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Default tools:&lt;/strong&gt; &lt;code&gt;web_search_exa&lt;/code&gt; and &lt;code&gt;web_fetch_exa&lt;/code&gt;. Add others with a &lt;code&gt;tools&lt;/code&gt; parameter on the URL, which replaces the defaults.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What the Exa MCP server gives you
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;web_search_exa&lt;/code&gt; (on by default): search the web and get back clean, ready-to-use content from the results.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;web_fetch_exa&lt;/code&gt; (on by default): read the full content of one or more known URLs as clean markdown.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;web_search_advanced_exa&lt;/code&gt; (opt-in): search with filters such as domains, date ranges, categories, highlights, summaries and subpage crawling. It doesn't need authentication.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;agent_run&lt;/code&gt; (needs OAuth or an API key): run Exa Agent for research that takes more than one search, such as building a list and checking each item, with optional structured JSON output. Once you are authenticated, Exa's docs say it is on by default.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For a shorter overview, see the &lt;a href="https://www.pluginstackai.com/plugins/exa-mcp/" rel="noopener noreferrer"&gt;Exa MCP Server listing&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keyless, OAuth or API key?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Keyless:&lt;/strong&gt; connect to &lt;code&gt;https://mcp.exa.ai/mcp&lt;/code&gt; with nothing else. Good for trying search and fetch. &lt;code&gt;agent_run&lt;/code&gt; isn't available, and keyless access only works over a direct IPv4 connection.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OAuth:&lt;/strong&gt; connect to &lt;code&gt;https://mcp.exa.ai/mcp?login&lt;/code&gt; (or &lt;code&gt;https://mcp.exa.ai/mcp/oauth&lt;/code&gt;) and sign in to Exa in the browser when your client asks. Usage then counts against your Exa team. Exa's docs list this for interactive clients and production use.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;API key:&lt;/strong&gt; create a key in the Exa dashboard (dashboard.exa.ai/api-keys) and send it as an &lt;code&gt;x-api-key&lt;/code&gt; header, or as &lt;code&gt;Authorization: Bearer &amp;lt;key&amp;gt;&lt;/code&gt;. Use this for clients without MCP OAuth. Keep the key out of files you commit.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The README also allows the key on the URL as &lt;code&gt;?exaApiKey=...&lt;/code&gt;. A header is the better choice, because URLs end up in logs and config files that are easy to share by accident. New Exa accounts start with free credits; check Exa's pricing page for current rates.&lt;/p&gt;

&lt;h2&gt;
  
  
  Claude Code
&lt;/h2&gt;

&lt;p&gt;The official plugin installs the MCP server together with Exa's &lt;code&gt;search&lt;/code&gt; and &lt;code&gt;exa-agent&lt;/code&gt; skills:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude plugin install exa@claude-plugins-official
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also type &lt;code&gt;/plugin&lt;/code&gt; in Claude Code and search for Exa. Start a new session afterwards. To add only the MCP server by hand:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# keyless&lt;/span&gt;
claude mcp add --transport http exa https://mcp.exa.ai/mcp

&lt;span class="c"&gt;# sign in with OAuth (then run /mcp in Claude Code and choose Authenticate)&lt;/span&gt;
claude mcp add --transport http exa &lt;span class="s2"&gt;"https://mcp.exa.ai/mcp?login"&lt;/span&gt;

&lt;span class="c"&gt;# API key&lt;/span&gt;
claude mcp add --transport http exa https://mcp.exa.ai/mcp --header &lt;span class="s2"&gt;"x-api-key: YOUR_EXA_API_KEY"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pick one of these, not all three: a second &lt;code&gt;claude mcp add&lt;/code&gt; with the same name at the same scope fails because the server already exists. Quote URLs that contain &lt;code&gt;?&lt;/code&gt;, so your shell doesn't try to expand them. Use the plugin or a manual entry, not both. If Claude Code says the server needs authentication, see &lt;a href="https://www.pluginstackai.com/guides/fix-claude-code-mcp-needs-authentication/" rel="noopener noreferrer"&gt;fix Claude Code MCP "needs authentication"&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Claude Desktop and Claude.ai
&lt;/h3&gt;

&lt;p&gt;Use Exa's official connector instead of a config file: select &lt;strong&gt;+&lt;/strong&gt; in a new chat, choose &lt;strong&gt;Add connector&lt;/strong&gt;, search for Exa and connect it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Codex
&lt;/h2&gt;

&lt;p&gt;Exa is in OpenAI's plugin directory (the same directory for ChatGPT and Codex), and the plugin includes the MCP server plus Exa's skills. To add only the server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;codex mcp add exa --url https://mcp.exa.ai/mcp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you use the &lt;code&gt;?login&lt;/code&gt; URL instead, run &lt;code&gt;codex mcp login exa&lt;/code&gt; to start the sign-in.&lt;/p&gt;

&lt;p&gt;To use an API key without writing it into the file, read the header from an environment variable in &lt;code&gt;~/.codex/config.toml&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;~/.codex/config.toml&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[mcp_servers.exa]
url = "https://mcp.exa.ai/mcp"
env_http_headers = { "x-api-key" = "EXA_API_KEY" }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;More on Codex config: &lt;a href="https://www.pluginstackai.com/guides/add-mcp-server-to-codex-config-toml/" rel="noopener noreferrer"&gt;how to add an MCP server to Codex&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cursor
&lt;/h2&gt;

&lt;p&gt;Install Exa from the Cursor Marketplace, or add it to &lt;code&gt;~/.cursor/mcp.json&lt;/code&gt; and restart Cursor:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;~/.cursor/mcp.json&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"mcpServers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"exa"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"https://mcp.exa.ai/mcp"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To send an API key, add a &lt;code&gt;headers&lt;/code&gt; object and read the key from an environment variable, so the file holds no secret:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"mcpServers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"exa"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"https://mcp.exa.ai/mcp"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"headers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nl"&gt;"x-api-key"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"${env:EXA_API_KEY}"&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Details on &lt;code&gt;${env:...}&lt;/code&gt; and file locations: &lt;a href="https://www.pluginstackai.com/guides/add-mcp-server-to-cursor/" rel="noopener noreferrer"&gt;how to add an MCP server to Cursor&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  VS Code
&lt;/h2&gt;

&lt;p&gt;Use the one-click install link in Exa's docs, or add this to &lt;code&gt;.vscode/mcp.json&lt;/code&gt; in your project (Exa's example):&lt;/p&gt;

&lt;p&gt;&lt;em&gt;.vscode/mcp.json&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"servers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"exa"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"http"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"https://mcp.exa.ai/mcp"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For higher limits, switch the URL to &lt;code&gt;https://mcp.exa.ai/mcp?login&lt;/code&gt; and complete the sign-in when VS Code prompts you. VS Code's config formats are changing; see &lt;a href="https://www.pluginstackai.com/guides/add-mcp-server-to-vs-code/" rel="noopener noreferrer"&gt;how to add an MCP server to VS Code&lt;/a&gt; for which file uses &lt;code&gt;servers&lt;/code&gt; and which uses &lt;code&gt;mcpServers&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Other clients
&lt;/h2&gt;

&lt;p&gt;Most clients take the standard block with a &lt;code&gt;url&lt;/code&gt;. Exa's docs list the key name each one expects: Windsurf uses &lt;code&gt;serverUrl&lt;/code&gt; in &lt;code&gt;~/.codeium/windsurf/mcp_config.json&lt;/code&gt;, Gemini CLI uses &lt;code&gt;httpUrl&lt;/code&gt; in &lt;code&gt;~/.gemini/settings.json&lt;/code&gt;, OpenCode uses &lt;code&gt;opencode.json&lt;/code&gt; under &lt;code&gt;mcp&lt;/code&gt; with &lt;code&gt;"type": "remote"&lt;/code&gt;, and Zed uses &lt;code&gt;context_servers&lt;/code&gt; in its &lt;code&gt;settings.json&lt;/code&gt;. For a client that only runs local servers, use the &lt;code&gt;mcp-remote&lt;/code&gt; bridge:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"mcpServers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"exa"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"npx"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"-y"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"mcp-remote"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"https://mcp.exa.ai/mcp"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Choose which tools load
&lt;/h2&gt;

&lt;p&gt;Add a &lt;code&gt;tools&lt;/code&gt; parameter to the URL. An explicit list replaces the defaults, so include search and fetch if you still want them:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# add advanced search
https://mcp.exa.ai/mcp?tools=web_search_exa,web_fetch_exa,web_search_advanced_exa

# everything (agent_run still needs OAuth or an API key)
https://mcp.exa.ai/mcp?tools=web_search_exa,web_fetch_exa,web_search_advanced_exa,agent_run
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For ordinary searches, Exa's docs suggest keeping &lt;code&gt;web_search_exa&lt;/code&gt;, because it gives the model a smaller tool surface. Restart your client after changing the URL so it fetches the tool list again.&lt;/p&gt;

&lt;h2&gt;
  
  
  Run Exa MCP locally
&lt;/h2&gt;

&lt;p&gt;The hosted server is the simpler option. To run the open-source npm package on your machine instead, you need an Exa API key and Node.js (the package declares Node 20 or later):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"mcpServers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"exa"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"npx"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"-y"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"exa-mcp-server"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"env"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nl"&gt;"EXA_API_KEY"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"your_api_key"&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;On Windows, if the client can't start &lt;code&gt;npx&lt;/code&gt;, see &lt;a href="https://www.pluginstackai.com/guides/fix-spawn-npx-enoent-windows-mcp/" rel="noopener noreferrer"&gt;fixing spawn npx ENOENT&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Check that it works
&lt;/h2&gt;

&lt;p&gt;Open your client's MCP list and confirm &lt;code&gt;exa&lt;/code&gt; is connected with &lt;code&gt;web_search_exa&lt;/code&gt; and &lt;code&gt;web_fetch_exa&lt;/code&gt;. Then try:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Search the web for this week's Next.js release notes and summarize the main changes, with links.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The assistant should call &lt;code&gt;web_search_exa&lt;/code&gt;. If it answers from its own knowledge instead, mention Exa in the prompt ("use Exa to search...").&lt;/p&gt;

&lt;h2&gt;
  
  
  Troubleshooting
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Rate limit error (429):&lt;/strong&gt; the connection is on Exa's free keyless limits. Sign in with OAuth or add an API key, then reconnect.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Forbidden (403) without an API key:&lt;/strong&gt; keyless access needs a direct IPv4 connection to &lt;code&gt;https://mcp.exa.ai/mcp&lt;/code&gt;. From IPv6 or through a proxy, sign in with OAuth or add an API key.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;agent_run&lt;/code&gt; is missing or asks for authentication:&lt;/strong&gt; it can't use the free limits, so it only appears once you connect with &lt;code&gt;?login&lt;/code&gt; or an API key. If you set a &lt;code&gt;tools&lt;/code&gt; list, include &lt;code&gt;agent_run&lt;/code&gt; in it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tools not appearing:&lt;/strong&gt; a &lt;code&gt;tools&lt;/code&gt; parameter replaces the default list. Check that every tool you want is in the URL, then restart the client.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The OAuth sign-in doesn't open:&lt;/strong&gt; confirm the client supports MCP OAuth and that the URL ends in &lt;code&gt;?login&lt;/code&gt;. Restart the client after changing the URL. If the client can't do MCP OAuth, use an API key.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Claude Desktop won't connect with a config entry:&lt;/strong&gt; use the built-in Exa connector instead.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Is Exa MCP free?
&lt;/h3&gt;

&lt;p&gt;You can try search and fetch without an account, at a free rate limit. Signing in or using an API key moves usage to your Exa team's plan; new accounts start with free credits. Exa Agent runs are usage-based. See Exa's pricing page for current rates.&lt;/p&gt;

&lt;h3&gt;
  
  
  Do I need an API key?
&lt;/h3&gt;

&lt;p&gt;Not to try it. You need OAuth or a key for higher limits and for &lt;code&gt;agent_run&lt;/code&gt;. OAuth avoids storing a key at all.&lt;/p&gt;

&lt;h3&gt;
  
  
  Should I use the hosted server or the npm package?
&lt;/h3&gt;

&lt;p&gt;The hosted server: there's nothing to install, and it supports keyless use and OAuth. Use the npm package only if your setup needs a local process, and give it your API key through &lt;code&gt;EXA_API_KEY&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Exa or another search MCP server?
&lt;/h3&gt;

&lt;p&gt;For other options on PluginStack, see the &lt;a href="https://www.pluginstackai.com/plugins/brave-search-mcp/" rel="noopener noreferrer"&gt;Brave Search MCP server&lt;/a&gt; and &lt;a href="https://www.pluginstackai.com/guides/firecrawl-mcp-server-setup/" rel="noopener noreferrer"&gt;how to set up the Firecrawl MCP server&lt;/a&gt;, which also turns pages into clean markdown.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;p&gt;Commands and config above come from these official docs. Tools change often, so check them for the latest steps.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://exa.ai/docs/get-started/exa-mcp" rel="noopener noreferrer"&gt;Exa docs: Exa MCP&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/exa-labs/exa-mcp-server" rel="noopener noreferrer"&gt;exa-labs/exa-mcp-server on GitHub&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.npmjs.com/package/exa-mcp-server" rel="noopener noreferrer"&gt;exa-mcp-server on npm&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://code.claude.com/docs/en/mcp" rel="noopener noreferrer"&gt;Claude Code docs: Connect Claude Code to tools via MCP&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developers.openai.com/codex/mcp" rel="noopener noreferrer"&gt;OpenAI Codex docs: Model Context Protocol&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Tools in this guide
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.pluginstackai.com/plugins/exa-mcp/" rel="noopener noreferrer"&gt;Exa MCP Server&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;PluginStack is independent and not affiliated with or endorsed by the companies mentioned. Spotted something out of date? Email &lt;a href="mailto:pluginstackai@gmail.com"&gt;pluginstackai@gmail.com&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This guide was first published on &lt;a href="https://www.pluginstackai.com/guides/exa-mcp-server-setup/" rel="noopener noreferrer"&gt;PluginStack&lt;/a&gt;. Browse the &lt;a href="https://www.pluginstackai.com/" rel="noopener noreferrer"&gt;PluginStack directory&lt;/a&gt; for more hand-checked MCP servers, plugins and setup guides.&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>ai</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How to set up the Apify MCP server (Claude Code, Cursor, VS Code, Codex)</title>
      <dc:creator>PluginStack</dc:creator>
      <pubDate>Fri, 27 Nov 2026 17:21:09 +0000</pubDate>
      <link>https://dev.to/pluginstackai/how-to-set-up-the-apify-mcp-server-claude-code-cursor-vs-code-codex-3efa</link>
      <guid>https://dev.to/pluginstackai/how-to-set-up-the-apify-mcp-server-claude-code-cursor-vs-code-codex-3efa</guid>
      <description>&lt;h1&gt;
  
  
  How to set up the Apify MCP server in Claude Code, Cursor, VS Code and Codex
&lt;/h1&gt;

&lt;p&gt;Checked against the official docs: Nov 10, 2026&lt;/p&gt;

&lt;p&gt;Apify's MCP server lets a coding agent search Apify Store, run ready-made scrapers and automation tools (called Actors), and read the structured results from your datasets. This guide covers the official plugin (the shortest path in Claude Code, Cursor, Codex and VS Code), adding the hosted server by hand, running it locally, choosing which tools load, and what to check when it doesn't work. It's based on Apify's MCP docs, the official plugin guides and the &lt;code&gt;@apify/actors-mcp-server&lt;/code&gt; package on npm (checked 10 November 2026).&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick answer
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Coding agents (recommended):&lt;/strong&gt; install the official Apify plugin. It sets up the hosted MCP server at &lt;code&gt;https://mcp.apify.com&lt;/code&gt; plus Agent Skills in one step.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;By hand:&lt;/strong&gt; add &lt;code&gt;https://mcp.apify.com&lt;/code&gt; to your client. On first connection your browser opens so you can sign in to Apify with OAuth. You can also send an API token as &lt;code&gt;Authorization: Bearer &amp;lt;APIFY_TOKEN&amp;gt;&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Without an account:&lt;/strong&gt; you can connect to a URL that only loads discovery and docs tools (listed below). Running Actors and reading your storage always needs sign-in or a token.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Locally:&lt;/strong&gt; run &lt;code&gt;npx -y @apify/actors-mcp-server&lt;/code&gt; with &lt;code&gt;APIFY_TOKEN&lt;/code&gt;. That needs Node.js 22 or later. Actors still run on the Apify platform.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Then:&lt;/strong&gt; ask in plain language, for example: "Search Apify Store for an Actor that extracts product prices from Amazon and show me its input schema and pricing before running it."&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What the Apify MCP server is
&lt;/h2&gt;

&lt;p&gt;The hosted server at &lt;code&gt;https://mcp.apify.com&lt;/code&gt; is Apify's official MCP server. An agent can search Apify Store, inspect an Actor's input schema, README and pricing, run it, and read the results from the run's dataset. Connecting to the server is free. Actor runs bill to your Apify account at each Actor's price.&lt;/p&gt;

&lt;p&gt;By default, the current server loads the &lt;code&gt;actors&lt;/code&gt; and &lt;code&gt;docs&lt;/code&gt; tool categories, the Web Search and Web Fetch Actors, and &lt;code&gt;report-problem&lt;/code&gt;. &lt;code&gt;call-actor&lt;/code&gt; returns the run status and storage IDs, not the scraped items. To read the results, use &lt;code&gt;get-dataset-items&lt;/code&gt; with the &lt;code&gt;datasetId&lt;/code&gt; from the run. Whenever &lt;code&gt;call-actor&lt;/code&gt; or an Actor tool is loaded, the server also adds &lt;code&gt;get-actor-run&lt;/code&gt;, &lt;code&gt;get-dataset-items&lt;/code&gt;, &lt;code&gt;get-key-value-store-record&lt;/code&gt; and &lt;code&gt;abort-actor-run&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;For a shorter tour of the server, see the &lt;a href="https://www.pluginstackai.com/plugins/apify-mcp/" rel="noopener noreferrer"&gt;Apify MCP Server listing&lt;/a&gt;. If you mainly need to search the web and turn pages into clean markdown, rather than run site-specific Actors, see &lt;a href="https://www.pluginstackai.com/guides/firecrawl-mcp-server-setup/" rel="noopener noreferrer"&gt;how to set up the Firecrawl MCP server&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Get an Apify account (for running Actors)
&lt;/h2&gt;

&lt;p&gt;You need an Apify account unless you only use the discovery and docs tools, or your agent pays through Apify's agentic payments. The free plan includes $5 of prepaid platform usage each month and does not need a credit card. Unused credits expire at the end of the billing cycle. On the free plan, once that usage is gone, access is blocked until the next monthly cycle.&lt;/p&gt;

&lt;p&gt;Create a free account here:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.apify.com?fpr=ji7hxj" rel="noopener noreferrer"&gt;Try Apify&lt;/a&gt; &lt;strong&gt;(affiliate link)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you sign up or buy through this link, we may earn a commission from Apify, at no extra cost to you. It doesn't change what we say about the tool. &lt;a href="https://www.pluginstackai.com/disclosures/#affiliate-links" rel="noopener noreferrer"&gt;Disclosures&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you use an API token instead of OAuth, get it from the API &amp;amp; Integrations section in Apify Console and treat it like a password. Keep it out of files you commit. You can revoke an OAuth connection in Apify Console &amp;gt; Settings &amp;gt; Integrations.&lt;/p&gt;

&lt;h2&gt;
  
  
  Option 1: install the official plugin
&lt;/h2&gt;

&lt;p&gt;For Claude Code, Cursor, Codex, GitHub Copilot and VS Code, Apify recommends its plugin. One install configures the hosted MCP server and Agent Skills together. The plugin does not replace the Apify CLI. The Actor development, actorization and scraping skills call it, so install it with &lt;code&gt;npm install -g apify-cli&lt;/code&gt; and run &lt;code&gt;apify login&lt;/code&gt; before you use those skills.&lt;/p&gt;

&lt;h3&gt;
  
  
  Claude Code
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/plugin marketplace add apify/apify-claude-code-plugin
/plugin install apify@apify
/reload-plugins
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then run &lt;code&gt;/mcp&lt;/code&gt;, open &lt;code&gt;plugin:apify:apify&lt;/code&gt;, select Enable, then select Authenticate and finish the Apify sign-in in your browser. You can also add the marketplace from the &lt;code&gt;/plugins&lt;/code&gt; manager. Read-only tools such as searching the Store and fetching Actor details work without signing in; you need to authenticate to run Actors and access your account data. More on Claude Code: &lt;a href="https://www.pluginstackai.com/guides/best-mcp-servers-for-claude-code/" rel="noopener noreferrer"&gt;the best MCP servers for Claude Code&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Cursor
&lt;/h3&gt;

&lt;p&gt;In the Cursor agent chat, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/add-plugin apify
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also search for Apify under Plugins in Cursor Settings, or install it from the Cursor Marketplace. Then open Cursor Settings â†’ Tools &amp;amp; MCPs, select Connect on the Apify MCP server, and complete the Apify sign-in in your browser. More: &lt;a href="https://www.pluginstackai.com/guides/add-mcp-server-to-cursor/" rel="noopener noreferrer"&gt;how to add an MCP server to Cursor&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Codex
&lt;/h3&gt;

&lt;p&gt;In the Codex CLI, run &lt;code&gt;/plugins&lt;/code&gt;, open the Add Marketplace tab, and enter:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apify/apify-codex-plugin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then open the Apify Plugin tab, select Apify, and select Install plugin. The CLI opens the Apify sign-in the first time it calls a tool that needs authentication, such as running an Actor.&lt;/p&gt;

&lt;p&gt;In the Codex app (ChatGPT desktop, with Codex selected), open Plugins in the left sidebar, select the dropdown next to +, and choose Add marketplace. Enter &lt;code&gt;apify/apify-codex-plugin&lt;/code&gt;, add the marketplace, open the Personal tab, select Add next to Apify, then Add to Codex and Install Apify. Codex opens the Apify sign-in in your browser. More: &lt;a href="https://www.pluginstackai.com/guides/add-mcp-server-to-codex-config-toml/" rel="noopener noreferrer"&gt;how to add an MCP server to Codex&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  VS Code and GitHub Copilot
&lt;/h3&gt;

&lt;p&gt;In VS Code, open the Extensions view, search for &lt;code&gt;@agentPlugins apify&lt;/code&gt;, install the &lt;code&gt;apify&lt;/code&gt; entry from the Awesome Copilot marketplace, and confirm the trust prompt. When VS Code asks to authenticate the MCP server, select Allow and finish the Apify sign-in in your browser.&lt;/p&gt;

&lt;p&gt;In the GitHub Copilot CLI, install it from the Awesome Copilot marketplace with &lt;code&gt;/plugin install apify@awesome-copilot&lt;/code&gt;, then complete the browser sign-in. In the desktop app, open Settings &amp;gt; Plugins, search for Apify, select Install, and sign in from Settings &amp;gt; MCP servers. More: &lt;a href="https://www.pluginstackai.com/guides/add-mcp-server-to-vs-code/" rel="noopener noreferrer"&gt;how to add an MCP server to VS Code&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Option 2: add the hosted server by hand
&lt;/h2&gt;

&lt;p&gt;If your client is not in the plugin list, or you only want the MCP server, add &lt;code&gt;https://mcp.apify.com&lt;/code&gt; directly. On first connection your browser opens so you can sign in and approve access. For a client-specific config, use &lt;a href="https://mcp.apify.com/" rel="noopener noreferrer"&gt;the MCP configurator&lt;/a&gt;: pick the Actors and tools you need, then copy the generated configuration. If you use the Apify CLI, &lt;code&gt;apify mcp install &amp;lt;client&amp;gt;&lt;/code&gt; writes the configuration for you, for example &lt;code&gt;apify mcp install cursor&lt;/code&gt;. The same command works for &lt;code&gt;claude-code&lt;/code&gt;, &lt;code&gt;vscode&lt;/code&gt;, &lt;code&gt;codex&lt;/code&gt;, &lt;code&gt;kiro&lt;/code&gt; and &lt;code&gt;antigravity&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Claude Code
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude mcp add apify &lt;span class="s2"&gt;"https://mcp.apify.com"&lt;/span&gt; -t http
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Claude Code opens the Apify sign-in page the first time it uses the server.&lt;/p&gt;

&lt;h3&gt;
  
  
  Cursor and other JSON-config clients
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;~/.cursor/mcp.json&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"mcpServers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"apify"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"https://mcp.apify.com"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  VS Code (GitHub Copilot)
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;.vscode/mcp.json&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"servers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"apify"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"http"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"https://mcp.apify.com"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Bearer token instead of OAuth
&lt;/h3&gt;

&lt;p&gt;To authorize without signing in, send your Apify API token as a Bearer header. Keep the token in an environment variable, not in the file, when your client supports that:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"mcpServers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"apify"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"https://mcp.apify.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"headers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nl"&gt;"Authorization"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Bearer &amp;lt;APIFY_TOKEN&amp;gt;"&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Claude Desktop and claude.ai
&lt;/h3&gt;

&lt;p&gt;Add &lt;code&gt;https://mcp.apify.com&lt;/code&gt; as a custom connector and sign in when asked. Don't put the URL in &lt;code&gt;claude_desktop_config.json&lt;/code&gt;, which is for local servers. Apify is also in Claude's connector directory. Steps: &lt;a href="https://www.pluginstackai.com/guides/add-mcp-server-to-claude-desktop/" rel="noopener noreferrer"&gt;how to add an MCP server to Claude Desktop&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Option 3: run the server locally
&lt;/h2&gt;

&lt;p&gt;If your client doesn't support remote MCP servers, you can run the server on your machine over stdio. This needs Node.js 22 or later and an Apify API token (or a token saved by &lt;code&gt;apify login&lt;/code&gt;). Actors still run and store their results on the Apify platform. The local server does not infer output schemas for Actor results; the hosted server does.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"mcpServers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"actors-mcp-server"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"npx"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"-y"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"@apify/actors-mcp-server"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"env"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nl"&gt;"APIFY_TOKEN"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"YOUR_APIFY_TOKEN"&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If your client only supports local servers, you can also bridge it to the hosted URL with &lt;code&gt;npx mcp-remote https://mcp.apify.com&lt;/code&gt;. Use the hosted server unless you have a reason to run the process locally.&lt;/p&gt;

&lt;h2&gt;
  
  
  Choose which tools load
&lt;/h2&gt;

&lt;p&gt;Add a &lt;code&gt;tools&lt;/code&gt; query parameter to the hosted URL, or pass &lt;code&gt;--tools&lt;/code&gt; to the local server, to load only the categories, tool names and Actor names you list. When you set it, the defaults are dropped. A default configuration can change between versions, so for production Apify recommends setting &lt;code&gt;tools&lt;/code&gt; explicitly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;https://mcp.apify.com?tools=actors,docs,apify/web-search,apify/web-fetch

npx @apify/actors-mcp-server --tools actors,docs,apify/web-search,apify/web-fetch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To expose a single Actor, list only that Actor, for example &lt;code&gt;https://mcp.apify.com?tools=apify/instagram-scraper&lt;/code&gt;. The agent also gets the run and storage tools it needs to read the results.&lt;/p&gt;

&lt;p&gt;These tools work without an Apify account: &lt;code&gt;search-actors&lt;/code&gt;, &lt;code&gt;fetch-actor-details&lt;/code&gt;, &lt;code&gt;search-apify-docs&lt;/code&gt;, &lt;code&gt;fetch-apify-docs&lt;/code&gt;, &lt;code&gt;apify-api-search&lt;/code&gt; and &lt;code&gt;apify-api-details&lt;/code&gt;. This URL connects without a token:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://mcp.apify.com?tools=search-actors,fetch-actor-details,search-apify-docs,fetch-apify-docs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the &lt;code&gt;tools&lt;/code&gt; parameter includes any other tool, or you connect to the default endpoint, the server requires authentication. To cap what a run can cost, pass &lt;code&gt;maxTotalChargeUsd&lt;/code&gt; (pay-per-event Actors) or &lt;code&gt;maxItems&lt;/code&gt; (pay-per-result Actors) in the &lt;code&gt;callOptions&lt;/code&gt; of &lt;code&gt;call-actor&lt;/code&gt;. &lt;code&gt;timeout&lt;/code&gt; and &lt;code&gt;memory&lt;/code&gt; limit the run's duration and memory, not its price. Watch usage in Apify Console.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;apify/web-search&lt;/code&gt; replaced &lt;code&gt;apify/rag-web-browser&lt;/code&gt; in the default tools. To keep the older Actor, add &lt;code&gt;apify/rag-web-browser&lt;/code&gt; to your &lt;code&gt;tools&lt;/code&gt; list.&lt;/p&gt;

&lt;h2&gt;
  
  
  Telemetry
&lt;/h2&gt;

&lt;p&gt;Telemetry is on by default. The server collects anonymous information about tool usage (calls, success or failure, duration) and MCP client attributes (name, version, capabilities). It does not collect conversations, arguments passed to tools, API tokens or personal data. To opt out on the hosted server, add &lt;code&gt;telemetry-enabled=false&lt;/code&gt; to the URL:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://mcp.apify.com?telemetry-enabled=false
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For the local server, pass &lt;code&gt;--telemetry-enabled=false&lt;/code&gt; or set &lt;code&gt;TELEMETRY_ENABLED=false&lt;/code&gt;. If both are set, the CLI flag wins.&lt;/p&gt;

&lt;h2&gt;
  
  
  Check that it works
&lt;/h2&gt;

&lt;p&gt;Open your client's MCP status or tool list and confirm the Apify server is connected and signed in if you need to run Actors. Then try a read-only prompt first, such as: "Search Apify Store for an Actor that extracts product prices from Amazon and show me its input schema and pricing before running it." Start a new conversation if you just finished sign-in and the tools don't appear yet.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Running an Actor costs money on your Apify account. Ask the agent to show the Actor's pricing before it starts a run, and set run limits when you care about the cost.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Troubleshooting
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Authentication fails:&lt;/strong&gt; reconnect so the client repeats the OAuth flow, or switch to a Bearer token. For the local server, check that &lt;code&gt;APIFY_TOKEN&lt;/code&gt; is set in the client's server configuration, not only in your shell.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The local server won't start:&lt;/strong&gt; the package requires Node.js 22 or later. Check with &lt;code&gt;node -v&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;VS Code says the OAuth app is not registered:&lt;/strong&gt; run &lt;strong&gt;Authentication: Remove Dynamic Authentication Providers&lt;/strong&gt;, select Apify, and sign in again.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;call-actor&lt;/code&gt; fails because of invalid input:&lt;/strong&gt; the error includes the Actor's input schema so the agent can correct the input and retry.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Claude Desktop shows the server as connected but no tools appear:&lt;/strong&gt; check that Apify tools are set to Always allow or Ask first, not blocked. Restart Claude Desktop after configuration changes, and if you use the Desktop extension, remove and re-add it. Logs are in &lt;code&gt;~/Library/Logs/Claude/&lt;/code&gt; (macOS), &lt;code&gt;~/.config/Claude/logs/&lt;/code&gt; (Linux) or &lt;code&gt;%APPDATA%\Claude\logs\&lt;/code&gt; (Windows); look for files with &lt;code&gt;mcp&lt;/code&gt; in the name.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;An Actor run is slow or seems stuck:&lt;/strong&gt; Actor runs can take time. Check the Actor's logs in Apify Console.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Is the Apify MCP server free?
&lt;/h3&gt;

&lt;p&gt;Connecting is free, and the discovery and docs tools above work without an account. Actor runs bill to your Apify account at each Actor's price. The free plan includes $5 of monthly platform usage.&lt;/p&gt;

&lt;h3&gt;
  
  
  Do I need an API token?
&lt;/h3&gt;

&lt;p&gt;Not with the hosted server, because OAuth signs you in through the browser. Use a token for the local server, for CI, or when you don't want a browser sign-in. Get it from the API &amp;amp; Integrations section in Apify Console.&lt;/p&gt;

&lt;h3&gt;
  
  
  Should I use the plugin or add the server by hand?
&lt;/h3&gt;

&lt;p&gt;Use the plugin in Claude Code, Cursor, Codex, GitHub Copilot and VS Code if you want Agent Skills as well as the MCP server. Add the URL by hand if your client has no plugin, or you only want the server.&lt;/p&gt;

&lt;h3&gt;
  
  
  Should I use the hosted or local server?
&lt;/h3&gt;

&lt;p&gt;The hosted server with OAuth is the recommended option: there's nothing to install, and it infers output schemas for Actor results. Use the local server when your client only supports stdio, or you want the MCP process on your own machine. Actors still run on the Apify platform in both modes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;p&gt;Commands and config above come from these official docs. Tools change often, so check them for the latest steps.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.apify.com/mcp" rel="noopener noreferrer"&gt;Apify docs: Apify MCP server&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.apify.com/agents/plugins" rel="noopener noreferrer"&gt;Apify docs: Install the Apify plugin in your AI agent&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.apify.com/integrations/claude-code-cli" rel="noopener noreferrer"&gt;Apify docs: Claude Code CLI integration&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.apify.com/integrations/cursor" rel="noopener noreferrer"&gt;Apify docs: Cursor integration&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.apify.com/integrations/codex-cli" rel="noopener noreferrer"&gt;Apify docs: Codex CLI integration&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.apify.com/integrations/codex-app" rel="noopener noreferrer"&gt;Apify docs: Codex in the ChatGPT desktop app&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.apify.com/integrations/claude-desktop" rel="noopener noreferrer"&gt;Apify docs: Claude Desktop integration&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.apify.com/agents/quickstart" rel="noopener noreferrer"&gt;Apify docs: Agent quickstart&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.npmjs.com/package/@apify/actors-mcp-server" rel="noopener noreferrer"&gt;@apify/actors-mcp-server on npm&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://apify.com/pricing" rel="noopener noreferrer"&gt;Apify pricing&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.apify.com/account/subscriptions" rel="noopener noreferrer"&gt;Apify docs: subscription plans&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Tools in this guide
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.pluginstackai.com/plugins/apify-mcp/" rel="noopener noreferrer"&gt;Apify MCP Server&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;PluginStack is independent and not affiliated with or endorsed by the companies mentioned. Spotted something out of date? Email &lt;a href="mailto:pluginstackai@gmail.com"&gt;pluginstackai@gmail.com&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This guide was first published on &lt;a href="https://www.pluginstackai.com/guides/apify-mcp-server-setup/" rel="noopener noreferrer"&gt;PluginStack&lt;/a&gt;. Browse the &lt;a href="https://www.pluginstackai.com/" rel="noopener noreferrer"&gt;PluginStack directory&lt;/a&gt; for more hand-checked MCP servers, plugins and setup guides.&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>ai</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
