Skip to main content

Python client for an acture MCP server — a dict-like facade over the Model Context Protocol. The acture library itself lives on npm (https://www.npmjs.com/package/acture).

Project description

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.

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.

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

acture-1.3.0.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

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

acture-1.3.0-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

Details for the file acture-1.3.0.tar.gz.

File metadata

  • Download URL: acture-1.3.0.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for acture-1.3.0.tar.gz
Algorithm Hash digest
SHA256 991a8bcbf0f48546e4ba453f38a5512869c3ac6c0d99728a3f8d1e4a632890bd
MD5 f1e83c70da69d63fc87ce49f39dcef75
BLAKE2b-256 a88651df7421e5d43ccebc4a6c9da381f237ccf9e258bcbc75a0e45a96d423da

See more details on using hashes here.

File details

Details for the file acture-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: acture-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 12.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for acture-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ba5c135ca2a2a77666c2eed3ff126d68f444390b1e05f8cddcd4a2eee26cc76d
MD5 13e90a111c4ea473b4cb3a7d50aeb868
BLAKE2b-256 b49e6dbf87922aa835b97ef79a7c8b53ec020c6a478145a02df61fec36d7ad84

See more details on using hashes here.

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