Skip to content

Add setup and configuration clients over the hosted MCP tools - #126

Open
bryanwahyu wants to merge 1 commit into
prooflinedev:mainfrom
bryanwahyu:add-configuration-and-setup-clients
Open

bryanwahyu wants to merge 1 commit into
prooflinedev:mainfrom
bryanwahyu:add-configuration-and-setup-clients

Conversation

@bryanwahyu

@bryanwahyu bryanwahyu commented Nov 27, 2026 •

Copy link
Copy Markdown

Who it helps

Teams that onboard repositories or keep Proofline settings in code, from a Python service, an internal platform tool, or a coding agent written in Python. Today proofline setup status|candidates and proofline config get|operations|describe|propose|apply exist only in the CLI. From Python, the only option is shelling out to the binary or hand-writing the MCP handshake. This PR adds the same seven hosted tools to both clients:

with ProoflineClient() as client:
    status = client.setup.get_setup_status()
    described = client.config.describe_operation(
        "repository.wiki_settings.update", {"repo_id": repository_id}
    )
    proposal = client.config.propose_change(
        "repository.wiki_settings.update",
        parameters={"repo_id": repository_id},
        input={"enabled": True},
        expected_revision=described["structuredContent"]["data"]["revision"],
    )
    change = proposal["structuredContent"]["data"]
    if "approval_url" not in change:
        client.config.apply_change(change["change_id"])

Decisions

  • Same shape as knowledge and fixes. client.setup and client.config (sync and async) subclass the existing McpTools/AsyncMcpTools, so they inherit the handshake, the 8 KiB request bound, the no-retry rule, the ProoflineError mapping for protocol and HTTP errors, and per-call organization_id. Results stay KnowledgeResult, and refusals come back with isError set, just like the other MCP helpers. The new methods wrap no structured data in types of their own, because that data is the hosted tool's contract and nothing in this repo pins it.
  • Arguments match the CLI on the wire. I read src/config.rs, src/setup.rs and the CLI's HTTP tests and send the same argument objects. Only the selectors you pass are sent, and describe_operation always sends parameters (empty when none are given), as the CLI does.
  • request_id is an idempotency key, so the SDK makes it controllable. The CLI's setup guide says to send a new random UUID on each proposal and to reuse it only for a retry of the identical call. propose_change generates a fresh UUID version 7 when request_id is omitted (Python 3.11 has no uuid.uuid7, so new_request_id() builds one per RFC 9562 and is exported). Callers that want to retry safely after an uncertain result pass their own value. The SDK never retries on its own.
  • Nothing applies without the caller asking. propose_change returns the server's diff and change_id, or the approval_url for a sensitive change. apply_change returns a held sensitive change (applied: false) unchanged, and never follows the approval link.
  • Hand-written code only. Nothing under proofline/_generated/, openapi.public.json or the workflows changes.

How I verified it

  • python3 scripts/check.py passes. It regenerates the client, runs ruff, ruff format, mypy and the contract checks, runs the full suite (225 passed, including 7 new tests), and smoke-tests the built wheel and sdist.
  • tests/test_configuration.py uses the existing loopback HTTP server in both sync and async modes:
    • every setup and config method, with and without organization_id, sends exactly the expected tool name and arguments, in one handshake plus one call;
    • propose_change sends a fresh version 7 request_id on each call, keeps a caller-supplied one, and omits input when none is given;
    • a tool refusal and a held sensitive apply_change are returned unchanged, and a 503 raises ProoflineError with no retry;
    • new_request_id() produces unique RFC 9562 version 7 UUIDs carrying the current millisecond timestamp.
  • test_mcp_public_types_accept_legacy_and_targeted_calls now also type-checks every new method, legacy and targeted, through the public entry point with the repo's mypy config.
  • I did not call the hosted service: I have no Proofline organization with setup:write/org:configure tokens. Wire compatibility rests on matching the CLI's arguments and its tests.

Expose get_setup_status, list_setup_candidates, get_configuration,
list_operations, describe_operation, propose_change and apply_change as
client.setup and client.config on both sync and async clients, matching
the arguments the CLI's setup and config commands send.

propose_change sends a fresh UUIDv7 request_id unless the caller passes
one, so an identical call can be retried safely after an uncertain
result. Like the other MCP helpers, nothing retries automatically.
@bryanwahyu
bryanwahyu force-pushed the add-configuration-and-setup-clients branch from 2343867 to 8853291 Compare November 27, 2026 12:13

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant