Blog·June 23, 2026

How to Add Web Search to Claude Code Using MCP in 5 Minutes

Claude CodeMCPweb searchagentic search

Claude Code can read your repo and run commands.

But when the task depends on current external information, it needs web context.

MCP is the cleanest way to add that context.

This guide adds Ninelayer search to Claude Code as a remote MCP server.

Step 1: Get a Search MCP Endpoint

Ninelayer exposes a hosted MCP endpoint:

https://mcp.ninelayer.in/mcp

It provides:

  • ninelayer_deep_search
  • ninelayer_get_url
  • academic_search

Set your token locally:

export NINELAYER_API_TOKEN="your-token"

Step 2: Add the Server

Run:

claude mcp add --transport http ninelayer https://mcp.ninelayer.in/mcp \
  --header "Authorization: Bearer $NINELAYER_API_TOKEN"

Claude Code documents remote HTTP MCP servers as the recommended transport for hosted services.

Step 3: Verify It Works

Open Claude Code and run:

/mcp

Then ask:

Use the Ninelayer MCP server to search for the current official Next.js route handler docs. Return source URLs only.

If Claude returns source URLs, the integration is healthy.

Step 4: Use Retrieval Before Edits

For coding tasks, make search a gate:

Before editing files, use ninelayer_deep_search to retrieve current official docs.

Then inspect the repo, patch the smallest relevant surface, and run the relevant check.

This prevents Claude Code from relying on stale model memory.

Project-Level Setup

For teams, commit .mcp.json:

{
  "mcpServers": {
    "ninelayer": {
      "type": "http",
      "url": "https://mcp.ninelayer.in/mcp",
      "headers": {
        "Authorization": "Bearer ${NINELAYER_API_TOKEN}"
      }
    }
  }
}

Each developer sets their own token.

The Practical Takeaway

Adding web search to Claude Code is easy.

The important part is using it at the right time.

Search before the patch, not after the failure.

Sources

  1. Claude Code docs: Connect Claude Code to tools via MCP
  2. Ninelayer: Full LLM reference
← Back to Blog