|
16 | 16 | from mcp.server.fastmcp import FastMCP |
17 | 17 |
|
18 | 18 | from deepset_mcp.api.client import AsyncDeepsetClient |
| 19 | +from deepset_mcp.config import DEFAULT_CLIENT_HEADER |
19 | 20 | from deepset_mcp.initialize_embedding_model import get_initialized_model |
20 | 21 | from deepset_mcp.store import STORE |
21 | 22 | from deepset_mcp.tools.custom_components import ( |
@@ -121,7 +122,9 @@ async def search_docs(query: str) -> str: |
121 | 122 | :param query: The search query to execute against the documentation. |
122 | 123 | :returns: The formatted search results from the documentation. |
123 | 124 | """ |
124 | | - async with AsyncDeepsetClient(api_key=os.environ["DEEPSET_DOCS_API_KEY"]) as client: |
| 125 | + async with AsyncDeepsetClient( |
| 126 | + api_key=os.environ["DEEPSET_DOCS_API_KEY"], transport_config=DEFAULT_CLIENT_HEADER |
| 127 | + ) as client: |
125 | 128 | response = await search_docs_tool( |
126 | 129 | client=client, |
127 | 130 | workspace=os.environ["DEEPSET_DOCS_WORKSPACE"], |
@@ -377,22 +380,22 @@ async def func_with_custom_args(*args: Any, **kwargs: Any) -> Any: |
377 | 380 |
|
378 | 381 | async def workspace_environment_wrapper(**kwargs: Any) -> Any: |
379 | 382 | ws = workspace or get_workspace_from_env() |
380 | | - async with AsyncDeepsetClient() as client: |
| 383 | + async with AsyncDeepsetClient(transport_config=DEFAULT_CLIENT_HEADER) as client: |
381 | 384 | return await decorated_func(client=client, workspace=ws, **kwargs) |
382 | 385 |
|
383 | 386 | wrapper = workspace_environment_wrapper |
384 | 387 | else: # DYNAMIC mode |
385 | 388 |
|
386 | 389 | async def workspace_explicit_wrapper(**kwargs: Any) -> Any: |
387 | | - async with AsyncDeepsetClient() as client: |
| 390 | + async with AsyncDeepsetClient(transport_config=DEFAULT_CLIENT_HEADER) as client: |
388 | 391 | # The first argument is the workspace, which must be passed by keyword. |
389 | 392 | return await decorated_func(client=client, **kwargs) |
390 | 393 |
|
391 | 394 | wrapper = workspace_explicit_wrapper |
392 | 395 | else: # Client-only tools |
393 | 396 |
|
394 | 397 | async def client_only_wrapper(**kwargs: Any) -> Any: |
395 | | - async with AsyncDeepsetClient() as client: |
| 398 | + async with AsyncDeepsetClient(transport_config=DEFAULT_CLIENT_HEADER) as client: |
396 | 399 | return await decorated_func(client=client, **kwargs) |
397 | 400 |
|
398 | 401 | wrapper = client_only_wrapper |
|
0 commit comments