# Web search MCP server and URL to Markdown API

Use `glim_web_search` to find sources on the open web by topic. Use `glim_web_fetch` to turn a URL into Markdown your agent can read and quote. Both tools are available through REST and MCP.

## Web search and fetch pricing

- A web search costs $0.01 and returns up to 10 results.
- Fetching one URL costs $0.002. If you already have the URL, you can skip the search.

Pay per call from a wallet without an API key or subscription. To use the curl examples below, replace `YOUR_KEY` with your [glim.sh API key](https://glim.sh/app). See [Payments & auth](https://glim.sh/docs/payments.md) for wallet setup.

## Search the web with REST or MCP

This query looks for the MCP documentation on connecting local servers. Use `include_domains` to search specific sites or `exclude_domains` to leave sites out. REST returns a `results` array with titles, URLs and a snippet when available.

**Web search via REST**

```
curl -X POST https://glim.sh/api/v1/web/search \
  -H "x-api-key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query":"connect a local MCP server","include_domains":["modelcontextprotocol.io"]}'
```

**Web search via MCP (tools/call parameters)**

```
{
  "name": "glim_web_search",
  "arguments": {
    "query": "connect a local MCP server",
    "include_domains": ["modelcontextprotocol.io"]
  }
}
```

MCP search returns a compact text list by default. Add `"format": "json"` to the tool arguments if your agent needs structured results.

## Convert a URL to Markdown with REST or MCP

Pass a page URL to fetch its main text as Markdown, the default format. Fetch can extract an HTML article, render a page that loads its text with JavaScript, or read text from a PDF. On HTML pages, add a CSS `selector` to extract just the part you need.

**URL to Markdown via REST**

```
curl -X POST https://glim.sh/api/v1/web/fetch \
  -H "x-api-key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://modelcontextprotocol.io/docs/getting-started/intro"}'
```

**REST response (trimmed)**

```
{
  "status": 200,
  "content": [
    "Get started\n\n# What is the Model Context Protocol (MCP)?\n\nMCP (Model Context Protocol) is an open-source standard for connecting AI applications to external systems. ..."
  ],
  "url": "https://modelcontextprotocol.io/docs/getting-started/intro",
  "outcome": "success",
  "title": "What is the Model Context Protocol (MCP)? - Model Context Protocol",
  "total_chars": 2493
}
```

**Web fetch via MCP (tools/call parameters)**

```
{
  "name": "glim_web_fetch",
  "arguments": {
    "url": "https://modelcontextprotocol.io/docs/getting-started/intro"
  }
}
```

In the REST JSON response, read the Markdown from the `content` array. The MCP tool returns the Markdown as text with the source URL and fetch outcome in its frontmatter.

## Web search MCP server

The hosted MCP endpoint for Claude Code and other clients is `https://glim.sh/mcp`. Choose the command for your client below.

- **Claude Code**: `claude mcp add -s user -t http glim https://glim.sh/mcp`
- **Codex**: `codex mcp add glim --url https://glim.sh/mcp`
- **OpenCode**: `opencode mcp add`
  Interactive: choose remote, paste https://glim.sh/mcp
- **Wallet**: `npx x402-proxy mcp add glim https://glim.sh/mcp`
  No account: your agent pays per call in USDC (x402) from a local wallet, auto-generated on first run.

To expose only web search and fetch, use `https://glim.sh/mcp?tools=glim_web_search,glim_web_fetch` as the server URL. See the [MCP quickstart](https://glim.sh/docs/quickstart.md) for sign-in and wallet options.

## Comparing web search and reader APIs

If you are comparing alternatives to [Firecrawl](https://www.firecrawl.dev/), [Tavily](https://www.tavily.com/), [Exa](https://exa.ai/) or [Jina Reader](https://jina.ai/reader/), count how often your agent searches and how often it reads a page. glim.sh bills each operation per call, with no subscription or API key required when paying from a wallet. The same MCP endpoint also serves [Reddit](https://glim.sh/docs/reddit.md) and [GitHub](https://glim.sh/docs/github.md).

## Good to know

- For a date range, set `published_within_days` to a whole number from 1 to 3650. Leave it out if you also want pages without a known publication date.
- Check the fetch `outcome` before quoting a page. A `teaser` may contain only a preview, and `login_wall` means the site requires sign-in.
- When a Markdown extraction is truncated, REST includes a `download_url` for the full text. In MCP Markdown, the frontmatter calls this link `download_full_url`.

## Prompts to try

"Search the MCP documentation for local server setup, fetch the most relevant guide, and quote the setup instructions with the source URL."

## FAQ

### Which API converts a URL to clean Markdown for an LLM?

Send the URL to `POST /api/v1/web/fetch` on glim.sh. The response includes the extracted Markdown in `content`, ready to pass to an LLM.

### Which MCP server can I use for web search in Claude Code?

Add `https://glim.sh/mcp` to Claude Code and ask it to use `glim_web_search`. To read a source behind a search result, ask it to pass that URL to `glim_web_fetch`.

### How much does web search cost for an AI agent?

glim.sh charges $0.01 per search with no subscription. To estimate your agent's cost, count its searches and add $0.002 for each result it opens with the fetch tool.

---

## All docs pages


**Get started**

- [Introduction](https://glim.sh/docs.md)
- [MCP quickstart](https://glim.sh/docs/quickstart.md)
- [REST API quickstart](https://glim.sh/docs/quickstart-rest.md)
- [JavaScript quickstart](https://glim.sh/docs/quickstart-javascript.md)
- [Python quickstart](https://glim.sh/docs/quickstart-python.md)
- [Payments & auth](https://glim.sh/docs/payments.md)
- [MPP (Tempo)](https://glim.sh/docs/mpp.md)

**Tools**

- [Twitter / X](https://glim.sh/docs/twitter.md)
- [Reddit](https://glim.sh/docs/reddit.md)
- [Web](https://glim.sh/docs/web.md)
- [GitHub](https://glim.sh/docs/github.md)
- [Amazon](https://glim.sh/docs/amazon.md)
- [YouTube](https://glim.sh/docs/youtube.md)
- [Telegram](https://glim.sh/docs/telegram.md)

**Reference**

- [Changelog](https://glim.sh/docs/changelog.md)
- [API reference](https://glim.sh/docs/api-reference)
- [OpenAPI spec](https://glim.sh/openapi.json)
