Skip to content
AgentSearch

How to Add Free Web Search to VS Code Copilot Agent Mode with MCP (No API Key)

GitHub Copilot's agent in VS Code can edit files and run terminal commands, but it can't look things up on the live web unless you give it a tool for that. This guide adds VS Code MCP web search with one MCP server entry, with no API key and no signup. Here's the whole setup. Save it as .mcp.json in the root of your workspace:

{
  "mcpServers": {
    "agentsearch": {
      "command": "npx",
      "args": ["-y", "@agentsearchhq/agentsearch-mcp"]
    }
  }
}

Prefer VS Code's own format? The same server in .vscode/mcp.json uses servers instead of mcpServers:

{
  "servers": {
    "agentsearch": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@agentsearchhq/agentsearch-mcp"]
    }
  }
}

Either entry runs AgentSearch, the @agentsearchhq/agentsearch-mcp package on npm (also listed in the official MCP Registry as io.github.agentsearchhq-coder/agentsearch-mcp). It gives Copilot a free agentsearch_web_search tool:

Free tier: up to 25 searches/day per IP, no key needed (shared daily capacity; paid calls have no cap).

What we tested: with @agentsearchhq/agentsearch-mcp 1.3.6 (npm latest) on Linux and Node.js 24, the official MCP TypeScript SDK client read both files above, started the server through npx, listed its five tools, and ran a real free search. We also ran code --add-mcp in VS Code 1.144.1 and checked the file it wrote. We didn't sign in to Copilot, so we didn't watch the agent call the tools in a chat. Menu names come from the VS Code docs.

Using a different editor? See Cursor, Claude Code, or the Cline extension for VS Code.

Prerequisites

  • VS Code with GitHub Copilot and AI features turned on, and a local folder open.
  • Node.js 20 or newer with npx on your PATH (node -v). The package requires Node 20+.

Step 1: Pick where the config lives

VS Code reads MCP servers from two file formats that aren't interchangeable:

  • Portable Copilot format (top-level mcpServers): .mcp.json at the workspace root, or ~/.copilot/mcp-config.json for your user ($COPILOT_HOME/mcp-config.json if you set that variable). The Copilot harness reads these files directly, and the user file is the one GitHub Copilot CLI uses too.
  • VS Code format (top-level servers): .vscode/mcp.json in the workspace, or the mcp.json in your user profile. VS Code forwards these servers to Copilot sessions, except servers that need ${input:...} variables. The guided flow now labels these destinations deprecated, but they still work, and only they support input variables, envFile, and sandboxing.

Use .mcp.json to share the server with a project, ~/.copilot/mcp-config.json to have it everywhere, or .vscode/mcp.json if your team already keeps servers there. Don't paste an mcpServers block into a servers file, or the reverse.

Step 2: Add the AgentSearch server

From the Command Palette. Run MCP: Add Server, choose Command (stdio), and enter:

npx -y @agentsearchhq/agentsearch-mcp

Give it the server ID agentsearch. For a personal setup, pick Global, then Copilot Global, which writes the portable entry to ~/.copilot/mcp-config.json.

From a terminal. The code CLI adds a server to your VS Code user profile in one line:

code --add-mcp '{"name":"agentsearch","type":"stdio","command":"npx","args":["-y","@agentsearchhq/agentsearch-mcp"]}'

In our test it printed Added MCP servers: agentsearch and wrote a servers entry to User/mcp.json in the VS Code data folder (~/.config/Code/User/mcp.json by default on Linux). MCP: Open User Configuration opens it on any OS.

By hand. Paste the matching snippet from the top of this post and save. The -y skips npx's install prompt, and free search needs no env block. If the file already has servers, add agentsearch next to them and mind the commas. Then check the JSON:

python3 -m json.tool .vscode/mcp.json

With a trailing comma, it printed Illegal trailing comma before end of object: line 6 column 55.

Step 3: Trust, start, and check the tools

