Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

mcp_client_example.md 823B

12345678910111213141516171819202122
  1. ---
  2. sidebar_position: 3
  3. slug: /mcp_client
  4. ---
  5. # RAGFlow MCP client example
  6. We provide a *prototype* MCP client example for testing [here](https://github.com/infiniflow/ragflow/blob/main/mcp/client/client.py).
  7. :::danger IMPORTANT
  8. If your MCP server is running in host mode, include your acquired API key in your client's `headers` as shown below:
  9. ```python
  10. async with sse_client("http://localhost:9382/sse", headers={"api_key": "YOUR_KEY_HERE"}) as streams:
  11. # Rest of your code...
  12. ```
  13. Or follow the requirements of [OAuth 2.1 Section 5](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-12#section-5) by providing an Authorization request headers field:
  14. ```python
  15. async with sse_client("http://localhost:9382/sse", headers={"Authorization": "YOUR_KEY_HERE"}) as streams:
  16. # Rest of your code...
  17. ```
  18. :::