Skip to main content

Python SDK for CircuitNotion MCP Server

Project description

CircuitNotion MCP SDK

Python SDK for the CircuitNotion MCP server.

Installation

pip install cn-mcp

For local development against a local MCP server:

export MCP_API_KEY="your-api-key"
export MCP_BASE_URL="http://localhost:8000"

Quick Start

from cn_mcp import MCPClient

client = MCPClient(api_key="your-api-key")

session = client.sessions.create()
workspace = client.bind_session(session["session_id"])

file_resp = client.files.write(
    session_id=session["session_id"],
    path="output/hello.txt",
    content="Hello, World!",
)
print(file_resp["download_url"])

result = workspace.tool_call("terminal_exec", cmd="echo hello")
print(result["stdout"])

devices = client.devices.list()
print(devices)

client.sessions.dispose(session["session_id"])

For agentic workflows, bind_session() keeps session-backed tools aligned with the published MCP metadata without manually injecting session_id.

Dynamic Tool Calling

The SDK now reads the live tool contract from the server, so list_tools() and tool_call() stay aligned with the deployed MCP.

from cn_mcp import MCPClient

client = MCPClient(api_key="your-api-key")

print(client.list_tools())

result = client.tool_call("device_set_state", device_name="kitchen", state="on")
print(result)

Use get_tools() or get_tool_schema("tool_name") if you want the full published metadata from /mcp/tools.

Main APIs

Sessions

session = client.sessions.create()
sessions = client.sessions.list()
client.sessions.dispose(session["session_id"])

Files

file_resp = client.files.write(session["session_id"], "reports/out.zip", b"zip bytes")
files = client.files.list(session["session_id"])
content = client.files.download(file_resp["file_id"])
client.files.delete(file_resp["file_id"])

download_url values returned by the server are concrete absolute URLs when the server knows its public base URL from the request.

Terminal

result = client.terminal.execute(
    session_id=session["session_id"],
    command="python --version",
    timeout_minutes=5,
    output_limit_kb=1024,
)

Search

results = client.search.web("CircuitNotion")
print(results["organic_results"])

Devices

devices = client.devices.list()
result = client.devices.set_state(device_name="living room light", state="off")

Scheduler

task = client.scheduler.schedule(payload={"message": "follow up"}, in_seconds=300)
tasks = client.scheduler.list()
client.scheduler.cancel(task["task_id"])

Database

rows = client.db.query(
    session_id=session["session_id"],
    sql="SELECT name FROM sqlite_master WHERE type = ?",
    params=["table"],
)

client.db.execute(
    session_id=session["session_id"],
    # db.execute supports INSERT/UPDATE/DELETE statements.
    # This example assumes a `notes` table already exists.
    sql="INSERT INTO notes (body) VALUES (?)",
    params=["hello"],
)

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

cn_mcp-0.3.4.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

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

cn_mcp-0.3.4-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

Details for the file cn_mcp-0.3.4.tar.gz.

File metadata

  • Download URL: cn_mcp-0.3.4.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cn_mcp-0.3.4.tar.gz
Algorithm Hash digest
SHA256 1f435382c74ea1f68cc9f6b122a96a897c94368c3804ddef98bf9fb8eb977ee8
MD5 548bf0a3d9c1899729ad8ec9a2b76ab8
BLAKE2b-256 e474f815d4e59793d5d3669d40471cd80ce1f4918030ca9cd6d1f557bf05ab5c

See more details on using hashes here.

Provenance

The following attestation bundles were made for cn_mcp-0.3.4.tar.gz:

Publisher: pypi-publish.yml on ntirushwajeanmarc/cn-mcp-sdk

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

File details

Details for the file cn_mcp-0.3.4-py3-none-any.whl.

File metadata

  • Download URL: cn_mcp-0.3.4-py3-none-any.whl
  • Upload date:
  • Size: 15.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cn_mcp-0.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 ecd21bbf439b13bab5bd39de27c92f85b1d722a84e8847f3b1264ca059ef94c8
MD5 c13793944792a8a3ec68b901e63486d1
BLAKE2b-256 ceb97140d10906520d73fd6e86031dbcb04deb75977cc3498f0771ac365d199b

See more details on using hashes here.

Provenance

The following attestation bundles were made for cn_mcp-0.3.4-py3-none-any.whl:

Publisher: pypi-publish.yml on ntirushwajeanmarc/cn-mcp-sdk

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