Metadata-Version: 2.4
Name: resultant-mcp
Version: 1.3.0
Summary: Resultant for the coding agent you already use: governed project context, decisions and pre-PR validation over MCP.
Author: Resultant
License-Expression: Apache-2.0
Project-URL: Homepage, https://resultant.dev
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Quality Assurance
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: mcp<2,>=1.0
Requires-Dist: httpx>=0.27
Dynamic: license-file

# Resultant MCP

Resultant for the coding agent you already use. Resultant supplies your project's governed
context, says what is settled and what is unknown, controls consequential changes to governed
work, and checks a change before you open a pull request. Your agent keeps its own tools; the
same work stays visible in Resultant's console, VS Code extension and Jira panel, because all of
them read the same state.

This package is the Model Context Protocol (MCP) adapter. It runs locally over stdio, beside
Claude Code, Codex or any other MCP host.

## Requirements

- A Resultant account with access to a project.
- Python 3.10 or later.

## Install

```bash
pipx install resultant-mcp
```

`uv tool install resultant-mcp` works the same way. Installing from a checkout of the Resultant
repository is `pip install ./apps/mcp-server`, without `-e`: an editable install stops working
once that checkout is moved or removed.

## Sign in

```bash
resultant-mcp login      # opens a browser once; nothing to copy or paste
resultant-mcp status     # who this machine is signed in as
resultant-mcp logout     # forget the session
```

Sign-in uses the OAuth authorization-code flow with PKCE, with the code delivered to a loopback
listener this process owns (RFC 8252, section 7.3). The session carries a refresh token, and the
adapter renews the access token before it expires and again after a `401`. Agents driven from an
editor panel can call the same flow as the `resultant_login` tool.

## Configure your agent

Generate the configuration rather than copying one. It contains no credential:

```bash
resultant-mcp-init claude_code --project-id <project-id> --api-url https://api.resultant.dev
resultant-mcp-init codex --project-id <project-id> --api-url https://api.resultant.dev
```

`cursor` and `generic` are also available. Each command prints the block and where it goes.
`resultant-mcp-init <host> --check <file>` checks an existing file for a committed credential.

## Check the installation

```bash
resultant-doctor --repo-dir .           # exit 0 only when every check passed
resultant-doctor --repo-dir . --json    # machine-readable
```

The doctor checks the local runtime, the credential, the connection and contract version, the
project and its repository, this checkout, the source provider and, for a project whose work
comes from Jira, the issue tracker. Each failing check carries its own remedy, a check that could
not run is shown as `SKIP`, and the report never contains a credential. Agents can run it as
`resultant_doctor`.

## Tools

| Tool | What it does | Changes anything? |
| --- | --- | --- |
| `resultant_health` | Version, contract and the capabilities available to this project | No |
| `resultant_doctor` | The installation check above | No |
| `resultant_login` | Signs this machine in | Stores this machine's session |
| `resultant_get_work`, `resultant_get_run`, `resultant_get_artifact`, `resultant_get_trace` | A work item, a run, a committed stage artifact, and the trace from requirement to change | No |
| `resultant_validate_change`, `resultant_check_push_readiness` | Checks a local change with the same engine as Resultant's pull request check, and whether a commit is cleared to push | No |
| `resultant_plan_revision` | Shows what a change to running work would affect | No |
| `resultant_query_context` | Lists the governed questions Resultant can answer and, for a project with code questions switched on, answers one from the project graph with its sources, the commit the graph was scanned at beside the branch's live head, and the repository checks the answer asks for | No |
| `resultant_read_code` | Has Resultant read the project's code to answer one question: the repositories at their live heads through the read-only connection, the graph answer checked against them, the lines that match, and, when asked, a bounded investigation and an independent check of what it finds | Writes only the developer's own reading record, and only when the project has code questions switched on. With `investigate` it spends model budget |
| `resultant_get_code_reading` | Reads a code reading: its excerpts and claims cited by file and line at the pinned commits, what stays unknown, what could not be read and what was not done | No |
| `resultant_invoke_action`, `resultant_answer_decision`, `resultant_apply_revision` | Carry out an action Resultant signed, answer the run's open decision, apply a planned revision | Yes. Resultant checks the role, the revisions and the confirmation first |
| `resultant_get_assignment`, `resultant_submit_work_product` | Take and submit delegated work | Yes |
| `resultant_define_intent`, `resultant_update_intent` | Judge whether a request is one change to how the product behaves and, when it is, draft its definition with the developer; send the developer's answers, choices and edits | Yes, the developer's own draft only, and only when the project has governed changes switched on |
| `resultant_get_intent` | Reads a draft definition: what the developer selected, what Resultant suggests, the open decision and what is unresolved | No |
| `resultant_accept_intent` | Accepts a ready definition as the project's accepted intent once the developer confirms it | Yes. Resultant offers a signed action and checks the role, the revision and the code first |

The tools that change nothing declare themselves read-only (MCP `readOnlyHint`), so an agent that
honours the declaration runs them without asking. The others declare nothing, and an agent asks
before it runs them. Which tools are available is decided per project by Resultant, and the
governed ones are off unless your project has them enabled.

There is no tool per internal stage and no argument that takes a command. The agent asks
Resultant to start, continue, inspect, validate or answer, and Resultant chooses the next step.

## What it does not do

It evaluates nothing. Every verdict in a response is Resultant's. This package owns transport,
local diff collection, credential handling and rendering; it contains no gate, no role check and
no stage rule.

A code reading reads the code as it is at the branch's live head. For a project whose code is
connected through Resultant Read-Only, it does not read pull requests or commit history: that
connection has no permission on pull requests, and the code is read as an archive of one commit,
which carries no history. `resultant_validate_change` remains the check of a local change before
a pull request is opened.

## Environment

No credential belongs in a configuration file that is committed to a repository.

| Variable | Purpose |
| --- | --- |
| `RESULTANT_API_URL` | Resultant API base URL |
| `RESULTANT_PROJECT_ID` | Default project |
| `RESULTANT_HOST_CLIENT` | Which coding agent is driving, for attribution |
| `RESULTANT_CI_SERVICE_TOKEN` | Machine credential for a CI job. Validation only, never mutation |
| `RESULTANT_API_TOKEN` | Overrides the signed-in session with one identity. Not renewed |
| `RESULTANT_TOKEN_COMMAND` | Command that prints a user token, for an OS credential store |
| `RESULTANT_SESSION_FILE` | Where the session is stored. Defaults under `$XDG_CONFIG_HOME/resultant` |

## Compatibility

`resultant-wedge-mcp` is kept so that an existing configuration pointing at it keeps working,
with its two validation tools unchanged. New configuration should use `resultant-mcp`.

## Development

From the Resultant repository:

```bash
pytest apps/mcp-server/tests
```

## License

Apache License 2.0. See `LICENSE`.
