Skip to main content

acture (Python)

acture is a development tool first. This Python package is an optional accelerator — an agent can hand-write the same client into your project instead, with no acture Python dependency. Installing it is a deliberate, opt-in choice to reuse a tested facade rather than own it. See docs/positioning.md and docs/hand-written-python-client.md.

The acture library itself is a TypeScript / JavaScript package on npm (https://www.npmjs.com/package/acture); the server side ships as acture-mcp-server. This Python package is a thin client that consumes any acture-mcp-server instance the same way an LLM agent would — via the Model Context Protocol.

Install

pip install acture

Requires Python ≥ 3.10. Brings one runtime dependency: the official mcp SDK (≥ 1.10).

Use

import asyncio
from acture import ActureClient

async def main():
    async with ActureClient.from_stdio(['node', 'dist/cli.js']) as client:
        # Dict-like over the command registry
        print(list(client))                       # ['app.foo', 'app.bar', ...]
        print(len(client))                        # 2
        print(client['app.foo'].description)

        # Call a command
        result = await client['app.foo'](text='hi')
        print(result)                             # the dispatch's structuredContent

asyncio.run(main())

ActureClient is a Mapping[str, Command]. The dict-like surface mirrors dol and py2mcp conventions.

Errors as data

A failed dispatch on the TypeScript side ({ ok: false, error: { code, message } }) arrives in Python as a typed exception:

from acture import ActureError

try:
    await client['app.may_fail'](x=1)
except ActureError as e:
    print(e.code, e.message, e.details)   # e.command_id == 'app.may_fail'

If you want the raw CallToolResult instead — without an exception — use call_raw:

result = await client['app.may_fail'].call_raw(x=1)
if result.isError:
    print('failed:', result.content)
else:
    print('ok:', result.structuredContent)

Transports

Two transports bundled out of the box:

# stdio — launch the server as a subprocess
async with ActureClient.from_stdio(['node', 'dist/cli.js']) as client:
    ...

# streamable HTTP — connect to a long-running server
async with ActureClient.from_http('http://localhost:9000/mcp') as client:
    ...

For an in-memory channel (tests), a WebSocket bridge, or any other transport, pass an async context manager yielding (read, write) streams to ActureClient.connect(transport=...). The bundled helpers (acture.stdio_transport, acture.http_transport) are the reference shapes.

The registry is in a browser page, the loop is here. A page cannot listen for connections, so it opens the conversation and this side answers over it. acture.CallbackTransport(send=...) is a transport with no socket of its own: each MCP message the client writes goes out through your send callback (push it down the page's stream), and each message the page posts back goes in through await transport.feed(message). The browser end is createPageTransport in acture-mcp-server.

transport = CallbackTransport(send=push_to_page)
async with ActureClient.connect(transport) as client:   # elsewhere: await transport.feed(msg_from_page)
    await client['board.show'](count=3)

If the page disappears mid-call the request gets no answer; call await transport.close() when its stream ends so pending calls fail at once.

What's intentionally not in v1

Per acture_research_6 §"v1 scope":

  • No Pydantic-codegen SDK. Pydantic adds no value for agents — they read JSON Schema + descriptions. Human users who want typed models can run datamodel-code-generator over each tool's inputSchema themselves; that is post-v1 work and out of scope for the thin facade.
  • No OpenAPI emitter. OpenAPI imposes REST semantics on a function-call protocol; MCP already speaks JSON Schema. Adding a second wire would double the surface area without serving agents.
  • No hard dependency on pydantic, httpx, or any framework. The package is mcp-only; the mcp SDK brings what it needs.

Both are post-v1 candidates; pull-forward decisions are the user's.

Tier filtering

Tier filtering happens on the server side. The Python client sees whatever acture-mcp-server published — typically tier: 'stable' only. To see experimental commands, configure the server-side tiers option, not the client.

See also

License

Apache-2.0.

Metadata

Release files for acture 1.4.2

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

Source distribution (sdist)

Source distribution for acture 1.4.2
File Size Uploaded Provenance Actions
acture-1.4.2.tar.gz 11.5 kB Without provenance Details for acture-1.4.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for acture 1.4.2
File Interpreter ABI Platform Actions
acture-1.4.2-py3-none-any.whl Python 3 none any Details for acture-1.4.2-py3-none-any.whl

Total release size: 25.5 kB

Release files / acture-1.4.2.tar.gz

Download URL acture-1.4.2.tar.gz
Size 11.5 kB
Tags Source
SHA-256 checksum
How to use checksums
07beb19edd0f2ebb1f26fd39f27bb75452dcbe54fa73b0e10337b6aa6111b2d7
BLAKE2b-256 checksum
How to use checksums
7317543920b60750b9645b7c825ffe5a15e14346a32b7471a5730afcf28952b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Release files / acture-1.4.2-py3-none-any.whl

Download URL acture-1.4.2-py3-none-any.whl
Size 14.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
805413b73c760b77d7d8ff4a270fc6414c39dbfceada127f01bb8e090a124349
BLAKE2b-256 checksum
How to use checksums
791f297b8fbcf87369e59db23c3b86aa4dd5777e343490dca9c76c5f0ba89b13
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Security for acture 1.4.2

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.

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