diff --git a/docs/integrations/webrouter.md b/docs/integrations/webrouter.md new file mode 100644 index 000000000..0289ec490 --- /dev/null +++ b/docs/integrations/webrouter.md @@ -0,0 +1,47 @@ +# Search and read a reference with WebRouter + +A ReAct or ReWOO agent can use [WebRouter](https://github.com/Nimbleway/webrouter) to find public documentation and read the page it cites. The two MCP tools can run without provider keys. The agent still uses your configured language model. + +## Install the MCP server + +Start with a kotaemon installation that includes the MCP client (available in the `kotaemon[adv]` extra). On the machine running kotaemon, use a POSIX shell and [uv](https://docs.astral.sh/uv/) to install the server in its own environment: + +```sh +mkdir -p "$HOME/.local/share/kotaemon-webrouter" +cd "$HOME/.local/share/kotaemon-webrouter" +uv venv --python 3.11 .venv +uv pip install --python .venv/bin/python 'webrouter[mcp]==0.17.0' +``` + +Save the following as `launch.sh` beside `.venv`. It starts each connection in an empty directory and passes only the settings needed for keyless search and extraction. + +```sh +#!/bin/sh +set -eu +server_dir=$(cd "$(dirname "$0")" && pwd) +scratch=$(mktemp -d) +trap 'rm -rf "$scratch"' 0 +cd "$scratch" +/usr/bin/env -i HOME="$scratch" PATH=/usr/bin:/bin \ + WEB_ROUTER_MCP_TOOLS=search,extract WEB_ROUTER_MCP_LOAD_ENV=off \ + WEB_ROUTER_MCP_CWD_ENV=off WEB_ROUTER_MCP_REMEMBERED_ENV=off \ + "$server_dir/.venv/bin/web-router-mcp" +``` + +## Add the server to kotaemon + +In **Resources → MCP Servers → Add**, paste the configuration below. Replace the path with the absolute path to your `launch.sh` inside the kotaemon host or container. Click **Add MCP Servers** and check that the tool list shows `search` and `extract`. + +```json +{ + "mcpServers": { + "webrouter": { + "command": "/bin/sh", + "args": ["/absolute/path/to/launch.sh"], + "enabled_tools": ["search", "extract"] + } + } +} +``` + +Select **[MCP] webrouter** in the agent's tools. Ask the agent to find the official Python `pathlib` documentation, read the page it found, and cite the URL when explaining `Path.cwd()`. Search terms and selected URLs go to the web providers serving those calls. diff --git a/docs/usage.md b/docs/usage.md index 5713e719e..816364dfe 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -155,3 +155,5 @@ Now navigate back to the `Chat` tab. The chat tab is divided into 3 regions: Generally, the score quality is `LLM relevant score` > `Reranking score` > `Vectorscore`. By default, overall relevance score is taken directly from LLM relevant score. Evidences are sorted based on their overall relevance score and whether they have citation or not. + +To give a ReAct or ReWOO agent web search and page reading, see [Search and read a reference with WebRouter](integrations/webrouter.md).