Skip to content

docs(mcp): teach authenticated Streamable HTTP - #9

Merged
Annyfee merged 1 commit into
Annyfee:mainfrom
ct-jaryn:docs/mcp-bearer-header-example
Sep 23, 2026
Merged

Annyfee merged 1 commit into
Annyfee:mainfrom
ct-jaryn:docs/mcp-bearer-header-example

Conversation

@ct-jaryn

Copy link
Copy Markdown
Contributor

Module 11 shows a Streamable HTTP MCP connection with a key in the URL, but learners have no example for servers that require an Authorization: Bearer header. This adds an opt-in, provider-neutral Header example to the existing MultiServerMCPClient path and explains Baizhi Cloud Agent Toolkit as one optional remote endpoint. The default AMap configuration is unchanged.

The example reads the URL and token from the environment, rejects blank values and non-HTTPS remote URLs (loopback HTTP remains available for local testing), and keeps .env files out of Git. I also corrected the module commands and the existing README's four-variable config.py requirement. A fresh install of the locked langgraph==1.0.5 could resolve langgraph-prebuilt==1.0.10, which failed to import ToolNode; the matching langgraph-prebuilt==1.0.5 pin fixes that observed combination.

Validation: git diff --check and the repository's blocking flake8 selection pass. With Python 3.12 and the exact MCP/LangGraph versions above, a loopback synthetic MCP server verified that the Header reaches the server, missing/wrong tokens return 401, tools are discovered, and a tool call runs through LangGraph ToolNode. This did not call a live Baizhi service or model. The full dependency tree on Python 3.10/3.11 and the complete course script remain for CI or a later integration check; the current config.py still requires four environment variables even if only the remote example is enabled.

Disclosure: I am helping promote Baizhi Cloud Agent Toolkit. The public integration repository documents its Streamable HTTP endpoint and Bearer authentication; its hosted backend is not open source. Users supply their own API key, and some tool calls may consume paid service quota. This PR does not add a default vendor connection or imply upstream endorsement.

@Annyfee
Annyfee merged commit 6469fe2 into Annyfee:main Sep 23, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants