Python SDK for Nerve email MCP server
Project description
nerve-email
Python SDK for the Nerve email MCP server.
Install
pip install nerve-email
Hosted deployment
NerveClienttalks to the MCP runtime. Usebase_url="https://nerve-runtime.fly.dev".NerveAdmintalks to the public tenant REST API. Usebase_url="https://nerve.email".- The SDK appends
/mcpfor MCP requests automatically. https://nerve.email/v1/*proxies to the control plane for hosted deployments.
Quick start
from nerve_email import NerveClient
async with NerveClient(base_url="https://nerve-runtime.fly.dev", api_key="nrv_live_...") as client:
# Check server health
if await client.health_check():
threads = await client.list_threads(inbox_id="inbox_123")
thread = await client.get_thread(thread_id="thread_456")
results = await client.search_inbox(inbox_id="inbox_123", query="appointment")
# Draft and send replies
draft = await client.draft_reply(thread_id="thread_456", goal="Confirm the appointment")
await client.send_reply(thread_id="thread_456", body_or_draft_id=draft["draft_id"])
# Compose new email
await client.compose_email(
inbox_id="inbox_123",
to="patient@example.com",
subject="Appointment confirmation",
body="Your appointment is confirmed for Monday at 10am.",
)
Admin client
For domain and inbox management (control plane):
from nerve_email import NerveAdmin
async with NerveAdmin(base_url="https://nerve.email", api_key="admin_key") as admin:
domain = await admin.add_domain(org_id="org_123", domain="clientclinic.com")
dns = await admin.get_dns_records(org_id="org_123", domain_id=domain["domain"]["id"])
await admin.verify_domain(org_id="org_123", domain_id=domain["domain"]["id"])
inbox = await admin.create_inbox(
org_id="org_123",
address="support@clientclinic.com",
domain_id=domain["domain"]["id"],
)
Tool definitions
Framework-agnostic tool definitions for LLM function calling:
from nerve_email.tools import get_tool_definitions
# Claude/Anthropic format
tools = get_tool_definitions(format="claude", prefix="email_")
# OpenAI format
tools = get_tool_definitions(format="openai", prefix="email_")
Error handling
from nerve_email import NerveClient, NerveRateLimitError, NerveQuotaError
async with NerveClient(base_url=url, api_key=key) as client:
try:
threads = await client.list_threads(inbox_id="inbox_123")
except NerveRateLimitError as e:
print(f"Rate limited, retry after {e.retry_after}s")
except NerveQuotaError:
print("Quota exceeded")
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nerve_email-0.1.2.tar.gz.
File metadata
- Download URL: nerve_email-0.1.2.tar.gz
- Upload date:
- Size: 13.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b40fe5acf0fc2a1ce41492329b70f7c056e9454a27e77150ca9f787cb4f7098
|
|
| MD5 |
f7c08db0227c6158e7703a78698b053d
|
|
| BLAKE2b-256 |
3c183df173bbd12a1cab7dd11f2f3583e7f5d6ef365f3e7efe4102ef99f37af4
|
Provenance
The following attestation bundles were made for nerve_email-0.1.2.tar.gz:
Publisher:
publish-python-sdk.yml on dsmolchanov/nerve-cloud
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nerve_email-0.1.2.tar.gz -
Subject digest:
8b40fe5acf0fc2a1ce41492329b70f7c056e9454a27e77150ca9f787cb4f7098 - Sigstore transparency entry: 1227494077
- Sigstore integration time:
-
Permalink:
dsmolchanov/nerve-cloud@ef04a8c52426eb3c8ac3db9828c957073aadf5cd -
Branch / Tag:
refs/heads/main - Owner: https://github.com/dsmolchanov
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python-sdk.yml@ef04a8c52426eb3c8ac3db9828c957073aadf5cd -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file nerve_email-0.1.2-py3-none-any.whl.
File metadata
- Download URL: nerve_email-0.1.2-py3-none-any.whl
- Upload date:
- Size: 13.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c87ec51aa49d9966222a43a9b395edf24db2842da613d7fd671cbfdb71ff6817
|
|
| MD5 |
4fe79918beb553db1e1f9f2dac261807
|
|
| BLAKE2b-256 |
926d7aefa42a130b003f4cecca43deeec71327d1a4c81023e8cb17819a725bbd
|
Provenance
The following attestation bundles were made for nerve_email-0.1.2-py3-none-any.whl:
Publisher:
publish-python-sdk.yml on dsmolchanov/nerve-cloud
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nerve_email-0.1.2-py3-none-any.whl -
Subject digest:
c87ec51aa49d9966222a43a9b395edf24db2842da613d7fd671cbfdb71ff6817 - Sigstore transparency entry: 1227494134
- Sigstore integration time:
-
Permalink:
dsmolchanov/nerve-cloud@ef04a8c52426eb3c8ac3db9828c957073aadf5cd -
Branch / Tag:
refs/heads/main - Owner: https://github.com/dsmolchanov
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python-sdk.yml@ef04a8c52426eb3c8ac3db9828c957073aadf5cd -
Trigger Event:
workflow_dispatch
-
Statement type: