opentool-sdk (Python)
Python SDK for the OpenTool MCP server. Manage tools, auth, and API keys programmatically.
Both sync and async clients included.
Install
pip install opentool-sdk
Quick Start (Sync)
from opentool import OpenTool
client = OpenTool(
base_url="http://localhost:3001",
api_key="ot_your_key_here",
)
# Check server health
health = client.health()
# List all available tools
tools = client.tools.list()
# List your connected tools
connected = client.tools.connected()
# Execute a tool
result = client.tools.execute("github.create_issue", {
"owner": "user",
"repo": "my-repo",
"title": "Created via SDK",
"body": "This issue was created programmatically.",
})
Quick Start (Async)
from opentool import AsyncOpenTool
async with AsyncOpenTool(
base_url="http://localhost:3001",
api_key="ot_your_key_here",
) as client:
tools = await client.tools.connected()
result = await client.tools.execute("slack.send_message", {
"channel": "#general",
"text": "Hello from the SDK",
})
Auth
# Sign up (auto-sets API key on this client)
res = client.auth.signup(email="dev@example.com", password="my-password", name="Dev")
print(res.api_key)
# Login
res = client.auth.login(email="dev@example.com", password="my-password")
# Get OAuth URL for a provider
url = client.auth.get_connect_url("github")
# → User visits this URL to authorize
# Disconnect a provider
client.auth.disconnect("github")
API Keys
# List active keys
keys = client.keys.list()
# Create a new key (raw key returned once)
new_key = client.keys.create("CI pipeline")
print(new_key.key)
# Revoke a key
client.keys.revoke(key_id)
User Profile
# Get your profile
me = client.users.me()
print(me.email, me.connected_tools_count)
# Update profile
client.users.update_me(name="New Name")
Tools
# All tools in the registry
all_tools = client.tools.list()
# Tools you've connected
mine = client.tools.connected()
# Tools for a specific provider
github_tools = client.tools.by_provider("github")
# Execute a tool via MCP
result = client.tools.execute("slack.send_message", {
"channel": "#general",
"text": "Hello from the SDK",
})
Error Handling
from opentool import OpenTool, OpenToolError, AuthenticationError
try:
client.tools.connected()
except AuthenticationError:
print("API key is invalid or expired")
except OpenToolError as e:
print(f"Error {e.status}: {e.body}")
Context Manager
# Sync
with OpenTool(base_url="http://localhost:3001", api_key="ot_xxx") as client:
tools = client.tools.list()
# Async
async with AsyncOpenTool(base_url="http://localhost:3001", api_key="ot_xxx") as client:
tools = await client.tools.list()
Configuration
client = OpenTool(
base_url="http://localhost:3001", # Required
api_key="ot_xxx", # Optional — set later with client.set_api_key()
timeout=30.0, # Request timeout in seconds (default: 30)
http_client=custom_httpx_client, # Custom httpx.Client instance
)
License
MIT
Release files for opentool-sdk 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| opentool_sdk-0.1.1.tar.gz | 8.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| opentool_sdk-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.8 kB
Release files / opentool_sdk-0.1.1.tar.gz
| Download URL | opentool_sdk-0.1.1.tar.gz |
|---|---|
| Size | 8.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
27cd913012ff8c390b4305f5068c2402a2d9162cbe546a1cf55c57ac132a1910
|
|
BLAKE2b-256 checksum How to use checksums |
da25116fec668fa28721c1a07e56c02dd130717c7c95ec6cbe92db7fb3ef86b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Release files / opentool_sdk-0.1.1-py3-none-any.whl
| Download URL | opentool_sdk-0.1.1-py3-none-any.whl |
|---|---|
| Size | 11.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8e5675abe4d2565e52441785d174e7a14ec2a0064c1e463072682f39ce4f69ce
|
|
BLAKE2b-256 checksum How to use checksums |
2a58bbada3ecd32e3ddf0af1ffdd36b94ca28b7343e9cb6ac4fe29fac0e8f327
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|