Skip to content

Commit 6b7772a

Browse files
authored
feat(mcp): Add info about setting auth & headers (#226)
As we've gotten a couple questions about it --------- Co-authored-by: Mackenzie Zastrow <zastrowm@users.noreply.github.com>
1 parent d7bc993 commit 6b7772a

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

docs/user-guide/concepts/tools/mcp-tools.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,22 @@ with streamable_http_mcp_client:
7575
agent = Agent(tools=tools)
7676
```
7777

78+
You can configure additional properties - like authentication and headers - when creating the `streamablehttp_client`. All configuration options from the [MCP Python SDK](https://github.com/modelcontextprotocol/python-sdk) are supported:
79+
80+
```python
81+
import os
82+
from strands.tools.mcp.mcp_client import MCPClient
83+
from mcp.client.streamable_http import streamablehttp_client
84+
85+
github_http_mcp_client = MCPClient(
86+
lambda: streamablehttp_client(
87+
url="https://api.githubcopilot.com/mcp/",
88+
# Get pat token from here: https://github.com/settings/personal-access-tokens
89+
headers={"Authorization": f"Bearer {os.getenv('MCP_PAT')}"}
90+
)
91+
)
92+
```
93+
7894
### 3. Server-Sent Events (SSE)
7995

8096
For HTTP-based MCP servers that use Server-Sent Events transport:

0 commit comments

Comments
 (0)