Skip to content

Commit 37c7acd

Browse files
committed
Release 1.8.1
1 parent 4c69ea1 commit 37c7acd

File tree

13 files changed

+137
-43
lines changed

13 files changed

+137
-43
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "klavis"
33

44
[tool.poetry]
55
name = "klavis"
6-
version = "1.7.1"
6+
version = "1.8.1"
77
description = ""
88
readme = "README.md"
99
authors = []

reference.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,7 @@ client.mcp_server.get_all_mcp_servers()
800800
</dl>
801801
</details>
802802

803-
<details><summary><code>client.mcp_server.<a href="src/klavis/mcp_server/client.py">set_instance_auth_token</a>(...)</code></summary>
803+
<details><summary><code>client.mcp_server.<a href="src/klavis/mcp_server/client.py">set_instance_auth</a>(...)</code></summary>
804804
<dl>
805805
<dd>
806806

@@ -812,7 +812,8 @@ client.mcp_server.get_all_mcp_servers()
812812
<dl>
813813
<dd>
814814

815-
Sets an authentication token for a specific instance.
815+
Sets authentication data for a specific instance.
816+
Accepts either API key authentication or general authentication data.
816817
This updates the auth_metadata for the specified instance.
817818
</dd>
818819
</dl>
@@ -828,14 +829,16 @@ This updates the auth_metadata for the specified instance.
828829
<dd>
829830

