Browse documentation
API reference

Web search with MCP

Connect an MCP client to Kavren’s public web search tool.

Model capabilities and prices

cURL
curl "https://kavren.dev/v1/mcp" \
  -H "Authorization: Bearer $KAVREN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "jsonrpc": "2.0",
  "id": 4,
  "method": "tools/call",
  "params": {
    "name": "model_info",
    "arguments": {
      "model": "deepseek-v4.1-flash-fast"
    }
  }
}'

The result contains the same model record as GET /v1/models/{id}. Your key’s model permissions apply. This tool performs a catalog lookup without generating text.

Search during generation

cURL
curl "https://kavren.dev/v1/chat/completions" \
  -H "Authorization: Bearer $KAVREN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "deepseek-v4.1-flash-fast",
  "messages": [
    {
      "role": "user",
      "content": "Find the latest WCAG release."
    }
  ],
  "max_tokens": 64,
  "kavren_search": "W3C WCAG latest release"
}'

Chat, Messages and Responses accept kavren_search. Use false to disable gateway search, true to request lookup for a user question, or a public search phrase of up to 320 characters. Client search tools take precedence when available.

Initialize the client

cURL
curl "https://kavren.dev/v1/mcp" \
  -H "Authorization: Bearer $KAVREN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "initialize",
  "params": {
    "protocolVersion": "2025-06-18",
    "capabilities": {},
    "clientInfo": {
      "name": "example",
      "version": "1.0"
    }
  }
}'

Discover and call tools

cURL
curl "https://kavren.dev/v1/mcp" \
  -H "Authorization: Bearer $KAVREN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "tools/list"
}'
cURL
curl "https://kavren.dev/v1/mcp" \
  -H "Authorization: Bearer $KAVREN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "jsonrpc": "2.0",
  "id": 3,
  "method": "tools/call",
  "params": {
    "name": "websearch",
    "arguments": {
      "query": "Web accessibility guidelines",
      "lang": "en"
    }
  }
}'

Read the returned text content as JSON to access sources. An empty array means the search found no sources. Use the client’s own search first when it is available.

Search Kavren