Skip to main content

Muscles JSON-RPC

JSON-RPC protocol projection for Muscles actions.

This package makes Muscles action-first applications callable over JSON-RPC while preserving the same schemas, rules, dispatcher, and context used by other projections.

  • muscles - core action contracts, dispatcher and inspect contract.
  • muscles-cli - CLI action inspection and execution over the same contracts.
  • muscles-mcp - MCP projection over the same action model.
  • muscles-sse - streaming projection for action output.
  • muscles-benchmarks - protocol projection regression checks.

Concept Guardrails

  • JSON-RPC is a protocol projection, not a new framework layer.
  • Methods must be discovered from inspect_application(app).
  • Validation and error normalization must reuse Muscles core schema/rules/errors.
  • Auth/rules must run through ActionDispatcher.
  • The same use case must be callable from CLI, HTTP, MCP, and JSON-RPC without duplicating implementation.
  • JSON-RPC state is scoped to the application instance; no mutable module-level method registry is the source of truth.

Implemented Features

Implemented JSON-RPC 2.0 projection:

  • request validation (jsonrpc, method, params);
  • method discovery from inspect_application(app);
  • dispatch through ActionDispatcher(..., transport="jsonrpc");
  • notification calls;
  • batch calls;
  • core stream projection with stable result.stream envelopes;
  • deterministic error mapping:
    • -32600 invalid request;
    • -32601 method not found;
    • -32602 invalid params;
    • -32001 permission denied;
    • -32603 internal error.

Quick Start

Create the adapter from the existing application and pass JSON-RPC requests to handle. The adapter discovers actions through the Muscles application contract and dispatches them through the shared action dispatcher:

from muscles.jsonrpc import JsonRpcAdapter

rpc = JsonRpcAdapter.from_application(app)
response = rpc.handle({
    "jsonrpc": "2.0",
    "id": 1,
    "method": "bookings.echo",
    "params": {"title": "Planning"},
})

The application must register the action and expose it to the jsonrpc transport. HTTP request parsing and returning the JSON response belong to the selected web runtime or application integration.

Stream actions expose core progress, log, result, and error events in a JSON-serializable envelope. Non-stream list and tuple results keep ordinary JSON-RPC semantics.

Run tests

python -m pytest -q

When testing against local core changes:

PYTHONPATH=../muscles/src:src python -m pytest -q

User docs:

Metadata

Release files for muscles-jsonrpc 2.0.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 muscles-jsonrpc 2.0.0
File Size Uploaded Provenance Actions
muscles_jsonrpc-2.0.0.tar.gz 6.6 kB With provenance Details for muscles_jsonrpc-2.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for muscles-jsonrpc 2.0.0
File Interpreter ABI Platform Actions
muscles_jsonrpc-2.0.0-py3-none-any.whl Python 3 none any Details for muscles_jsonrpc-2.0.0-py3-none-any.whl

Total release size: 11.3 kB

Release files / muscles_jsonrpc-2.0.0.tar.gz

Download URL muscles_jsonrpc-2.0.0.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
a371141408edf18d50f666cc28c1c779d980d3ab8e7bec9e901de04e7e04dcd1
BLAKE2b-256 checksum
How to use checksums
6fa4d81ede943ff69c273da8ee0d7e1147800f071ad519e42b57a94366c1b0a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

Release files / muscles_jsonrpc-2.0.0-py3-none-any.whl

Download URL muscles_jsonrpc-2.0.0-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1de6385d9c4cf99aa0c58ca4e9bd96ca4b4be8d7a3d03b40f8e1d6f5bb77a415
BLAKE2b-256 checksum
How to use checksums
e3f7df56aaecf4feacd56bf5cf64735d5834baeb513e8b0797f9406576353102
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

Security for muscles-jsonrpc 2.0.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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for muscles_jsonrpc-2.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

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