Skip to main content

tunc-mcp

Agent memory, artifact storage, and document editing for AI agents — over MCP.

A small, dependency-free MCP (Model Context Protocol) client in Python for three hosted services that AI agents and multi-agent systems actually need:

Service What it is MCP endpoint
Tunc Orb Agent memory database — durable records, logs and structured state shared by every agent you run https://mcp.tuncorb.com/mcp
Tunc Art Artifact storage and private file sharing — agent-generated files behind short private links https://mcp.tuncart.com/mcp
Tunc Doc Documents, spreadsheets and slide decks — import/export DOCX, XLSX, PPTX, PDF https://mcp.tuncdoc.com/mcp

All three are also reachable over A2A (agent-to-agent) and plain REST, so the same account works whether your agent speaks MCP, A2A, or HTTP.

Why this exists

Most agent stacks lose state the moment a context window rolls over. Writes from two agents at once silently clobber each other. Artifacts end up as files on someone's laptop. This gives an agent three boring, reliable primitives instead:

  • Memory that survives the conversation. Records persist across sessions, across agents, across models, with revision-guarded writes.
  • Artifacts with links you can send. Upload a file, get a short private URL back. No bucket configuration.
  • Documents an agent can actually produce. Real DOCX, XLSX and PPTX, not markdown pretending to be a report.

Concurrency is the interesting part

data_update takes if_revision. Two agents writing the same record do not race: the second gets a revision_conflict, re-reads, and retries. That turns a lost-update bug — the classic multi-agent failure where a plausible but wrong number survives — into a loud retry.

Install

pip install tunc-mcp

Python 3.9 or newer. No dependencies. Get an API key at https://tunchub.com/account/keys/new — you can scope it read-only.

Use

from tunc_mcp import orb, art, doc

memory = orb()          # reads TUNC_API_KEY

# Every tool takes an `operation` that picks what it does. Call list_tools()
# once and read the real schemas rather than trusting an example.
#
# data_write  operation: create | append
# data_read   operation: shelves | list | get | log | search | status
# data_update operation: replace | patch        (needs if_revision)
# data_delete operation: record | entries | log (needs if_revision)

memory.call_tool("data_write", {
    "operation": "create",
    "name": "contacts/ada",
    "about": "Primary contact, Example Ltd",
    "value": {"email": "ada@example.com", "timezone": "Europe/London"},
})

record = memory.call_tool("data_read", {"operation": "get", "name": "contacts/ada"})
revision = record["structuredContent"]["revision"]

memory.call_tool("data_update", {
    "operation": "patch",
    "name": "contacts/ada",
    "if_revision": revision,
    "patch": [{"op": "replace", "path": "/timezone", "value": "Europe/Paris"}],
})

memory.call_tool("data_delete", {"operation": "record", "name": "contacts/ada", "if_revision": revision})

Artifacts — art_write takes operation: create and a name, and the result keys the artifact by id:

files = art()
stored = files.call_tool("art_write", {
    "operation": "create",
    "name": "quarterly-report.pdf",
    "mime_type": "application/pdf",
    "content_base64": base64_bytes,
})
artifact_id = stored["structuredContent"]["artifact"]["id"]

files.call_tool("art_read", {"operation": "get", "artifact_id": artifact_id})
files.call_tool("art_delete", {"artifact_id": artifact_id})

Documents — doc_create needs only a title and returns the document under result.doc.id; every other doc tool addresses it with doc:

docs = doc()
made = docs.call_tool("doc_create", {"title": "Q4 summary", "markdown": "# Q4\n\nRevenue up 12%."})
doc_id = made["structuredContent"]["result"]["doc"]["id"]

docs.call_tool("doc_read", {"doc": doc_id})
docs.call_tool("doc_delete", {"doc": doc_id})

Discover what any service offers:

for tool in orb().list_tools():
    print(tool["name"], tool.get("inputSchema", {}).get("required"))

CLI

export TUNC_API_KEY=...

tunc-mcp services
tunc-mcp tools --service orb
tunc-mcp call data_read '{"operation": "get", "name": "contacts/ada"}' --service orb

Options

