Skip to main content

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

  • NerveClient talks to the MCP runtime. Use base_url="https://nerve-runtime.fly.dev".
  • NerveAdmin talks to the public tenant REST API. Use base_url="https://nerve.email".
  • The SDK appends /mcp for 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nerve_email-0.1.2.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nerve_email-0.1.2-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

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

Hashes for nerve_email-0.1.2.tar.gz
Algorithm Hash digest
SHA256 8b40fe5acf0fc2a1ce41492329b70f7c056e9454a27e77150ca9f787cb4f7098
MD5 f7c08db0227c6158e7703a78698b053d
BLAKE2b-256 3c183df173bbd12a1cab7dd11f2f3583e7f5d6ef365f3e7efe4102ef99f37af4

See more details on using hashes here.

Provenance

The following attestation bundles were made for nerve_email-0.1.2.tar.gz:

Publisher: publish-python-sdk.yml on dsmolchanov/nerve-cloud

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for nerve_email-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c87ec51aa49d9966222a43a9b395edf24db2842da613d7fd671cbfdb71ff6817
MD5 4fe79918beb553db1e1f9f2dac261807
BLAKE2b-256 926d7aefa42a130b003f4cecca43deeec71327d1a4c81023e8cb17819a725bbd

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page