Skip to content

Commit f1d480c

Browse files
committed
Release 0.1.6
1 parent 586d478 commit f1d480c

File tree

9 files changed

+462
-31
lines changed

9 files changed

+462
-31
lines changed

README.md

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,30 @@ client.mcp_server.call_server_tool(
3535
)
3636
```
3737

38+
## Async Client
39+
40+
The SDK also exports an `async` client so that you can make non-blocking calls to our API.
41+
42+
```python
43+
import asyncio
44+
45+
from klavis import AsyncKlavis
46+
47+
client = AsyncKlavis(
48+
token="YOUR_TOKEN",
49+
)
50+
51+
52+
async def main() -> None:
53+
await client.mcp_server.call_server_tool(
54+
server_url="serverUrl",
55+
tool_name="toolName",
56+
)
57+
58+
59+
asyncio.run(main())
60+
```
61+
3862
## Async usage
3963

4064
Simply import `AsyncKlavis` instead of `Klavis` and use `await` with each API call:
@@ -173,30 +197,6 @@ On timeout, an `APITimeoutError` is thrown.
173197

174198
Note that requests that time out are [retried twice by default](#retries).
175199

176-
## Async Client
177-
178-
The SDK also exports an `async` client so that you can make non-blocking calls to our API.
179-
180-
```python
181-
import asyncio
182-
183-
from klavis import AsyncKlavis
184-
185-
client = AsyncKlavis(
186-
token="YOUR_TOKEN",
187-
)
188-
189-
190-
async def main() -> None:
191-
await client.mcp_server.call_server_tool(
192-
server_url="serverUrl",
193-
tool_name="toolName",
194-
)
195-
196-
197-
asyncio.run(main())
198-
```
199-
200200
## Exception Handling
201201

202202
When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
@@ -296,6 +296,15 @@ otherwise they would be overwritten upon the next generated release. Feel free t
296296
a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
297297
an issue first to discuss with us!
298298

299+
On the other hand, contributions to the README are always very welcome!
300+
## Contributing
301+
302+
While we value open-source contributions to this SDK, this library is generated programmatically.
303+
Additions made directly to this library would have to be moved over to our generation code,
304+
otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
305+
a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
306+
an issue first to discuss with us!
307+
299308
On the other hand, contributions to the README are always very welcome!
300309
## Versioning
301310

@@ -320,7 +329,3 @@ import klavis
320329
print(klavis.__version__)
321330
```
322331

323-
## Requirements
324-
325-
Python 3.8 or higher.
326-

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 = "0.1.5"
6+
version = "0.1.6"
77
description = ""
88
readme = "README.md"
99
authors = []

reference.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,110 @@ client.mcp_server.set_instance_auth_token(
764764
</dl>
765765

766766

767+
</dd>
768+
</dl>
769+
</details>
770+
771+
<details><summary><code>client.mcp_server.<a href="src/klavis/mcp_server/client.py">get_o_auth_url</a>(...)</code></summary>
772+
<dl>
773+
<dd>
774+
775+
#### 📝 Description
776+
777+
<dl>
778+
<dd>
779+
780+
<dl>
781+
<dd>
782+
783+
Gets the OAuth authorization URL for a specific MCP server and instance.
784+
Returns the complete OAuth URL with the instance ID as a query parameter.
785+
</dd>
786+
</dl>
787+
</dd>
788+
</dl>
789+
790+
#### 🔌 Usage
791+
792+
<dl>
793+
<dd>
794+
795+
<dl>
796+
<dd>
797+
798+
```python
799+
from klavis import Klavis, McpServerName
800+
801+
client = Klavis(
802+
token="YOUR_TOKEN",
803+
)
804+
client.mcp_server.get_o_auth_url(
805+
server_name=McpServerName.MARKDOWN2DOC,
806+
instance_id="instanceId",
807+
)
808+
809+
```
810+
</dd>
811+
</dl>
812+
</dd>
813+
</dl>
814+
815+
#### ⚙️ Parameters
816+
817+
<dl>
818+
<dd>
819+
820+
<dl>
821+
<dd>
822+
823+
**server_name:** `McpServerName` — The name of the target MCP server.
824+
825+
</dd>
826+
</dl>
827+
828+
<dl>
829+
<dd>
830+
831+
**instance_id:** `str` — The unique identifier for the connection instance.
832+
833+
</dd>
834+
</dl>
835+
836+
<dl>
837+
<dd>
838+
839+
**client_id:** `typing.Optional[str]` — Optional client ID for white labeling. If not provided, will use default credentials.
840+
841+
</dd>
842+
</dl>
843+
844+
<dl>
845+
<dd>
846+
847+
**scope:** `typing.Optional[str]` — Optional OAuth scopes to request (comma-separated string).
848+
849+
</dd>
850+
</dl>
851+
852+
<dl>
853+
<dd>
854+
855+
**redirect_url:** `typing.Optional[str]` — Optional URL to redirect to after authorization completes.
856+
857+
</dd>
858+
</dl>
859+
860+
<dl>
861+
<dd>
862+
863+
**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
864+
865+
</dd>
866+
</dl>
867+
</dd>
868+
</dl>
869+
870+
767871
</dd>
768872
</dl>
769873
</details>

src/klavis/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
GSheetsOAuthSuccessResponse,
2929
GetInstanceResponse,
3030
GetMcpServersResponse,
31+
GetOAuthUrlResponse,
3132
GetServerInstancesResponse,
3233
GetToolsResponse,
3334
GitHubOAuthErrorResponse,
@@ -115,6 +116,7 @@
115116
"GSheetsOAuthSuccessResponse",
116117
"GetInstanceResponse",
117118
"GetMcpServersResponse",
119+
"GetOAuthUrlResponse",
118120
"GetServerInstancesResponse",
119121
"GetToolsResponse",
120122
"GitHubOAuthErrorResponse",

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/0.1.5",
23+
"User-Agent": "klavis/0.1.6",
2424
"X-Fern-Language": "Python",
2525
"X-Fern-SDK-Name": "klavis",
26-
"X-Fern-SDK-Version": "0.1.5",
26+
"X-Fern-SDK-Version": "0.1.6",
2727
}
2828
token = self._get_token()
2929
if token is not None:

