web_search_helper.mcp_server module

MCP server (optional [mcp] extra): the API’s routes as agent tools.

fastapi-mcp is mounted at /mcp on a copy of web_search_helper.api’s app; the tools are exactly the routes listed below, by their operation_id, so the MCP door can never drift from the REST one.

Run it with:

pip install 'web-search-helper[mcp,embed]'
WSH_DATA_DIR=site/search-data uvicorn web_search_helper.mcp_server:app --port 8041

MCP endpoint: http://127.0.0.1:8041/mcp (Streamable HTTP).

Author: Warith Harchaoui <warithmetics@deraison.ai>

web_search_helper.mcp_server.EXPOSED = ['indexes', 'search', 'calibrate', 'check_online']

a route added to the API becomes a tool only by a deliberate edit here. query is left out on purpose: it expects a 384-number vector, which no agent should be asked to produce.

Type:

An explicit allowlist

web_search_helper.mcp_server.build_server(app)[source]
web_search_helper.mcp_server.main(argv=None)[source]

Console entry point (web-search-helper-mcp): the API with MCP at /mcp.

A click command, so --help answers instead of starting the server. The port also reads PORT, as it did before the options existed.

Parameters:

argv (list[str] | None)

Return type:

None