specguard-mcp

v0.1.61
specguard-mcp Checked 10 hours ago Published 22 days ago

MCP server exposing SpecGuard suite intelligence to AI coding agents

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

lint_intent_annotations Lint @intent annotations

Validate the `@intent:` annotations in a project's test files against the OpenTestIntent schema, using that project's own SpecGuard linter: `specguard-lint` for Ruby (RSpec, *_spec.rb; Minitest, *_test.rb; plus any spec/test `support/` file that carries an `@intent:` token, so annotated shared-example files are validated too) or `specguard lint` for JS/TS (@yatfa/specguard; .ts/.tsx/.js/.jsx/.mjs/.cjs). SPECGUARD_LINT_COMMAND picks which one runs; a JS/TS run also needs the validator backend, a validate-intent binary whose path SPECGUARD_VALIDATE_INTENT names (today the only way to supply it;…

ParameterTypeDescription
basestringDiff `changed` against this git ref instead of the default merge base. Ignored unless `changed` is true.
changedbooleanCheck the spec files the branch changed since the merge base with the default branch — the mode CI uses. Needs a linter version that ships --changed: the Ruby gem and @yatfa/specguard main do, but @…
pathsarraySpecific test files to check, relative to project_dir. Omit to check every spec file under it outside dependency/build directories (*_spec.rb and *_test.rb, plus `.rb` files under `spec/**/support/` o…
project_dirstringAbsolute path to the project to lint — the Ruby project root (Gemfile, spec/) or the JS/TS project root (package.json, test sources). Defaults to the directory this server was started in.

get_intent_schema OpenTestIntent schema

Serves the OpenTestIntent schema document itself — the CONTRACT an `@intent:` annotation is validated against — read live from the SpecGuard deployment's own unauthenticated root-level schema mirror, which serves the canonical document's bytes verbatim. Call this BEFORE writing or editing an annotation: it is the reference, while lint_intent_annotations is the judge, and a judge can only tell you that something you already wrote is wrong. Reading the contract is also the ONLY way to learn parts of it: a refusal names the legal values of a field you got wrong but says nothing about a field…

get_repository_overview Get SpecGuard repository overview

Ask SpecGuard what a repository's test suite looks like, WITHOUT running it. Returns the repository the configured API key resolves to, its latest CI run (total and annotated spec counts, annotated ratio, wall-clock and per-shard cost), where that run spent its time (heaviest spec files, heaviest directories, slowest individual examples with file and line), which descriptions are repeated across the suite (the overcoverage ranking: one description carried by many examples, and which files it is spread over), which areas of the suite grew or shrank and which got slower or faster since the previ…

get_server_version Server version

Reports WHICH BUILD of the SpecGuard DEPLOYMENT is answering, read from the deployment's own unauthenticated root-level `GET /version` — the figure the release bot's VERSION file carries, served as a JSON object and passed through verbatim. Since SPGD-1316 that body also carries the enforced contract's identity beside the build — `schema_sha256`, the digest of the OpenTestIntent document this deployment validates annotations against, and `schema_origin`, where those bytes come from on the server — and the whole object is passed through without interpreting it; get_intent_schema is where…

list_repositories List repositories

Lists the SpecGuard repositories this server's key may open — the answer to "what can I ask about", which no other tool here can give, because every other tool is already scoped to one repository by its key. Each entry carries `id`, `full_name` (`org/repo`, and the handle every other surface names a repository by), `name`, `registered_at`, `role`, `delivery_health` and `latest_run`. `delivery_health` is the entry's delivery verdict — `refusing` beside `last_rejection_at` — served on every entry, so this one call triages ingest-pipeline health across the whole reachable set (the coarse si…

ParameterTypeDescription
qstringKeep only the repositories whose `github_full_name` (`org/repo`) CONTAINS this substring, case-insensitively — the same ask the deployment's web grid reads. A plain substring, not a pattern: the ser…
rolestringKeep only ONE half of the list's mix: `owned` keeps the repositories this person owns, `shared` keeps the ones somebody shared with them. The two partition the accessible set exactly — a repository…
sortstringRe-order the list. The default order is `full_name` ascending, which is stable across calls but says nothing about what needs attention; `stale` puts the repositories CI has NEVER ingested a run for F…

add_repository Add repository

Registers a GitHub repository with SpecGuard for the person behind this server's user API key, and returns the repository along with its first CI API key. Takes `full_name` as `org/repo` — the same handle `list_repositories` reports and every other SpecGuard surface names a repository by. On success the response carries a `repository` block (`id`, `full_name`, `name`, `registered_at`) and an `api_key` block (`id`, `name`, `token`, `hint`, `created_at`); `id` is the key's durable handle (the token is reveal-once), and every OTHER key's id comes from `list_repository_api_keys`. ⚠️ `api_key…

ParameterTypeDescription
full_name *stringThe repository to register, as `org/repo` (for example `acme/billing`) — the same handle `list_repositories` reports. Not a URL and not a bare repository name. SpecGuard validates the format and ref…

registrable_repositories Registrable repositories

Lists the GitHub repositories the person behind this server's user API key could register with SpecGuard — the set the registration gate would consult, read out in advance, so an agent can pick a `full_name` for `add_repository` from a real answer rather than by guessing. Each entry carries `full_name` and `registered`. `registered` is asked GLOBALLY, not just of this person's own repositories: an entry marked `registered: true` was registered by SOMEBODY — possibly someone else — and a POST naming it will be refused with `has already been taken`, which is exactly the question this flag…

remove_repository Remove repository

Removes a repository from SpecGuard, DELETING every key, run and intent on it. This is IRREVERSIBLE: the repository's CI keys stop authenticating and its recorded runs and intents are gone, with no undo and no way to recover them short of re-registering from scratch. A 204 means it is deleted. Authorization is the `repo.delete` capability at either surface — an owner, or a member granted it, may remove the repository; a member without it is refused 403 in SpecGuard's own words. Confirm with the user before calling: this is the destructive gesture in this toolset, and once it returns 204 the…

ParameterTypeDescription
repository_id *stringThe id of the repository to remove — the numeric id `add_repository` returns and `list_repositories` reports, not the `org/repo` handle. SpecGuard scopes the lookup to repositories you may act on an…

create_repository_api_key Create repository API key

Mints a new CI API key (an sgk_… key) for a SpecGuard repository, returning the new key ALONE in an `api_key` block — the repository's full key set (keys minted in the web panel or in an earlier session included) is `list_repository_api_keys`' answer, never this response's. ⚠️ `api_key.token` is shown THIS ONCE AND NEVER AGAIN — nothing stores it and no endpoint can re-serve it, so hand it to the user in your reply rather than assuming it can be fetched later. If it is dropped, the recovery is minting another key with this same tool (the platform has no regenerate), then revoking the…

ParameterTypeDescription
repository_id *stringThe repository to mint the key for — its numeric id, as `add_repository` returns and `list_repositories` reports, not the `org/repo` handle.
namestringAn optional label for the key. Omit it to let SpecGuard use its default name. The server validates the name and refuses an unusable one in its own words.

revoke_repository_api_key Revoke repository API key

Revokes one CI API key on a SpecGuard repository. The key stops authenticating immediately; every OTHER key on the repository keeps working, so CI keeps ingesting if it holds a surviving key. The `key_id` is scoped to `repository_id`: a key id belonging to a different repository is refused 404, never a cross-repository delete. Key rotation is mint-then-revoke, in that order: the platform has no regenerate, so mint a replacement with `create_repository_api_key` and deploy it BEFORE revoking the old one — revoke first and the repository's CI is locked out until a human mints a new key in a bro…

ParameterTypeDescription
key_id *stringThe id of the key to revoke. The mint response carries the id of the key IT minted in its `api_key` block (`create_repository_api_key`, or `add_repository` for the registration key); every OTHER key's…
repository_id *stringThe repository the key belongs to — its numeric id, as `add_repository` returns and `list_repositories` reports, not the `org/repo` handle.

list_repository_api_keys List repository API keys

Lists a SpecGuard repository's CI API keys (`sgk_…` keys) — the verify step of the mint-and-replace rotation. After minting a replacement with `create_repository_api_key` and deploying it, list HERE and check the replacement's `last_used_at` before revoking the old key: `null` means the new token has not presented itself yet, and cutting the old key then locks the repository's CI out until a human mints in a browser. The mint response carries the id of the key IT minted (in its `api_key` block); THIS listing is the id source for every other row — keys minted in the web panel or in an ear…

ParameterTypeDescription
repository_id *stringThe repository whose API keys to list — its numeric id, as `add_repository` returns and `list_repositories` reports, not the `org/repo` handle.

near_duplicate_clusters Near-duplicate clusters

Run SpecGuard's near-duplicate census over a repository's tests — which tests READ alike (same body text, whatever file they sit in), clustered by similarity. Answers the refactoring question the overview's per-run rankings cannot: where is the same test written twice, before you delete or merge anything. This call is SERVED STORED: the server computes the census at each ingest and on each run deletion and keeps it, so the answer returns in milliseconds instead of running the minutes-scale computation that used to sit behind the ask (and never fit this bridge's 30-second deadline). READ THE…

ParameterTypeDescription
clusterintegerAsk for ONE cluster by its `rank` in the ranking (1-based): the `near_duplicate_cluster` block, members listed once. Take the rank from a `summary` call and read `computed_at` first — ranks are posi…
repositorystringCensus THIS repository instead of the one the configured sgk_… key resolves to. The value is the repository's NUMERIC ID, exactly as served in `list_repositories` entries' `id` — not the `org/repo…
summarybooleanAsk for the BOUNDED census view: the `near_duplicates_summary` block — the ranking (head keys first, `ranking_basis` and `layer_redundancy_counts` among them; per cluster `rank`, `files_seen`, `file…

list_repository_members List repository members

Lists who has access to a SpecGuard repository: one row per member with their `id` (the MEMBERSHIP id `update_repository_member_permissions` and `remove_repository_member` name), `handle`, `permissions`, `granted_by` (who last set them) and `created_at`, ordered by handle. The list answers MEMBERSHIPS only and never reports how many CI keys a member has minted (`keys_minted`) — that is a separate `keys.manage` disclosure this endpoint deliberately withholds, and the API-keys tools are the surface for it. Authorization is the `members.manage` capability: a caller who is not a member of the re…

ParameterTypeDescription
repository_id *stringThe repository whose members to list — its numeric id, as `add_repository` returns and `list_repositories` reports, not the `org/repo` handle.

add_repository_member Add repository member

Grants a person access to a SpecGuard repository by their GitHub handle, with an optional list of permissions. The `handle` is the LOGIN itself — `octocat`, not a profile URL and not a display name: SpecGuard refuses each of those with its own sentence, and every other resolution failure (nobody has signed in as that handle yet, the account is archived, the handle is ambiguous) arrives as a distinguishable 400 message naming the exact next move. The grantor recorded on the membership is always the person behind the credential — the one an sgu_… key speaks for, or the OWNER of the sga_……

ParameterTypeDescription
handle *stringThe GitHub login of the person to add, e.g. `octocat` — not a profile URL and not a display name; SpecGuard refuses both with its own sentence. The person must have signed in to SpecGuard at least o…
repository_id *stringThe repository to grant access to — its numeric id, as `add_repository` returns and `list_repositories` reports, not the `org/repo` handle.
permissionsarrayAn optional list of permission strings from SpecGuard's own set (`view`, `keys.manage`, `members.manage`, `repo.delete`). Omit it to grant access with no additional permissions. SpecGuard validates th…

update_repository_member_permissions Update repository member permissions

Replaces one member's permission set on a SpecGuard repository. The member is named by `member_id` — a MEMBERSHIP id, not a user id — and the id is SCOPED to `repository_id`: a membership id belonging to a different repository is refused 404, never a cross-repository write. ⚠️ `permissions` REPLACES the whole set — it is not merged with what the member holds today, so name every permission the member should end with. Values are strings from SpecGuard's own set (`view`, `keys.manage`, `members.manage`, `repo.delete`); an unknown value is refused in SpecGuard's own words. The membershi…

ParameterTypeDescription
member_id *stringThe id of the MEMBERSHIP row to edit — not a user id, and not the handle. Scoped to `repository_id`: a foreign membership id is refused 404. Take it from the `id` field of a member row served by `li…
permissions *arrayThe member's COMPLETE new permission set, replacing what they hold today — e.g. ["view", "keys.manage"]. Not merged. An empty array removes every additional permission while keeping the membership.
repository_id *stringThe repository the membership belongs to — its numeric id, as `add_repository` returns and `list_repositories` reports, not the `org/repo` handle.

remove_repository_member Remove repository member

Revokes one person's access to a SpecGuard repository by removing their membership. The member is named by `member_id` — a MEMBERSHIP id, not a user id — scoped to `repository_id`: a membership id belonging to a different repository is refused 404, never a cross-repository revoke. ⚠️ Revoking does NOT revoke that member's minted CI keys — any sgk_… keys they created on the repository keep authenticating by design; the lever for those is the API-keys surface (`revoke_repository_api_key`), not this one. Self-revocation is permitted: a caller may remove their own membership, and their…

ParameterTypeDescription
member_id *stringThe id of the MEMBERSHIP row to revoke — not a user id, and not the handle. Scoped to `repository_id`: a foreign membership id is refused 404. Take it from the `id` field of a member row served by `…
repository_id *stringThe repository the membership belongs to — its numeric id, as `add_repository` returns and `list_repositories` reports, not the `org/repo` handle.

remove_repository_run Remove repository run

Deletes ONE test run from a SpecGuard repository — the junk-run lever beside `remove_repository`, which deletes every run, key and intent at once. IRREVERSIBLE: the run, its per-shard rows and its per-example observations are gone, with no undo and no bulk or by-branch delete anywhere on the surface. Read the id off the overview first: `latest_run.id` and every `history[]` row's `id` (SPGD-2014) are the only handle this route accepts — a commit_sha deliberately is not one, because one sha can name several runs of one repository. The `run_id` is scoped to `repository_id`: a run id belonging…

ParameterTypeDescription
repository_id *stringThe repository the run belongs to — its numeric id, as `add_repository` returns and `list_repositories` reports, not the `org/repo` handle.
run_id *stringThe id of the run to delete — the numeric id served on `latest_run.id` and on every `history[]` row of `get_repository_overview` (SPGD-2014), the same number `POST /ingest` answers as `test_run_id`.…

rename_repository Rename repository

Renames a SpecGuard repository — changes the `org/repo` GitHub full name it is registered under — WITHOUT destroying anything. This is the alternative to the remove-and-re-register path: that one deletes every API key, run and intent on the repository, while this keeps all of them. ⚠️ Authorization is OWNER-ONLY — deliberately narrower than removal: a member granted `repo.delete` may destroy the repository but may NOT rename it. The owner check also redeems a browser-issued grant valid for 7 days; a nil or stale one is refused 403 in SpecGuard's own words, and that sentence names the…

ParameterTypeDescription
github_full_name *stringThe repository's new GitHub full name, `org/repo` — sent TOP-LEVEL in the request body, not nested under `repository`. A name another repository already holds is refused 400 (`taken`).
repository_id *stringThe id of the repository to rename — the numeric id `add_repository` returns and `list_repositories` reports, not the `org/repo` handle. SpecGuard scopes the lookup to repositories you own and answe…

list_repository_agent_keys List repository agent keys

Lists the agent keys (`sga_…` keys) covering a SpecGuard repository: one row per live key with its `id`, `name`, `owner`, `token_hint`, `repository_count` (how many repositories the key's grant covers — the blast radius), `permissions`, `created_at` and `last_used_at` — when the key's token last authenticated, null meaning the key has never been presented, so the inventory answers "is this live key still being used" before a revoke — the decision half of offboarding. Agent keys have NO mint tool on this bridge — minting is deliberately web-only — so the `id` this listing serves is…

ParameterTypeDescription
repository_id *stringThe repository whose agent keys to list — its numeric id, as `add_repository` returns and `list_repositories` reports, not the `org/repo` handle.

list_repository_agent_keys_presented_revoked List still-presented revoked agent keys

Lists REVOKED agent keys whose token is still arriving at the deployment after revocation — the verify half of offboarding: run it after `revoke_repository_agent_key` to learn whether the dead token is still being presented somewhere. Each row carries `id`, `name`, `owner`, `token_hint` (hunt THIS in whatever secret stores may still hold the dead token, and update them), `repository_count`, `revoked_at` and `last_refused_at`. `last_refused_at` is the LAST observed presentation — a recency, never a present-tense claim that something is presenting the token right now. An empty `{"agent_keys"…

ParameterTypeDescription
repository_id *stringThe repository to triage — its numeric id, as `add_repository` returns and `list_repositories` reports, not the `org/repo` handle.

revoke_repository_agent_key Revoke repository agent key

Revokes one agent key (`sga_…` key) on a SpecGuard repository. IRREVERSIBLE, and the blast radius is the key's WHOLE stored set: the grant (repository set + permission set) is stored once at mint time, so this one call cuts the token on EVERY repository the key covers, not just `repository_id` — check `repository_count` on `list_repository_agent_keys` BEFORE cutting a multi-repository key. Answers `200` WITH the disclosure body — an `agent_key` block carrying `revoked_at`, `repository_count` and the still-existing `repositories` names, plus `deleted_repository_count` when some have been…

ParameterTypeDescription
key_id *stringThe id of the agent key to revoke, as served by `list_repository_agent_keys` — the only id source, because agent keys have no mint tool on this bridge. Scoped to `repository_id`: a key whose stored…
repository_id *stringThe repository whose key-administration scope the call is made under — its numeric id, as `add_repository` returns and `list_repositories` reports, not the `org/repo` handle. The CUT, however, lands…

find_tests_near_behavior Find tests near a behavior

Ask a repository's stored test suite map: which tests are nearest a behavior phrase you give it? The server embeds your phrase and ranks the repository's stored test identities by similarity, returning the top hits in the `near` block — each with its similarity, `signal_source`, last-known path and the weight the latest run measured. THE ANSWER IS A PAGE, NOT THE SET: the default page is 10 hits. READ `truncated` AND `limit` in the returned `near` block — `limit` is the page size the server APPLIED (it clamps your ask to 50) and `truncated: true` means MORE matches exist than were returned…

ParameterTypeDescription
behavior *stringREQUIRED. The behavior phrase to look for — plain words describing what a test would check, e.g. "rejects an expired password reset token". Trimmed and sent as `near`. Blank or whitespace-only is re…
limitintegerOPTIONAL page size: how many hits to return in the `near` block. Omit it for the default page of 10. The server clamps the ask to 50 and reports the value it applied as `limit` in the `near` block, be…
repositorystringAsk THIS repository instead of the one the configured sgk_… key resolves to. The value is the repository's NUMERIC ID, exactly as served in `list_repositories` entries' `id` — not the `org/repo` h…