-
Notifications
You must be signed in to change notification settings - Fork 0
Unify CLI and MCP surfaces over shared operation declarations #38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3bf2581
Add CI test workflow; fix fmt and clippy warnings
saramaebee d72df38
Unify CLI and MCP surfaces over shared operation declarations
saramaebee c3c3310
Address review: clamp pagination, page snippet locations, document 0.…
saramaebee a946cb2
CI: don't persist checkout credentials
saramaebee 3975404
Hold version at 0.3.0; make migration notes version-agnostic
saramaebee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| name: Test | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| with: | ||
| persist-credentials: false | ||
| - uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| components: clippy, rustfmt | ||
| - uses: Swatinem/rust-cache@v2 | ||
| - name: Format | ||
| run: cargo fmt --check | ||
| - name: Clippy | ||
| run: cargo clippy --all-features --all-targets -- -D warnings | ||
| - name: Test | ||
| run: cargo test --all-features | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| # Changelog | ||
|
|
||
| ## Unreleased | ||
|
|
||
| The CLI and MCP server now share one set of operation declarations (`src/ops/`), | ||
| so the two surfaces expose identical operations with identical parameters. | ||
|
|
||
| ### Breaking changes | ||
|
|
||
| - **MCP arg shapes changed.** Per-entity fields replace the generic | ||
| `parent`/string `id`; list entities are plural (`{"entity": "issues", ...}`), | ||
| matching the CLI. Agent clients pick the new shapes up from `tools/list`; | ||
| saved call examples must be updated (see README → Migrating to the unified | ||
| surface). | ||
| - **The standalone `snippet_match` MCP tool is gone.** Use `get` with | ||
| `entity: "snippet_match"`. | ||
| - **`list snippet-locations` is paginated.** Both surfaces page over the | ||
| underlying snippets (`--page`/`--count`) and return a page object instead of | ||
| an unbounded array. | ||
| - **CLI:** `list dependencies` no longer accepts `--revision` as an | ||
| alternative to the positional revision argument. | ||
| - `update project` with no fields to change is rejected instead of sending an | ||
| empty update. | ||
|
|
||
| ### Additions | ||
|
|
||
| - MCP gains `get snippet`, paged `list snippets`, `list snippet_paths`, and | ||
| issue-category auto-probe; the CLI gains `update --url/--policy-id/ | ||
| --default-branch` and real pagination on `list revisions` and | ||
| `list dependencies`. | ||
| - `page`/`count` values below 1 are clamped to 1 (`count` is capped at 100). | ||
| - MCP calls using the legacy arg shapes fail with a migration hint naming | ||
| this change. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| # fossapi | ||
|
|
||
| A CLI and MCP server exposing the FOSSA API to humans and agents through one | ||
| shared set of operation declarations. | ||
|
|
||
| ## Language | ||
|
|
||
| **Operation**: | ||
| One verb applied to one entity (e.g. get issue, list snippets). Declared once | ||
| and exposed identically by both surfaces. | ||
| _Avoid_: endpoint, command | ||
|
|
||
| **Verb**: | ||
| One of `get`, `list`, `update` — the top-level grouping of operations. Each | ||
| verb is one shared enum and one MCP tool. (In code the enums are spelled | ||
| `GetCommand`/`ListCommand`/`UpdateCommand`; "command" in a type name means | ||
| verb, not operation.) | ||
| _Avoid_: action, method | ||
|
|
||
| **Entity**: | ||
| The thing a verb acts on (`project`, `issue`, `snippet_locations`, …). Appears | ||
| as the CLI subcommand name and as the `entity` discriminator in MCP arguments. | ||
| _Avoid_: resource, object | ||
|
|
||
| **Declaration**: | ||
| The single definition of an operation — its parameter struct and enum | ||
| variant — from which both surfaces derive their interface, documentation, and | ||
| schemas. | ||
|
|
||
| **Surface**: | ||
| A way of reaching the operations: the CLI (for humans) or the MCP server (for | ||
| agents). Surfaces are thin adapters; neither adds operations of its own. | ||
| _Avoid_: frontend, interface | ||
|
|
||
| **Parity**: | ||
| The guarantee that both surfaces expose exactly the same operations with the | ||
| same parameters. | ||
|
|
||
| **Pagination policy**: | ||
| The defaults and global bounds applied to `page`/`count` before an operation | ||
| runs. One policy for all operations; individual FOSSA endpoints may impose | ||
| their own tighter bounds. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # Generic MCP tools per verb, not per operation | ||
|
|
||
| The MCP server exposes exactly three tools — `get`, `list`, `update` — each | ||
| taking an `entity` discriminator, rather than one tool per operation | ||
| (`get_issue`, `list_snippets`, …). The CLI and the MCP server are one | ||
| presentation layer and must stay consistent, so the tools mirror the CLI's | ||
| verb-first grammar; a small tool list also keeps agent contexts lean. | ||
|
|
||
| ## Considered Options | ||
|
|
||
| One tool per operation was rejected: its main draws are per-tool permissioning | ||
| and discoverability, but authorization is enforced by the FOSSA app behind the | ||
| API token (the tool surface adds nothing), and entity discoverability is | ||
| handled by the tool descriptions and self-describing input schemas. | ||
|
|
||
| ## Consequences | ||
|
|
||
| Adding an operation never changes the MCP tool list — clients' saved tool | ||
| configurations stay valid as the operation set grows. The cost is that the | ||
| `entity` tag becomes load-bearing wire format: renaming an entity is a | ||
| breaking change to every saved call, not just a CLI rename. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.