Skip to main content

Web search MCP server with AI-powered content extraction

Project description

morph-websearch-mcp

Web search, page fetching, and AI-powered research for MCP-compatible clients.

morph-websearch-mcp searches DuckDuckGo, fetches pages with crawl4ai, and compacts noisy webpage content with Morph. By default, results are AI-enriched into a synthesized answer with cited sources. Set enrich=false to get raw page content instead.

Features

Tool Description
websearch Searches DuckDuckGo, fetches result pages, and returns AI-enriched answers with sources by default. Pass enrich=false for raw results.
webfetch Fetches one URL and returns compacted markdown.

Works without a Morph API key — falls back to uncompacted scraping with a warning. Set the key to enable AI compaction and enrichment.

Requirements

  • Python 3.13 or newer
  • (Optional) A Morph API key from morphllm.com/dashboard/api-keys for compaction and AI enrichment
  • An MCP-compatible client, such as OpenCode, Claude Desktop, Cursor, or another client that can launch local MCP servers

Install

For most MCP clients, install the server as a standalone command:

pipx install morph-websearch-mcp

If you prefer installing into the current Python environment:

pip install morph-websearch-mcp

For local development from an existing checkout:

cd morph-websearch-mcp
uv sync

Configure Your API Key

Set MORPH_API_KEY in the environment used by your MCP client:

export MORPH_API_KEY="sk-..."

If your client is launched from a desktop app, make sure the desktop app can see that environment variable. When in doubt, put the key directly in the client MCP config instead of relying on your shell startup files.

OpenCode Setup

Add the server to your OpenCode config:

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "websearch": {
      "type": "local",
      "command": ["websearch-mcp"],
      "environment": {
        "MORPH_API_KEY": "{env:MORPH_API_KEY}"
      },
      "enabled": true
    }
  }
}

Verify OpenCode can see the server:

opencode mcp list

You should see websearch listed as connected.

Generic MCP Client Setup

For clients that use the common mcpServers shape:

{
  "mcpServers": {
    "websearch": {
      "command": "websearch-mcp",
      "env": {
        "MORPH_API_KEY": "sk-..."
      }
    }
  }
}

Some clients expect command and args separately. This server does not need arguments, so only the command is required.

Local Development Setup

Install dependencies:

uv sync

Run the MCP server from the local checkout:

uv run websearch-mcp

Use this local command in an MCP client while developing:

{
  "mcpServers": {
    "websearch": {
      "command": "uv",
      "args": ["run", "websearch-mcp"],
      "env": {
        "MORPH_API_KEY": "sk-..."
      }
    }
  }
}

Tool Inputs

websearch

Searches the web. By default returns an AI-enriched answer with sources. Pass enrich=false for raw page content.

{
  "query": "latest Python 3.13 release notes",
  "num_results": 5,
  "enrich": true
}

webfetch

Fetches one page and returns compacted markdown.

{
  "url": "https://example.com"
}

How It Works

query -> DuckDuckGo HTML -> crawl4ai fetch -> Morph compact -> enriched answer (default)
                                                    |
                                                    v
                                          raw results + hint (enrich=false)

websearch fetches each result page and compacts its content via Morph. With enrich=true (default), the compacted results are fed to a Morph-powered agent that searches further if needed and synthesizes a final answer with cited sources. With enrich=false, raw compacted results are returned with a hint suggesting enrichment or manual webfetch calls.

When MORPH_API_KEY is not set, the server runs in no-AI mode — content is returned uncompacted with a warning, and enrichment falls back to raw results.

Troubleshooting

If the command is not found, confirm your install location is on PATH:

command -v websearch-mcp

If OpenCode cannot connect, check the configured server status:

opencode mcp list

If requests fail or return uncompressed content, confirm the API key is visible to the server process:

echo "$MORPH_API_KEY"

If browser-based crawling fails on a new machine, reinstall the package and make sure crawl4ai's browser dependencies are available in that environment.

Services Used

Service Purpose Docs
crawl4ai Headless crawling and HTML-to-markdown extraction docs.crawl4ai.com
Morph compact Context compaction for fetched web content docs.morphllm.com/sdk/components/compact
Morph fast models Agent reasoning for enriched websearch docs.morphllm.com/sdk/components/fast-models

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

morph_websearch_mcp-0.2.0.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

morph_websearch_mcp-0.2.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file morph_websearch_mcp-0.2.0.tar.gz.

File metadata

  • Download URL: morph_websearch_mcp-0.2.0.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for morph_websearch_mcp-0.2.0.tar.gz
Algorithm Hash digest
SHA256 d63507c6035106c6068e5b5dbc924dfe6eb15aee91fb5a199d92bc14a7927a2c
MD5 fc7c968aa2df01e4cc401b17b5967ff1
BLAKE2b-256 d708cae91f1fbba81684042cd475a76d44de1c342cf5adfa7ac2af930d7cc792

See more details on using hashes here.

File details

Details for the file morph_websearch_mcp-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for morph_websearch_mcp-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 980daa6a4c1a6500449fe803743c1b030e8ca96ec3448a35505c94cee024d900
MD5 bf2b476f1f1392fc24eece46183cb901
BLAKE2b-256 d98612281617880e5ad804e88bd73314845fcb9f385a58e0855303a391a3e651

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page