src/klavis/mcp_server/client.py

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from ..types.create_server_response import CreateServerResponse
1010
from ..types.get_instance_response import GetInstanceResponse
1111
from ..types.get_mcp_servers_response import GetMcpServersResponse
12+
from ..types.get_o_auth_url_response import GetOAuthUrlResponse
1213
from ..types.get_tools_response import GetToolsResponse
1314
from ..types.list_tools_response import ListToolsResponse
1415
from ..types.mcp_server_name import McpServerName
@@ -400,6 +401,67 @@ def set_instance_auth_token(
400401
)
401402
return _response.data
402403

404+
def get_o_auth_url(
405+
self,
406+
*,
407+
server_name: McpServerName,
408+
instance_id: str,
409+
client_id: typing.Optional[str] = OMIT,
410+
scope: typing.Optional[str] = OMIT,
411+
redirect_url: typing.Optional[str] = OMIT,
412+
request_options: typing.Optional[RequestOptions] = None,
413+
) -> GetOAuthUrlResponse:
414+
"""
415+
Gets the OAuth authorization URL for a specific MCP server and instance.
416+
Returns the complete OAuth URL with the instance ID as a query parameter.
417+
418+
Parameters
419+
----------
420+
server_name : McpServerName
421+
The name of the target MCP server.
422+
423+
instance_id : str
424+
The unique identifier for the connection instance.
425+
426+
client_id : typing.Optional[str]
427+
Optional client ID for white labeling. If not provided, will use default credentials.
428+
429+
scope : typing.Optional[str]
430+
Optional OAuth scopes to request (comma-separated string).
431+
432+
redirect_url : typing.Optional[str]
433+
Optional URL to redirect to after authorization completes.
434+
435+
request_options : typing.Optional[RequestOptions]
436+
Request-specific configuration.
437+
438+
Returns
439+
-------
440+
GetOAuthUrlResponse
441+
Successful Response
442+
443+
Examples
444+
--------
445+
from klavis import Klavis, McpServerName
446+
447+
client = Klavis(
448+
token="YOUR_TOKEN",
449+
)
450+
client.mcp_server.get_o_auth_url(
451+
server_name=McpServerName.MARKDOWN2DOC,
452+
instance_id="instanceId",
453+
)
454+
"""
455+
_response = self._raw_client.get_o_auth_url(
456+
server_name=server_name,
457+
instance_id=instance_id,
458+
client_id=client_id,
459+
scope=scope,
460+
redirect_url=redirect_url,
461+
request_options=request_options,
462+
)
463+
return _response.data
464+
403465

404466
class AsyncMcpServerClient:
405467
def __init__(self, *, client_wrapper: AsyncClientWrapper):
@@ -854,3 +916,72 @@ async def main() -> None:
854916
instance_id=instance_id, auth_token=auth_token, request_options=request_options
855917
)
856918
return _response.data
919+
920+
async def get_o_auth_url(
921+
self,
922+
*,
923+
server_name: McpServerName,
924+
instance_id: str,
925+
client_id: typing.Optional[str] = OMIT,
926+
scope: typing.Optional[str] = OMIT,
927+
redirect_url: typing.Optional[str] = OMIT,
928+
request_options: typing.Optional[RequestOptions] = None,
929+
) -> GetOAuthUrlResponse:
930+
"""
931+
Gets the OAuth authorization URL for a specific MCP server and instance.
932+
Returns the complete OAuth URL with the instance ID as a query parameter.
933+
934+
Parameters
935+
----------
936+
server_name : McpServerName
937+
The name of the target MCP server.
938+
939+
instance_id : str
940+
The unique identifier for the connection instance.
941+
942+
client_id : typing.Optional[str]
943+
Optional client ID for white labeling. If not provided, will use default credentials.
944+
945+
scope : typing.Optional[str]
946+
Optional OAuth scopes to request (comma-separated string).
947+
948+
redirect_url : typing.Optional[str]
949+
Optional URL to redirect to after authorization completes.
950+
951+
request_options : typing.Optional[RequestOptions]
952+
Request-specific configuration.
953+
954+
Returns
955+
-------
956+
GetOAuthUrlResponse
957+
Successful Response
958+
959+
Examples
960+
--------
961+
import asyncio
962+
963+
from klavis import AsyncKlavis, McpServerName
964+
965+
client = AsyncKlavis(
966+
token="YOUR_TOKEN",
967+
)
968+
969+
970+
async def main() -> None:
971+
await client.mcp_server.get_o_auth_url(
972+
server_name=McpServerName.MARKDOWN2DOC,
973+
instance_id="instanceId",
974+
)
975+
976+
977+
asyncio.run(main())
978+
"""
979+
_response = await self._raw_client.get_o_auth_url(
980+
server_name=server_name,
981+
instance_id=instance_id,
982+
client_id=client_id,
983+
scope=scope,
984+
redirect_url=redirect_url,
985+
request_options=request_options,
986+
)
987+
return _response.data

0 commit comments

Comments
 (0)