mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-02-07 11:05:05 +08:00
Feat: MCP host mode supports STREAMABLE-HTTP endpoint (#13037)
### What problem does this PR solve? MCP host mode supports STREAMABLE-HTTP endpoint ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -19,6 +19,10 @@ from mcp.client.streamable_http import streamablehttp_client
|
||||
|
||||
async def main():
|
||||
try:
|
||||
# To access RAGFlow server in `host` mode, you need to attach `api_key` for each request to indicate identification.
|
||||
# async with streamablehttp_client("http://localhost:9382/mcp/", headers={"api_key": "ragflow-fixS-TicrohljzFkeLLWIaVhW7XlXPXIUW5solFor6o"}) as (read_stream, write_stream, _):
|
||||
# Or follow the requirements of OAuth 2.1 Section 5 with Authorization header
|
||||
# async with streamablehttp_client("http://localhost:9382/mcp/", headers={"Authorization": "Bearer ragflow-fixS-TicrohljzFkeLLWIaVhW7XlXPXIUW5solFor6o"}) as (read_stream, write_stream, _):
|
||||
async with streamablehttp_client("http://localhost:9382/mcp/") as (read_stream, write_stream, _):
|
||||
async with ClientSession(read_stream, write_stream) as session:
|
||||
await session.initialize()
|
||||
|
||||
Reference in New Issue
Block a user