memory = orb(
    api_key="...",                      # or TUNC_API_KEY in the environment
    endpoint="https://mcp.tuncorb.com/mcp",  # override: staging, a proxy, a local mock
)
  • api_key — defaults to TUNC_API_KEY. Checked when the client is constructed.
  • endpoint — replaces the built-in URL for that service, which is how you point it at a test server.
  • service — "orb", "art" or "doc", if you construct TuncMcpClient directly instead of using orb() / art() / doc().

SERVERS is the map of default endpoints. connect(key) returns all three clients at once.

Wire it into an MCP client

Any MCP-capable host works. Point it at the endpoint and pass the key as a bearer header. For a Python host, the usual shape is:

from tunc_mcp import orb
client = orb()
tools = client.list_tools()

OAuth instead of a key

The servers accept a resource-bound OAuth token as well as an API key. That matters for Doc: mcp.tuncdoc.com advertises the same scope names as Orb (orb.read, orb.write, orb.delete), so a token without a resource binding defaults to the Orb audience and is rejected by Doc with "not scoped for this service". Include the resource when you request the device grant:

resource=https://mcp.tuncdoc.com/mcp
TuncMcpClient(service="doc", api_key=device_access_token)

Agent-to-agent

Every service publishes an A2A agent card, so agents that speak A2A can discover and call them without a human in the loop:

What this package does not do

It is a client. It does not host anything, and it does not bundle an agent runtime. If you want the workspace these services belong to — a multiplayer chat where people and agents work together — that is a desktop and mobile app: https://tunchub.com.

Errors

Everything raises TuncMcpError with a status, a code and the server's message. A 401 means the key is missing, revoked, or not scoped for that service; the message says which.

中文

面向 AI 智能体的记忆数据库、制品存储与文档编辑 —— 通过 MCP 接入。

tunc-mcp 是一个零依赖的 Python MCP 客户端,连接三个托管服务:

服务 用途 接入点
Tunc Orb 智能体记忆数据库 —— 持久保存记录、日志与结构化状态,可在所有智能体之间共享 https://mcp.tuncorb.com/mcp
Tunc Art 制品存储与文件分享 —— 保存智能体生成的文件,返回私密短链接 https://mcp.tuncart.com/mcp
Tunc Doc 文档、表格与幻灯片 —— 可导入导出 DOCX、XLSX、PPTX、PDF https://mcp.tuncdoc.com/mcp

三个服务同时支持 MCP、A2A(智能体间通信)与 REST,同一个账号即可通用。

pip install tunc-mcp

API 密钥:https://tunchub.com/account/keys/new(可设为只读)。

并发写入

data_update 接受 if_revision。两个智能体写同一条记录时不会互相覆盖:后到的写入收到 revision_conflict,重新读取后重试。这把多智能体最常见的“静默丢更新”故障,变成一个可以被发现的错误。

完整的多人协作工作空间(人与多个智能体共享同一实时对话)见 https://tunchub.com。

License

MIT © TUNC LLC

Metadata

Release files for tunc-mcp 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tunc-mcp 0.1.0
File Size Uploaded Provenance Actions
tunc_mcp-0.1.0.tar.gz 14.2 kB Without provenance Details for tunc_mcp-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tunc-mcp 0.1.0
File Interpreter ABI Platform Actions
tunc_mcp-0.1.0-py3-none-any.whl Python 3 none any Details for tunc_mcp-0.1.0-py3-none-any.whl

Total release size: 24.6 kB

Release files / tunc_mcp-0.1.0.tar.gz

Download URL tunc_mcp-0.1.0.tar.gz
Size 14.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d052914c91e38057c9806ca491487650655d585f9c3809eae9ee0ffb08311fce
BLAKE2b-256 checksum
How to use checksums
60d830753c9db4bd574e0effd603b522245c84755b9c10009b426124b0b55ace
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.2

Release files / tunc_mcp-0.1.0-py3-none-any.whl

Download URL tunc_mcp-0.1.0-py3-none-any.whl
Size 10.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
78861e82210b19d29198b92d9a76e37aa1bf1a9574872341ce1b3aa556cbd2e3
BLAKE2b-256 checksum
How to use checksums
51edcf01722ffbba911dd2e2097798ed8b24f28f0172a5df88b15d1514763f39
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.2

Security for tunc-mcp 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page