Simple web search and page visit MCP server
Rust 95.3%
Shell 4.7%
2 1 0

Clone this repository

https://tangled.org/pierrelf.com/web-search-mcp https://tangled.org/did:plc:meotu43t6usg4qdwzenk4s2t/web-search-mcp
git@tangled.org:pierrelf.com/web-search-mcp git@tangled.org:did:plc:meotu43t6usg4qdwzenk4s2t/web-search-mcp

For self-hosted knots, clone URLs may differ based on your setup.

Download tar.gz
README.md

Web Search MCP Server#

Model Context Protocol (MCP) server providing web search and page visiting capabilities.

This project is AI generated.

Features#

  • Web Search: Search the web using DuckDuckGo (no API key required)
  • Page Visit: Fetch and extract text content from any webpage

Quick Start#

Build#

cargo build --release

Binary location: target/release/web-search-mcp

Configuration#

Optional environment variables:

export MAX_SEARCH_RESULTS="20"  # default: 10

Claude Code Integration#

Step 1: Build the Release Binary#

cd /path/to/web-search-mcp
cargo build --release

Step 2: Add to Claude Code#

For current project only (default):

claude mcp add --transport stdio web-search -- ./target/release/web-search-mcp

For all projects system-wide (recommended):

claude mcp add --transport stdio --scope user web-search -- ./target/release/web-search-mcp

Scope Options:

  • --scope local (default): Available only in current project
  • --scope user: Available across all projects (recommended)
  • --scope project: Shared via .mcp.json file (commits to git)

Step 3: Verify Installation#

claude mcp list

You should see web-search in the output.

Step 4: Use in Claude Code#

The search and visit tools will now be available in your Claude Code sessions. Try asking:

  • "Search for the latest Rust async updates"
  • "Visit https://example.com and summarize the content"
  • "Search for Claude MCP protocol specification"

Management Commands:

claude mcp list              # List all MCP servers
claude mcp get web-search    # Show web-search configuration
claude mcp remove web-search # Remove the server

Claude Desktop Integration#

Step 1: Locate Configuration File#

macOS:

~/Library/Application Support/Claude/claude_desktop_config.json

Windows:

%APPDATA%\Claude\claude_desktop_config.json

Linux:

~/.config/Claude/claude_desktop_config.json

Step 2: Edit Configuration#

Add the MCP server to the configuration file. If the file doesn't exist, create it.

{
  "mcpServers": {
    "web-search": {
      "command": "/absolute/path/to/web-search-mcp/target/release/web-search-mcp"
    }
  }
}

Important: Use absolute paths, not relative paths like ./target/release/web-search-mcp.

Step 3: Restart Claude Desktop#

Completely quit and restart Claude Desktop for changes to take effect.

Step 4: Verify#

In Claude Desktop, look for the MCP server indicator (usually in settings or connection status). The search and visit tools should now be available.

Troubleshooting#

Server Not Appearing in Claude Code#

  1. Check installation:

    claude mcp list
    
  2. Verify binary exists:

    ls -l ./target/release/web-search-mcp
    
  3. Test server manually:

    echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}' | ./target/release/web-search-mcp
    

    Should return a JSON response.

  4. Check logs: MCP server logs errors to stderr. Check Claude Code output for error messages.

Server Not Working in Claude Desktop#

  1. Verify absolute path: The command must be an absolute path, not relative.

    pwd  # Copy this and append /target/release/web-search-mcp
    
  2. Check JSON syntax: Use a JSON validator to ensure claude_desktop_config.json is valid.

  3. Check permissions:

    chmod +x ./target/release/web-search-mcp
    
  4. Restart Claude Desktop: Quit completely (not just close window) and restart.

Usage#

The MCP server exposes two tools:

Search the web using DuckDuckGo.

Parameters:

  • query (string, required): Search query
  • num_results (number, optional): Number of results (1-10, default: 10)

Returns: Array of search results with:

  • title: Result title
  • url: Result URL
  • snippet: Result description
  • engine: "duckduckgo"

visit#

Fetch a webpage and return its text content.

Parameters:

  • url (string, required): URL to visit

Returns: Text content extracted from the webpage (HTML tags stripped).

Development#

Build#

cargo build

Test#

cargo test

Run#

cargo run

Lint#

cargo clippy -- -D warnings

Format#

cargo fmt

Architecture#

src/
├── main.rs              # Entry point
├── lib.rs               # Library exports
├── config.rs            # Configuration
├── error.rs             # Error types
├── mcp/
│   ├── protocol.rs      # JSON-RPC types
│   ├── server.rs        # stdio server loop
│   └── tools.rs         # Tool registration/dispatch
└── search/
    ├── engine.rs        # SearchEngine trait
    ├── types.rs         # Common types
    ├── client.rs        # HTTP client
    └── engines/
        └── duckduckgo.rs

License#

MIT