830831
```python
831-
from klavis import Klavis
832+
from klavis import ApiKeyAuth, Klavis
832833

833834
client = Klavis(
834835
api_key="YOUR_API_KEY",
835836
)
836-
client.mcp_server.set_instance_auth_token(
837+
client.mcp_server.set_instance_auth(
837838
instance_id="instanceId",
838-
auth_token="authToken",
839+
auth_data=ApiKeyAuth(
840+
token="token",
841+
),
839842
)
840843

841844
```
@@ -860,7 +863,7 @@ client.mcp_server.set_instance_auth_token(
860863
<dl>
861864
<dd>
862865

863-
**auth_token:** `str`The authentication token to save
866+
**auth_data:** `Authdata`Authentication data
864867

865868
</dd>
866869
</dl>

src/klavis/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@
33
# isort: skip_file
44

55
from .types import (
6+
ApiKeyAuth,
67
CallToolResponse,
78
CallToolResult,
89
ConnectionType,
910
CreateSelfHostedServerResponse,
1011
CreateServerResponse,
1112
DeleteUserResponse,
1213
ExtendedMcpServer,
14+
GeneralAuth,
1315
GetAuthDataResponse,
1416
GetInstanceResponse,
1517
GetMcpServersResponse,
@@ -61,17 +63,21 @@
6163
)
6264
from .client import AsyncKlavis, Klavis
6365
from .environment import KlavisEnvironment
66+
from .mcp_server import Authdata
6467
from .version import __version__
6568

6669
__all__ = [
70+
"ApiKeyAuth",
6771
"AsyncKlavis",
72+
"Authdata",
6873
"CallToolResponse",
6974
"CallToolResult",
7075
"ConnectionType",
7176
"CreateSelfHostedServerResponse",
7277
"CreateServerResponse",
7378
"DeleteUserResponse",
7479
"ExtendedMcpServer",
80+
"GeneralAuth",
7581
"GetAuthDataResponse",
7682
"GetInstanceResponse",
7783
"GetMcpServersResponse",

src/klavis/core/client_wrapper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ def __init__(
2020

2121
def get_headers(self) -> typing.Dict[str, str]:
2222
headers: typing.Dict[str, str] = {
23-
"User-Agent": "klavis/1.7.1",
23+
"User-Agent": "klavis/1.8.1",
2424
"X-Fern-Language": "Python",
2525
"X-Fern-SDK-Name": "klavis",
26-
"X-Fern-SDK-Version": "1.7.1",
26+
"X-Fern-SDK-Version": "1.8.1",
2727
}
2828
api_key = self._get_api_key()
2929
if api_key is not None:

src/klavis/mcp_server/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@
22

33
# isort: skip_file
44

5+
from .types import Authdata
6+
7+
__all__ = ["Authdata"]

src/klavis/mcp_server/client.py

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from ..types.status_response import StatusResponse
1919
from ..types.tool_format import ToolFormat
2020
from .raw_client import AsyncRawMcpServerClient, RawMcpServerClient
21+
from .types.authdata import Authdata
2122

2223
# this is used as the default value for optional parameters
2324
OMIT = typing.cast(typing.Any, ...)
@@ -459,20 +460,21 @@ def get_all_mcp_servers(self, *, request_options: typing.Optional[RequestOptions
459460
_response = self._raw_client.get_all_mcp_servers(request_options=request_options)
460461
return _response.data
461462

462-
def set_instance_auth_token(
463-
self, *, instance_id: str, auth_token: str, request_options: typing.Optional[RequestOptions] = None
463+
def set_instance_auth(
464+
self, *, instance_id: str, auth_data: Authdata, request_options: typing.Optional[RequestOptions] = None
464465
) -> StatusResponse:
465466
"""
466-
Sets an authentication token for a specific instance.
467+
Sets authentication data for a specific instance.
468+
Accepts either API key authentication or general authentication data.
467469
This updates the auth_metadata for the specified instance.
468470
469471
Parameters
470472
----------
471473
instance_id : str
472474
The unique identifier for the connection instance
473475
474-
auth_token : str
475-
The authentication token to save
476+
auth_data : Authdata
477+
Authentication data
476478
477479
request_options : typing.Optional[RequestOptions]
478480
Request-specific configuration.
@@ -484,18 +486,20 @@ def set_instance_auth_token(
484486
485487
Examples
486488
--------
487-
from klavis import Klavis
489+
from klavis import ApiKeyAuth, Klavis
488490
489491
client = Klavis(
490492
api_key="YOUR_API_KEY",
491493
)
492-
client.mcp_server.set_instance_auth_token(
494+
client.mcp_server.set_instance_auth(
493495
instance_id="instanceId",
494-
auth_token="authToken",
496+
auth_data=ApiKeyAuth(
497+
token="token",
498+
),
495499
)
496500
"""
497-
_response = self._raw_client.set_instance_auth_token(
498-
instance_id=instance_id, auth_token=auth_token, request_options=request_options
501+
_response = self._raw_client.set_instance_auth(
502+
instance_id=instance_id, auth_data=auth_data, request_options=request_options
499503
)
500504
return _response.data
501505

@@ -1116,20 +1120,21 @@ async def main() -> None:
11161120
_response = await self._raw_client.get_all_mcp_servers(request_options=request_options)
11171121
return _response.data
11181122

1119-
async def set_instance_auth_token(
1120-
self, *, instance_id: str, auth_token: str, request_options: typing.Optional[RequestOptions] = None
1123+
async def set_instance_auth(
1124+
self, *, instance_id: str, auth_data: Authdata, request_options: typing.Optional[RequestOptions] = None
11211125
) -> StatusResponse:
11221126
"""
1123-
Sets an authentication token for a specific instance.
1127+
Sets authentication data for a specific instance.
1128+
Accepts either API key authentication or general authentication data.
11241129
This updates the auth_metadata for the specified instance.
11251130
11261131
Parameters
11271132
----------
11281133
instance_id : str
11291134
The unique identifier for the connection instance
11301135
1131-
auth_token : str
1132-
The authentication token to save
1136+
auth_data : Authdata
1137+
Authentication data
11331138
11341139
request_options : typing.Optional[RequestOptions]
11351140
Request-specific configuration.
@@ -1143,24 +1148,26 @@ async def set_instance_auth_token(
11431148
--------
11441149
import asyncio
11451150
1146-
from klavis import AsyncKlavis
1151+
from klavis import ApiKeyAuth, AsyncKlavis
11471152
11481153
client = AsyncKlavis(
11491154
api_key="YOUR_API_KEY",
11501155
)
11511156
11521157
11531158
async def main() -> None:
1154-
await client.mcp_server.set_instance_auth_token(
1159+
await client.mcp_server.set_instance_auth(
11551160
instance_id="instanceId",
1156-
auth_token="authToken",
1161+
auth_data=ApiKeyAuth(
1162+
token="token",
1163+
),
11571164
)
11581165
11591166
11601167
asyncio.run(main())
11611168
"""
1162-
_response = await self._raw_client.set_instance_auth_token(
1163-
instance_id=instance_id, auth_token=auth_token, request_options=request_options
1169+
_response = await self._raw_client.set_instance_auth(
1170+
instance_id=instance_id, auth_data=auth_data, request_options=request_options
11641171
)
11651172
return _response.data
11661173

src/klavis/mcp_server/raw_client.py

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from ..core.jsonable_encoder import jsonable_encoder
1010
from ..core.pydantic_utilities import parse_obj_as
1111
from ..core.request_options import RequestOptions
12+
from ..core.serialization import convert_and_respect_annotation_metadata
1213
from ..errors.unprocessable_entity_error import UnprocessableEntityError
1314
from ..types.call_tool_response import CallToolResponse
1415
from ..types.connection_type import ConnectionType
@@ -24,6 +25,7 @@
2425
from ..types.mcp_server_name import McpServerName
2526
from ..types.status_response import StatusResponse
2627
from ..types.tool_format import ToolFormat
28+
from .types.authdata import Authdata
2729

2830
# this is used as the default value for optional parameters
2931
OMIT = typing.cast(typing.Any, ...)
@@ -637,20 +639,21 @@ def get_all_mcp_servers(
637639
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
638640
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
639641

640-
def set_instance_auth_token(
641-
self, *, instance_id: str, auth_token: str, request_options: typing.Optional[RequestOptions] = None
642+
def set_instance_auth(
643+
self, *, instance_id: str, auth_data: Authdata, request_options: typing.Optional[RequestOptions] = None
642644
) -> HttpResponse[StatusResponse]:
643645
"""
644-
Sets an authentication token for a specific instance.
646+
Sets authentication data for a specific instance.
647+
Accepts either API key authentication or general authentication data.
645648
This updates the auth_metadata for the specified instance.
646649
647650
Parameters
648651
----------
649652
instance_id : str
650653
The unique identifier for the connection instance
651654
652-
auth_token : str
653-
The authentication token to save
655+
auth_data : Authdata
656+
Authentication data
654657
655658
request_options : typing.Optional[RequestOptions]
656659
Request-specific configuration.
@@ -661,11 +664,13 @@ def set_instance_auth_token(
661664
Successful Response
662665
"""
663666
_response = self._client_wrapper.httpx_client.request(
664-
"mcp-server/instance/set-auth-token",
667+
"mcp-server/instance/set-auth",
665668
method="POST",
666669
json={
667670
"instanceId": instance_id,
668-
"authToken": auth_token,
671+
"authData": convert_and_respect_annotation_metadata(
672+
object_=auth_data, annotation=Authdata, direction="write"
673+
),
669674
},
670675
headers={
671676
"content-type": "application/json",
@@ -1443,20 +1448,21 @@ async def get_all_mcp_servers(
14431448
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
14441449
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
14451450

1446-
async def set_instance_auth_token(
1447-
self, *, instance_id: str, auth_token: str, request_options: typing.Optional[RequestOptions] = None
1451+
async def set_instance_auth(
1452+
self, *, instance_id: str, auth_data: Authdata, request_options: typing.Optional[RequestOptions] = None
14481453
) -> AsyncHttpResponse[StatusResponse]:
14491454
"""
1450-
Sets an authentication token for a specific instance.
1455+
Sets authentication data for a specific instance.
1456+
Accepts either API key authentication or general authentication data.
14511457
This updates the auth_metadata for the specified instance.
14521458
14531459
Parameters
14541460
----------
14551461
instance_id : str
14561462
The unique identifier for the connection instance
14571463
1458-
auth_token : str
1459-
The authentication token to save
1464+
auth_data : Authdata
1465+
Authentication data
14601466
14611467
request_options : typing.Optional[RequestOptions]
14621468
Request-specific configuration.
@@ -1467,11 +1473,13 @@ async def set_instance_auth_token(
14671473
Successful Response
14681474
"""
14691475
_response = await self._client_wrapper.httpx_client.request(
1470-
"mcp-server/instance/set-auth-token",
1476+
"mcp-server/instance/set-auth",
14711477
method="POST",
14721478
json={
14731479
"instanceId": instance_id,
1474-
"authToken": auth_token,
1480+
"authData": convert_and_respect_annotation_metadata(
1481+
object_=auth_data, annotation=Authdata, direction="write"
1482+
),
14751483
},
14761484
headers={
14771485
"content-type": "application/json",
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
3+
# isort: skip_file
4+
5+
from .authdata import Authdata
6+
7+
__all__ = ["Authdata"]
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
3+
import typing
4+
5+
from ...types.api_key_auth import ApiKeyAuth
6+
from ...types.general_auth import GeneralAuth
7+
8+
Authdata = typing.Union[ApiKeyAuth, GeneralAuth]

src/klavis/types/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22

33
# isort: skip_file
44

5+
from .api_key_auth import ApiKeyAuth
56
from .call_tool_response import CallToolResponse
67
from .call_tool_result import CallToolResult
78
from .connection_type import ConnectionType
89
from .create_self_hosted_server_response import CreateSelfHostedServerResponse
910
from .create_server_response import CreateServerResponse
1011
from .delete_user_response import DeleteUserResponse
1112
from .extended_mcp_server import ExtendedMcpServer
13+
from .general_auth import GeneralAuth
1214
from .get_auth_data_response import GetAuthDataResponse
1315
from .get_instance_response import GetInstanceResponse
1416
from .get_mcp_servers_response import GetMcpServersResponse
@@ -28,13 +30,15 @@
2830
from .white_labeling_response import WhiteLabelingResponse
2931

3032
__all__ = [
33+
"ApiKeyAuth",
3134
"CallToolResponse",
3235
"CallToolResult",
3336
"ConnectionType",
3437
"CreateSelfHostedServerResponse",
3538
"CreateServerResponse",
3639
"DeleteUserResponse",
3740
"ExtendedMcpServer",
41+
"GeneralAuth",
3842
"GetAuthDataResponse",
3943
"GetInstanceResponse",
4044
"GetMcpServersResponse",

0 commit comments

Comments
 (0)