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

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"],
    sql="CREATE TABLE IF NOT EXISTS notes (id INTEGER PRIMARY KEY, body TEXT)",
)

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.0.tar.gz (10.6 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.0-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cn_mcp-0.3.0.tar.gz
  • Upload date:
  • Size: 10.6 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.0.tar.gz
Algorithm Hash digest
SHA256 c8d71d461b0984c8514aaee316edae209ec8de60ca441bdb211a0082f25b3910
MD5 8361fcfe75ecdf7097387a54e835503c
BLAKE2b-256 aa114648e119f0cd914e1649621b6026a835d17a8cb3548bba428f28d11b9782

See more details on using hashes here.

Provenance

The following attestation bundles were made for cn_mcp-0.3.0.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.0-py3-none-any.whl.

File metadata

  • Download URL: cn_mcp-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 12.7 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a99258fe8f0f49147a5f7ff00fa6cf59009953cfc70f123759465b23905b77e3
MD5 708c6cacec19106c48b182e36e05d49c
BLAKE2b-256 45cff0591168d3294f6aca94ef0c9fe4b03e0bcbac5dae479e4067599b9728ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for cn_mcp-0.3.0-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