Workspace files (.vscode/mcp.json and .mcp.json) follow Workspace Trust: in Restricted Mode the server won't start. Servers from your user configuration may ask for trust on first start.

Run MCP: List Servers, select agentsearch, and pick Start Server or Show Output (or use Chat: Open Customizations > MCP Servers). A healthy start logs agentsearch-mcp listening on stdio.

You should see five tools:

  • agentsearch_web_search: web search that returns up to 5 results (title, URL, short passage). Free, no setup.
  • agentsearch_extract: reads a URL and returns clean markdown or text. Paid; needs a wallet.
  • agentsearch_render: loads a JavaScript-heavy page in a headless browser and returns markdown, HTML, links, or a screenshot. Paid; needs a wallet.
  • agentsearch_review_lookup and agentsearch_review_submit: read and share agent-written reviews of web tools. Free.

Search, extract, render, and review lookup are marked read-only. To limit what the agent can pick, use Chat: Open Customizations > Tools for Copilot harness sessions, or Configure Tools in the chat input for Local sessions.

Here's a trimmed result from the real search we ran through the .vscode/mcp.json entry with max_results: 2:

{
  "query": "vs code mcp.json servers configuration",
  "result_count": 2,
  "results": [
    {
      "title": "Add MCP servers in VS Code",
      "url": "https://code.visualstudio.com/docs/agent-customization/mcp-servers",
      "content": "Open the Command Palette (Ctrl+Shift+P) and run MCP: Add Server. · Choose the option that matches what the publisher provides: · Enter a server ID, such as ...",
      "domain": "code.visualstudio.com"
    },
    {
      "title": "MCP configuration reference",
      "url": "https://code.visualstudio.com/docs/agents/reference/mcp-configuration",
      "content": "This article provides the MCP configuration formats, supported fields, commands, and settings in VS Code. To connect your first server, see Add MCP servers.",
      "domain": "code.visualstudio.com"
    }
  ]
}

Results are passages, not whole pages. That's what Extract and Render are for.

Step 4: Search, Extract, and Render from agent mode

Select Agent in the chat's agent picker. The VS Code docs say to name the server in your prompt when you're checking a new one, so start like this:

Use the agentsearch MCP server to search the web for the latest Node.js LTS release and list what changed, with links. Don't change any files.

If an approval prompt appears, check the query and select Allow. Then expand the tool call to confirm the answer came from its output.

Search also helps mid-task, when the agent hits something newer than its training data:

The build fails with this bundler error. Search the web for it and suggest a fix that matches the version in package.json.

When a passage isn't enough, ask for the full page:

Extract the first link as markdown and summarize the migration steps.

That's Extract. If the page is a single-page app and Extract comes back thin, ask for Render:

That docs page builds its content with JavaScript. Render it and pull the config options into a list.

You can also type # in the chat input to reference a tool directly. Without a wallet, Extract and Render answer with No wallet is configured, so no call was made. Nothing is charged, and search keeps working. Our guide to reading JavaScript pages from an AI agent explains when to use each.

Step 5 (optional): Turn on paid Extract and Render

Search and Extract cost $0.005 per call, paid in USDC over x402, with no signup, no API key, and no minimums. Render is for pages that only show their content after JavaScript runs. See pricing for current rates.

The server pays through the Pocket Network Agentic Portal with USDC on Base, using the key of a new, dedicated wallet that holds only a small amount of USDC. Don't write the key into a file you commit. In the portable format, reference an environment variable instead:

{
  "mcpServers": {
    "agentsearch": {
      "command": "npx",
      "args": ["-y", "@agentsearchhq/agentsearch-mcp"],
      "env": {
        "AGENTSEARCH_WALLET_PRIVATE_KEY": "${AGENTSEARCH_WALLET_PRIVATE_KEY}",
        "AGENTSEARCH_MAX_TOTAL_ATOMIC": "50000"
      }
    }
  }
}

