From d5eb96e1c837b2d3f459301f705c5103d08b60b7 Mon Sep 17 00:00:00 2001 From: zlareb1 Date: Tue, 24 Nov 2026 11:58:11 +0000 Subject: [PATCH] docs: connect the MCP v2 sample to Loom Signed-off-by: zlareb1 --- openai_agents/mcp_v2/README.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/openai_agents/mcp_v2/README.md b/openai_agents/mcp_v2/README.md index 9c570496..6ece7d22 100644 --- a/openai_agents/mcp_v2/README.md +++ b/openai_agents/mcp_v2/README.md @@ -32,3 +32,33 @@ Finally, run the workflow: ```bash uv run run_workflow.py ``` + +## Use an authenticated remote MCP server + +[ClickHouse Loom](https://github.com/ClickHouse/loom) is a self-hosted MCP server +for document search and agent memory. To use it in this sample, set `LOOM_MCP_URL` +to the full `/mcp` URL and `LOOM_TOKEN` to a Loom token. Use a namespace-scoped +viewer token when the workflow only needs to search. Load these environment +variables in the worker process so the bearer token stays out of workflow input +and history. + +In a fresh copy of the sample, add `import os` to `run_worker.py` and replace its +server factory: + +```python +def streamable_http_server() -> MCPServerStreamableHttp: + return MCPServerStreamableHttp( + name=MCP_SERVER_NAME, + params={ + "url": os.environ["LOOM_MCP_URL"], + "headers": {"Authorization": f"Bearer {os.environ['LOOM_TOKEN']}"}, + }, + ) +``` + +The named worker factory supplies the connection used by +`temporal_mcp_server(MCP_SERVER_NAME)`. In `workflow.py`, replace the local +sample's three tool requests with a prompt about documents indexed in your Loom +namespace. Skip the local MCP server and start the worker and workflow against Loom. See the [Loom +MCP reference](https://github.com/ClickHouse/loom/blob/main/docs/reference/mcp.md) +for toolsets and authentication.