cg_list_repositories
Every repo the token can access — uuid, full_name, stack_key, has_active_rulebook. Always the first call.
The CodeGuards MCP server exposes cg_* tools to Cursor, Claude Desktop, ChatGPT and any
MCP-compatible agent. Read repository profiles, inspect base rule packs, draft custom rules,
and prune false positives — all with the same auth, validation, and audit trail as the workspace UI.
OpenAPI tells the model what endpoints exist. MCP tells it what to do. The cg_* surface is curated for the things that actually happen during a review cycle: inspect the repository's profile, see what base packs already cover, draft custom rules in one transaction, prune false positives. Tools come with descriptions, schemas, and a single auth path — the model picks the right one; you approve the call.
cg_get_rule_schema exposes enums + limits up frontmcp scope to revokemcp_audit_logs
Every tool is namespaced cg_*. Read tools share a 60/min rate budget per token;
write tools share 12/min. Read first, write once.
Every repo the token can access — uuid, full_name, stack_key, has_active_rulebook. Always the first call.
LLM-generated repo profile: architecture, conventions, layers, hot files. Grounds drafted rules in your style.
All rules in the active rulebook — uuid, source, severity, enabled. Optional source filter. Required before toggle / update / delete.
Shipped universal + stack-specific packs already applied. Stops the model from restating what's already covered.
Enums, length limits and validation rules. Draft rules that always pass server-side checks.
Atomic — up to 50 rules per call. Marked creation_origin=mcp so the UI shows the badge. Any reject rolls the whole batch back.
Sparse patch on a single rule. Works on custom + derived. Routes through the same services as the UI — invariants stay identical.
Permanent delete. custom + derived only — base is rejected. Prune what the derived rulebook over-produced.
Flip a derived rule on/off without deleting it. Useful for quick A/B-style tuning on a noisy detector.
Three pieces, all hosted. Same auth, same validation, same audit trail as if you'd clicked through the workspace UI.
Reads mcp.json + Bearer PAT, calls JSON-RPC over HTTP. You approve every write.
Sanctum auth → mcp scope guard → audit log row → tool handler. Same Laravel stack as the workspace.
Same services the UI uses. Bulk-writes are one DB transaction. Audit row links back to the token.
Generate a PAT in /settings/api-tokens (scope mcp, 90-day expiry default).
Drop the snippet into your IDE's MCP config. Restart. The cg_* tools appear in the tool picker.
{
"mcpServers": {
"codeguards": {
"type": "http",
"url": "https://codeguards.io/api/mcp",
"headers": {
"Authorization": "Bearer cg_pat_xxxxxxxxxxxxxxxxxxxxxx"
}
}
}
}
{
"mcpServers": {
"codeguards": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-fetch",
"https://codeguards.io/api/mcp",
"--header",
"Authorization: Bearer cg_pat_xxxxxxxxxxxxxxxxxxxxxx"
]
}
}
}
curl -X POST https://codeguards.io/api/mcp \ -H 'Authorization: Bearer cg_pat_xxxxxxxxxxxxxxxxxxxxxx' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json, text/event-stream' \ -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
Drop these into Cursor / Claude after the MCP server is connected:
The MCP server is just another Laravel route group — /api/mcp — guarded by
auth:sanctum, then mcp.audit, then mcp.scope:mcp.
A PAT without the mcp ability is rejected even on read tools, and the rejection itself
is recorded in mcp_audit_logs. We want the audit trail to show
"someone tried to use a wrong-scope PAT against /api/mcp", not silence.
Hosted. The MCP server lives at https://codeguards.io/api/mcp. You configure your IDE's mcp.json, paste the PAT, and you're done — no Node process, no Docker container on your side.
Anything that speaks remote HTTP MCP: Cursor, Claude Desktop (via server-fetch), ChatGPT Desktop, Windsurf, Cline, Continue, Zed, Goose, OpenCode, Codex CLI, Aider — and custom integrations using the @modelcontextprotocol client libraries.
Writes go through the same Laravel services as the workspace UI, so invariants (enum values, severity ranges, dedupe constraints) are identical. cg_create_custom_rules_bulk is a single DB transaction — any rejected rule rolls the whole batch back. base rules are never mutable from MCP.
Laravel Sanctum personal access tokens. Each token has a name, an expiry, and an explicit ability set. The MCP scope guard requires mcp — your existing CI keys (different scope) cannot accidentally hit MCP endpoints.
Read tools share 60 calls / min per token; write tools share 12 / min. Generous for an interactive IDE session, low enough that a runaway agent can't burn through the database. Bulk-create takes one slot, not fifty.
No. MCP access is included in every CodeGuards plan — same workspace, same billing. See pricing.
Verdict-reading tools are on the roadmap. The current surface is rule-authoring + repo-profile-inspection because that's where AI assistance compounds the most. For now use the webhook integration for verdicts in CI.