Per the VS Code docs, set that variable in the environment of the host that runs the server, and use the braced ${NAME} form. In .vscode/mcp.json, you can instead use a promptString input with "password": true, referenced as ${input:...}. VS Code prompts once and stores the value, but servers that need inputs aren't forwarded to Copilot harness sessions, so that only works in Local sessions. Restart the server after any change.

Search stays free by default, even with a wallet key. In 1.3.6, the key only turns on paid Extract and Render. agentsearch_web_search stays on the free tier unless you also set AGENTSEARCH_MODE to paid (or auto).

Spend caps. The server checks these before it signs anything:

  • AGENTSEARCH_MAX_TOTAL_ATOMIC caps total spend per server session in USDC atomic units (1000000 = $1.00). The default is $1.00; the example sets $0.05. It resets when the server restarts.
  • AGENTSEARCH_MAX_PER_CALL_ATOMIC is a per-call ceiling. You can only lower it.

With the cap at 0 and an unfunded test key, Extract returned Session spend cap reached ... Nothing was signed.

Troubleshooting

Run the server by itself. Run npx -y @agentsearchhq/agentsearch-mcp in a terminal. It should print the listening on stdio line and wait. If it fails there, VS Code can't start it either.

Read the output. MCP: List Servers > agentsearch > Show Output shows the exact error.

The server doesn't appear. Check that the top-level key matches the file (mcpServers for .mcp.json and ~/.copilot/mcp-config.json, servers for mcp.json), that the workspace is trusted, and that the server doesn't rely on ${input:...} variables in a Copilot session. Organization policy can also block servers.

npx not found. Install Node.js 20+. With a version manager, VS Code may not inherit your shell's PATH, so put the output of which npx in command. In a remote window or dev container, Node has to be installed where the server runs.

The agent doesn't call the tool. Name the server in the prompt, as in Step 4, and check it's enabled in Tools.

For retry and fallback patterns, see error handling for AI agent web tools.

More clients are on the AgentSearch MCP page, and MCP web search for AI agents covers the bigger picture.

FAQ

Do I need an API key to add web search to VS Code?

No. The entries at the top have no key, no account, and no env block. Free tier: up to 25 searches/day per IP, no key needed (shared daily capacity; paid calls have no cap).

Should I use .mcp.json or .vscode/mcp.json?

The current VS Code docs point new setups to the portable files: workspace-root .mcp.json for a team, ~/.copilot/mcp-config.json for yourself. .vscode/mcp.json still works and VS Code forwards it to Copilot sessions. Use it if you need input variables, envFile, or sandboxing.

Does it work with GitHub Copilot CLI?

Copilot CLI reads ~/.copilot/mcp-config.json, the same file Copilot Global writes, so one entry covers both. We didn't test the CLI.

Does adding a wallet key make search cost money?

Not by default. In 1.3.6, only AGENTSEARCH_MODE=paid (or auto) makes search a paid call at $0.005. Extract and Render are the calls that use the wallet.

How many results does a search return?

Up to 5 per call. The agent can ask for fewer with max_results (1 to 5).

I already set AgentSearch up in Cursor or Claude Desktop. Can VS Code reuse it?

Yes. The chat.mcp.discovery.enabled setting lets VS Code read MCP configs from Claude Desktop, Cursor, Windsurf, and GitHub Copilot CLI. Copilot CLI discovery is on by default; the others are off until you turn them on.

Is it safe to let the agent read web pages?

Treat web content as untrusted input: a page can contain text written to steer an AI. Keep approvals on for tools that edit files or run commands.

Get started

Add the agentsearch entry to .mcp.json or .vscode/mcp.json, trust the workspace, check MCP: List Servers for the five tools, and ask Copilot's agent about something that changed this week. When you need full pages, add a capped wallet for Extract and Render. See pricing and the MCP setup page, or browse more guides on the AgentSearch blog.

More from the blog

Service pages: Web Search API · Web Extract API · Web Render API