codeant-cli 0.5.4 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -10
- package/cli-api.md +130 -0
- package/findings.md +163 -0
- package/mcp.md +207 -0
- package/package.json +18 -8
- package/scans.md +263 -0
- package/src/api/tenant.js +54 -0
- package/src/commands/api/index.js +33 -0
- package/src/commands/api/request.js +109 -0
- package/src/commands/findings/index.js +197 -0
- package/src/commands/hotlist/index.js +58 -0
- package/src/commands/logout.js +14 -5
- package/src/findings/antipatterns.js +31 -0
- package/src/findings/cloud.js +119 -0
- package/src/findings/pentest.js +42 -0
- package/src/hotlist/client.js +89 -0
- package/src/index.js +12 -0
- package/src/mcp/server.js +252 -5
- package/src/utils/fetchApi.js +83 -9
- package/src/utils/logout.js +31 -0
package/README.md
CHANGED
|
@@ -8,14 +8,7 @@ A command-line tool for code review and security scanning.
|
|
|
8
8
|
npm install -g codeant-cli
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
git clone https://github.com/codeantai/codeant-cli.git
|
|
15
|
-
cd codeant-cli
|
|
16
|
-
npm install
|
|
17
|
-
npm link
|
|
18
|
-
```
|
|
11
|
+
For installation, authentication, and self-hosted setup, see the [CodeAnt CLI setup guide](https://docs.codeant.ai/cli/setup).
|
|
19
12
|
|
|
20
13
|
## Quick Start
|
|
21
14
|
|
|
@@ -131,6 +124,40 @@ Show the current API base URL and its source.
|
|
|
131
124
|
codeant get-base-url
|
|
132
125
|
```
|
|
133
126
|
|
|
127
|
+
#### `hotlist`
|
|
128
|
+
|
|
129
|
+
Query the same organization-wide prioritized findings shown in the CodeAnt Hotlist, or fetch one finding by its stable ID.
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
codeant hotlist list --org CodeAnt-AI --service github --severity critical,high
|
|
133
|
+
codeant hotlist get 0123456789abcdef0123456789abcdef --org CodeAnt-AI --service github
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
#### `findings`
|
|
137
|
+
|
|
138
|
+
Access repository, organization Hotlist, cloud-security, anti-pattern, and pentest findings through one command group.
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
codeant findings repos --org CodeAnt-AI
|
|
142
|
+
codeant findings repo --repo CodeAnt-AI/example --types sast,sca,iac,anti_patterns
|
|
143
|
+
codeant findings list --severity critical,high
|
|
144
|
+
codeant findings cloud history --provider all
|
|
145
|
+
codeant findings pentest history
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
See the [CodeAnt findings documentation](https://docs.codeant.ai/cli/findings) for the complete command and agent manual.
|
|
149
|
+
|
|
150
|
+
#### `api request`
|
|
151
|
+
|
|
152
|
+
Call any CodeAnt application API using the saved bearer token. Only relative paths on the configured CodeAnt API host are accepted.
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
codeant api request GET /some/read/endpoint --org CodeAnt-AI --service github --query '{"page":1}'
|
|
156
|
+
codeant api request POST /some/app/endpoint --org CodeAnt-AI --service github --body '{"repo":"CodeAnt-AI/example"}'
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
See the [CodeAnt findings documentation](https://docs.codeant.ai/cli/findings) for all finding commands, authentication, self-hosted provider, and agent/MCP details.
|
|
160
|
+
|
|
134
161
|
### Global Options
|
|
135
162
|
|
|
136
163
|
```bash
|
|
@@ -240,11 +267,11 @@ node src/index.js secrets --all
|
|
|
240
267
|
|
|
241
268
|
This package also ships an MCP (Model Context Protocol) server that exposes CodeAnt's scan, review, and PR data as tools to Claude and other MCP clients. The same source tree is packaged as a Desktop Extension (`.mcpb`) for one-click install in Claude Desktop.
|
|
242
269
|
|
|
243
|
-
See [
|
|
270
|
+
See the [CodeAnt MCP server documentation](https://docs.codeant.ai/cli/mcp-server) for the tools listing and installation paths. See the [CodeAnt findings documentation](https://docs.codeant.ai/cli/findings) for Hotlist and authenticated API usage.
|
|
244
271
|
|
|
245
272
|
## Privacy Policy
|
|
246
273
|
|
|
247
|
-
Full policy: **https://codeant.ai/privacy**
|
|
274
|
+
Full policy: **https://www.codeant.ai/privacy-policy**
|
|
248
275
|
|
|
249
276
|
Summary of what this CLI / MCP server sends and stores:
|
|
250
277
|
|
package/cli-api.md
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# CodeAnt application APIs from the CLI
|
|
2
|
+
|
|
3
|
+
The CLI can call the authenticated application endpoints used by the CodeAnt web app without adding a second backend adapter for each endpoint. Sign in once, select one exact organization/provider connection, then use a first-class command or the generic API request command.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
codeant login
|
|
7
|
+
codeant scans orgs
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
`CODEANT_API_TOKEN` and `CODEANT_API_URL` can be used instead of the saved login for agents, CI, and self-hosted installations.
|
|
11
|
+
|
|
12
|
+
The browser login binds the CLI key to the signed-in user and the exact connections visible to that user. For application API calls, the backend resolves the selected connection and injects the same verified user identity used by the app. The existing organization-membership, RBAC, repository-access, audit, and request guards still run. CLI keys expire after 90 days by default (`CLI_API_KEY_TTL_DAYS` controls the backend deployment value), and `codeant logout` revokes the key server-side before deleting it locally.
|
|
13
|
+
|
|
14
|
+
Keys created before this authenticated application-API bridge do not contain the verified user identity. Run `codeant logout` followed by `codeant login` once after upgrading.
|
|
15
|
+
|
|
16
|
+
## Hotlist findings
|
|
17
|
+
|
|
18
|
+
Hotlist commands use the same organization-wide snapshot, ranking, filters, stable finding IDs, and cursor pagination as the app.
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# First page; org/service are auto-selected when unambiguous
|
|
22
|
+
codeant hotlist list
|
|
23
|
+
|
|
24
|
+
# Highest-priority production findings for one authenticated connection
|
|
25
|
+
codeant hotlist list \
|
|
26
|
+
--org CodeAnt-AI \
|
|
27
|
+
--service github \
|
|
28
|
+
--severity critical,high \
|
|
29
|
+
--validation exploit_confirmed \
|
|
30
|
+
--limit 50
|
|
31
|
+
|
|
32
|
+
# Fetch every SCA finding across the organization
|
|
33
|
+
codeant hotlist list --org CodeAnt-AI --service github --type SCA --all
|
|
34
|
+
|
|
35
|
+
# Continue a page using next_cursor from the previous response
|
|
36
|
+
codeant hotlist list --org CodeAnt-AI --service github --cursor '<cursor>'
|
|
37
|
+
|
|
38
|
+
# Fetch exactly one finding using the stable ID shown in the app
|
|
39
|
+
codeant hotlist get 0123456789abcdef0123456789abcdef \
|
|
40
|
+
--org CodeAnt-AI \
|
|
41
|
+
--service github
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Supported `hotlist list` filters:
|
|
45
|
+
|
|
46
|
+
| Option | Values |
|
|
47
|
+
|---|---|
|
|
48
|
+
| `--search` | title, repository/account, path, package, CVE, or check ID |
|
|
49
|
+
| `--type` | `AI Exploitation`, `SCA`, `SAST`, `Secrets`, `IaC`, `Infrastructure` |
|
|
50
|
+
| `--location` | repository full names or cloud accounts |
|
|
51
|
+
| `--severity` | `critical`, `high`, `medium`, `low`, `unknown` |
|
|
52
|
+
| `--ticket-status` | `created`, `not_created` |
|
|
53
|
+
| `--compliance` | framework keys such as `soc2` |
|
|
54
|
+
| `--validation` | `exploit_confirmed` |
|
|
55
|
+
|
|
56
|
+
Comma-separated values are accepted. The default page size is 30 and the maximum is 100. `--all` follows every cursor. If the first organization snapshot is still being built, the command waits up to 60 seconds; change that with `--max-wait <seconds>`.
|
|
57
|
+
|
|
58
|
+
For self-hosted GitHub, GitLab, Bitbucket, or Azure DevOps, the CLI normally discovers the provider base URL from the authenticated connection. Use `--provider-base-url` only to override it.
|
|
59
|
+
|
|
60
|
+
## All findings
|
|
61
|
+
|
|
62
|
+
Use `codeant findings` for first-class access to repository findings, organization Hotlist and anti-pattern findings, AWS/Azure/GCP cloud-security findings, and pentest engagements. The full command matrix, provider-specific fields, examples, and agent workflow are documented in the [CodeAnt findings documentation](https://docs.codeant.ai/cli/findings).
|
|
63
|
+
|
|
64
|
+
## Any app API
|
|
65
|
+
|
|
66
|
+
Use the generic request command when a first-class command does not exist yet:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
codeant api request GET /some/read/endpoint \
|
|
70
|
+
--org CodeAnt-AI --service github \
|
|
71
|
+
--query '{"page":1}'
|
|
72
|
+
|
|
73
|
+
codeant api request POST /some/app/endpoint \
|
|
74
|
+
--org CodeAnt-AI --service github \
|
|
75
|
+
--body '{"repo":"CodeAnt-AI/example"}'
|
|
76
|
+
|
|
77
|
+
codeant api request PATCH /some/app/endpoint \
|
|
78
|
+
--org CodeAnt-AI --service github \
|
|
79
|
+
--body-file ./request.json \
|
|
80
|
+
--header 'If-Match: revision-123'
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
The output is JSON:
|
|
84
|
+
|
|
85
|
+
```json
|
|
86
|
+
{
|
|
87
|
+
"ok": true,
|
|
88
|
+
"status": 200,
|
|
89
|
+
"tenant": {
|
|
90
|
+
"org": "CodeAnt-AI",
|
|
91
|
+
"service": "github"
|
|
92
|
+
},
|
|
93
|
+
"data": {}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Security properties:
|
|
98
|
+
|
|
99
|
+
- The path must start with `/` and is always resolved against the configured CodeAnt API host. Absolute and protocol-relative URLs are rejected, so the bearer token cannot be forwarded to another host.
|
|
100
|
+
- Authentication is supplied from `CODEANT_API_TOKEN` or the key saved by `codeant login`.
|
|
101
|
+
- `--org`, `--service`, and the discovered provider base URL must match one saved login connection exactly. They are auto-selected only when unambiguous. Use `--provider-base-url` for a self-hosted override.
|
|
102
|
+
- POST/PUT/PATCH/DELETE bodies must be JSON objects. The CLI adds the selected tenant fields before sending the request; conflicting tenant values are rejected by the backend.
|
|
103
|
+
- `Authorization`, `Cookie`, `Host`, `Content-Length`, and the `X-CodeAnt-CLI-*` tenant headers cannot be overridden.
|
|
104
|
+
- The backend remains authoritative for account access, organization membership, RBAC, and endpoint authorization.
|
|
105
|
+
|
|
106
|
+
The generic command can call write endpoints. Review the method, path, and body before running it.
|
|
107
|
+
|
|
108
|
+
## Agent and MCP access
|
|
109
|
+
|
|
110
|
+
Run `codeant mcp` or install the CodeAnt MCP bundle. Agents receive dedicated read-only tools:
|
|
111
|
+
|
|
112
|
+
- `codeant_hotlist_list` — filter and page through organization-wide findings.
|
|
113
|
+
- `codeant_hotlist_get` — fetch one finding by stable ID.
|
|
114
|
+
- `codeant_api_get` — authenticated GET access for newly-added read APIs.
|
|
115
|
+
- `codeant_findings_antipatterns` — selected or all-repository anti-pattern findings.
|
|
116
|
+
- `codeant_cloud_scan_history`, `codeant_cloud_findings_list`, `codeant_cloud_finding_get` — cloud scan discovery, findings, and detail.
|
|
117
|
+
- `codeant_pentest_history`, `codeant_pentest_issues`, `codeant_pentest_report` — pentest engagement discovery and results.
|
|
118
|
+
|
|
119
|
+
Set `CODEANT_READ_ONLY=0` to opt in to write tools, including `codeant_api_request` for POST/PUT/PATCH/DELETE. Read-only mode is the default. The MCP server never opens a browser during startup; the agent must explicitly call `codeant_login` when no token is configured.
|
|
120
|
+
|
|
121
|
+
## Troubleshooting
|
|
122
|
+
|
|
123
|
+
| Error | Resolution |
|
|
124
|
+
|---|---|
|
|
125
|
+
| No matching organization | Run `codeant scans orgs`, then pass its exact `organizationName` and `service`. |
|
|
126
|
+
| Multiple organizations match | Pass both `--org` and `--service`. |
|
|
127
|
+
| Access denied (403) | Run `codeant logout`, then `codeant login`, or replace `CODEANT_API_TOKEN`. |
|
|
128
|
+
| Invalid token after upgrading | Older keys lack verified CLI identity metadata. Run `codeant logout`, then `codeant login`. |
|
|
129
|
+
| Hotlist is still building | Retry, or increase `--max-wait`. |
|
|
130
|
+
| Finding not found | Refresh the app/Hotlist and copy the current stable finding ID and tenant context. |
|
package/findings.md
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# CodeAnt findings CLI
|
|
2
|
+
|
|
3
|
+
`codeant findings` is the unified, read-only entry point for findings visible in the CodeAnt app. It reuses the same authenticated backend endpoints and authorization checks as the UI.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
codeant login
|
|
7
|
+
codeant scans orgs
|
|
8
|
+
codeant findings --help
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
When one login has multiple connections, pass the exact `--org` and `--service` values returned by `codeant scans orgs`. A self-hosted provider base URL is discovered from the selected connection; use `--provider-base-url` only as an explicit override.
|
|
12
|
+
|
|
13
|
+
## Coverage
|
|
14
|
+
|
|
15
|
+
| App data | CLI command | Scope |
|
|
16
|
+
|---|---|---|
|
|
17
|
+
| Repository list | `codeant findings repos` | organization |
|
|
18
|
+
| SAST, SCA, IaC, Secrets, SBOM | `codeant findings repo` | repository + scan/branch |
|
|
19
|
+
| Anti-patterns, dead code, docstrings, complex functions | `codeant findings repo` | repository + scan/branch |
|
|
20
|
+
| Prioritized SAST/SCA/IaC/Secrets/Infrastructure/AI Exploitation | `codeant findings list/get` | organization Hotlist |
|
|
21
|
+
| Anti-patterns across repositories | `codeant findings antipatterns` | selected repos or organization |
|
|
22
|
+
| AWS/Azure/GCP CSPM, VM, and container findings | `codeant findings cloud history/list/get` | organization + cloud resource scope |
|
|
23
|
+
| Pentest engagements, issues, reports | `codeant findings pentest history/issues/report` | organization + engagement |
|
|
24
|
+
|
|
25
|
+
The existing `codeant scans repos`, `codeant scans results`, and `codeant hotlist list/get` commands remain supported. The unified commands are aliases or thin authenticated clients, so existing scripts do not need to migrate.
|
|
26
|
+
|
|
27
|
+
## Repository list and repo-level findings
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# List connected repositories
|
|
31
|
+
codeant findings repos --org CodeAnt-AI
|
|
32
|
+
|
|
33
|
+
# Latest scan, all supported finding types
|
|
34
|
+
codeant findings repo --repo CodeAnt-AI/example --types all
|
|
35
|
+
|
|
36
|
+
# Selected categories and severities
|
|
37
|
+
codeant findings repo \
|
|
38
|
+
--repo CodeAnt-AI/example \
|
|
39
|
+
--branch main \
|
|
40
|
+
--types sast,sca,iac,anti_patterns \
|
|
41
|
+
--severity critical,high
|
|
42
|
+
|
|
43
|
+
# A specific scan, formatted for another tool
|
|
44
|
+
codeant findings repo \
|
|
45
|
+
--repo CodeAnt-AI/example \
|
|
46
|
+
--scan 0123456789abcdef \
|
|
47
|
+
--types sast,secrets \
|
|
48
|
+
--format sarif \
|
|
49
|
+
--output codeant.sarif
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Supported repo types are `sast`, `sca`, `secrets`, `iac`, `dead_code`, `sbom`, `anti_patterns`, `docstring`, and `complex_functions`. Use `--types all` for all of them. Formats are `json`, `sarif`, `csv`, `md`, and `table`; JSON is the default.
|
|
53
|
+
|
|
54
|
+
Use `--filter-dismissed` to exclude dismissed findings and `--no-false-positives` to exclude false positives. `--path`, `--check`, `--limit`, and `--offset` support agent-friendly filtering and pagination.
|
|
55
|
+
|
|
56
|
+
## Organization Hotlist findings
|
|
57
|
+
|
|
58
|
+
`findings list/get` exposes the same stable IDs, prioritization, filters, and cursor pagination as the app Hotlist.
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
codeant findings list --org CodeAnt-AI --service github --severity critical,high
|
|
62
|
+
codeant findings list --type SCA,IaC --location CodeAnt-AI/example --all
|
|
63
|
+
codeant findings get 0123456789abcdef0123456789abcdef --org CodeAnt-AI --service github
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Hotlist types are `SAST`, `SCA`, `Secrets`, `IaC`, `Infrastructure`, and `AI Exploitation`. The last two cover prioritized cloud-security and pentest findings. Use the dedicated cloud and pentest commands below when complete scan/engagement data is required.
|
|
67
|
+
|
|
68
|
+
## Organization anti-patterns
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
# Every repository in the selected organization
|
|
72
|
+
codeant findings antipatterns --org CodeAnt-AI --service github
|
|
73
|
+
|
|
74
|
+
# Only selected repositories
|
|
75
|
+
codeant findings antipatterns \
|
|
76
|
+
--org CodeAnt-AI --service github \
|
|
77
|
+
--repos CodeAnt-AI/api,CodeAnt-AI/web
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
When `--repos` is omitted, the CLI first lists the organization's repositories and sends all of them to the same aggregate anti-pattern endpoint used by the Quality Report UI.
|
|
81
|
+
|
|
82
|
+
## Cloud security findings
|
|
83
|
+
|
|
84
|
+
Cloud findings are organization/account scoped rather than repository scoped.
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
# History across AWS, Azure, and GCP
|
|
88
|
+
codeant findings cloud history --org CodeAnt-AI --service github
|
|
89
|
+
|
|
90
|
+
# Latest scan per provider
|
|
91
|
+
codeant findings cloud history --provider all --latest
|
|
92
|
+
|
|
93
|
+
# VM and container vulnerability scan histories
|
|
94
|
+
codeant findings cloud history --provider all --kind vm
|
|
95
|
+
codeant findings cloud history --provider all --kind container
|
|
96
|
+
|
|
97
|
+
# AWS findings and one full detail record
|
|
98
|
+
codeant findings cloud list --provider aws --scan-id <scan-id> --account-id <account-id>
|
|
99
|
+
codeant findings cloud get --provider aws --scan-id <scan-id> --uid <finding-uid> --cloud-service iam
|
|
100
|
+
|
|
101
|
+
# VM and container vulnerabilities use the same list/detail flow
|
|
102
|
+
codeant findings cloud list --provider aws --kind vm --scan-id <scan-id>
|
|
103
|
+
codeant findings cloud get --provider gcp --kind container --scan-id <scan-id> --uid <finding-uid>
|
|
104
|
+
|
|
105
|
+
# Azure requires the tenant ID
|
|
106
|
+
codeant findings cloud list \
|
|
107
|
+
--provider azure --tenant-id <tenant-id> --scan-id <scan-id> \
|
|
108
|
+
--severity high --subscription-id <subscription-id>
|
|
109
|
+
|
|
110
|
+
# GCP requires the project ID
|
|
111
|
+
codeant findings cloud list \
|
|
112
|
+
--provider gcp --project-id <project-id> --scan-id <scan-id> \
|
|
113
|
+
--framework cis
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
`--kind` defaults to `cspm`; use `vm` or `container` for the other Cloud Security result views. CSPM `cloud list` supports `--cloud-service`, `--severity`, `--status`, `--framework`, and `--min-days-unused`. AWS additionally supports `--exploit-attempted-only`; Azure additionally supports `--subscription-id`. CSPM responses include `findings` and `dismissed_findings`; VM/container responses preserve their UI result payload unchanged.
|
|
117
|
+
|
|
118
|
+
## Pentest findings
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
# Discover engagement IDs
|
|
122
|
+
codeant findings pentest history --org CodeAnt-AI --service github
|
|
123
|
+
|
|
124
|
+
# All available open issues for an engagement
|
|
125
|
+
codeant findings pentest issues --report-id <report-id>
|
|
126
|
+
|
|
127
|
+
# Full customer report
|
|
128
|
+
codeant findings pentest report --report-id <report-id>
|
|
129
|
+
|
|
130
|
+
# Test-environment variant
|
|
131
|
+
codeant findings pentest issues --report-id <report-id> --variant test
|
|
132
|
+
codeant findings pentest report --report-id <report-id> --variant test
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
`--variant prod` is the default. Pentest entitlements and critical/high redaction are enforced by the backend exactly as they are in the UI; the CLI does not bypass locked content.
|
|
136
|
+
|
|
137
|
+
## Agent/MCP tools
|
|
138
|
+
|
|
139
|
+
Agents can use these read-only MCP tools:
|
|
140
|
+
|
|
141
|
+
| Tool | Purpose |
|
|
142
|
+
|---|---|
|
|
143
|
+
| `codeant_scans_repos` | List repositories. |
|
|
144
|
+
| `codeant_scans_results` | Fetch repo-level SAST/SCA/IaC/Secrets/quality findings. |
|
|
145
|
+
| `codeant_hotlist_list`, `codeant_hotlist_get` | Query prioritized org-wide findings and stable IDs. |
|
|
146
|
+
| `codeant_findings_antipatterns` | Fetch selected or all-repo anti-pattern findings. |
|
|
147
|
+
| `codeant_cloud_scan_history` | Discover AWS/Azure/GCP scan IDs and scopes. |
|
|
148
|
+
| `codeant_cloud_findings_list`, `codeant_cloud_finding_get` | List cloud findings and retrieve full detail. |
|
|
149
|
+
| `codeant_pentest_history`, `codeant_pentest_issues`, `codeant_pentest_report` | Discover and inspect pentest engagements. |
|
|
150
|
+
|
|
151
|
+
All these tools are available in the default read-only MCP mode. A typical agent flow is discovery (`orgs` -> `repos`, cloud history, or pentest history), list/filter findings, then retrieve one detailed finding or report.
|
|
152
|
+
|
|
153
|
+
## Errors and access
|
|
154
|
+
|
|
155
|
+
| Error | Resolution |
|
|
156
|
+
|---|---|
|
|
157
|
+
| No or multiple matching organizations | Run `codeant scans orgs`; pass exact `--org` and `--service`. |
|
|
158
|
+
| Access denied (403) | Run `codeant logout`, then `codeant login`. Older CLI keys must be refreshed once. |
|
|
159
|
+
| Missing Azure/GCP scope | Pass `--tenant-id` for Azure or `--project-id` for GCP. |
|
|
160
|
+
| Report or scan not found | Use the corresponding history command and verify the selected tenant/provider. |
|
|
161
|
+
| Redacted pentest fields | Unlock the engagement in the app; CLI access follows the same entitlement. |
|
|
162
|
+
|
|
163
|
+
For current authentication, finding coverage, and agent guidance, see the [CodeAnt findings documentation](https://docs.codeant.ai/cli/findings).
|
package/mcp.md
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
# CodeAnt MCP Server
|
|
2
|
+
|
|
3
|
+
The CodeAnt CLI ships an MCP (Model Context Protocol) server that exposes CodeAnt's scan/review/PR data as tools Claude (and any other MCP client) can call directly.
|
|
4
|
+
|
|
5
|
+
- **Entrypoint:** `codeant mcp` — stdio transport, single subcommand registered in [src/index.js](src/index.js).
|
|
6
|
+
- **Server:** [src/mcp/server.js](src/mcp/server.js) — uses `@modelcontextprotocol/sdk` and registers tools via `server.registerTool(...)`.
|
|
7
|
+
- **Bundle:** the [mcpb/](mcpb/) directory + [scripts/build-mcpb.mjs](scripts/build-mcpb.mjs) produce a `.mcpb` Desktop Extension bundle (`dist/codeant.mcpb`).
|
|
8
|
+
|
|
9
|
+
## Tools registered
|
|
10
|
+
|
|
11
|
+
| Name | Read/Write | What it does |
|
|
12
|
+
|------|------------|--------------|
|
|
13
|
+
| `codeant_scans_orgs` | read | List authenticated CodeAnt orgs. |
|
|
14
|
+
| `codeant_scans_repos` | read | List repos in an org. |
|
|
15
|
+
| `codeant_scans_history` | read | Recent scan runs for a repo. |
|
|
16
|
+
| `codeant_scans_get` | read | Severity/category summary for one scan. |
|
|
17
|
+
| `codeant_scans_results` | read | Full findings (SAST, SCA, secrets, IaC, …) for one scan. |
|
|
18
|
+
| `codeant_scans_dismissed` | read | Dismissed alerts for a repo. |
|
|
19
|
+
| `codeant_hotlist_list` | read | Prioritized organization-wide Hotlist findings with stable IDs. |
|
|
20
|
+
| `codeant_hotlist_get` | read | One complete Hotlist finding by stable ID. |
|
|
21
|
+
| `codeant_findings_antipatterns` | read | Anti-pattern findings across selected or all organization repos. |
|
|
22
|
+
| `codeant_cloud_scan_history` | read | AWS/Azure/GCP CSPM, VM, or container scan history. |
|
|
23
|
+
| `codeant_cloud_findings_list` | read | Findings for one CSPM, VM, or container scan. |
|
|
24
|
+
| `codeant_cloud_finding_get` | read | Full detail for one cloud finding UID. |
|
|
25
|
+
| `codeant_pentest_history` | read | Pentest engagement history. |
|
|
26
|
+
| `codeant_pentest_issues` | read | All available issues for a pentest engagement. |
|
|
27
|
+
| `codeant_pentest_report` | read | Full pentest customer report. |
|
|
28
|
+
| `codeant_api_get` | read | Authenticated GET request to any relative CodeAnt app API path, with exact org/provider context. |
|
|
29
|
+
| `codeant_pr_list` | read | List PRs/MRs across GitHub, GitLab, Bitbucket, Azure DevOps. |
|
|
30
|
+
| `codeant_pr_get` | read | Detail for a PR/MR. |
|
|
31
|
+
| `codeant_pr_comments` | read | Comments on a PR, filtered. |
|
|
32
|
+
| `codeant_comments_search` | read | Free-text search across CodeAnt review comments. |
|
|
33
|
+
| `codeant_review_local` | read | Run a CodeAnt review on local working-copy changes. |
|
|
34
|
+
| `codeant_scans_start` | **write** | Trigger a new scan. Gated. |
|
|
35
|
+
| `codeant_pr_resolve` | **write** | Resolve a PR conversation thread. Gated. |
|
|
36
|
+
| `codeant_api_request` | **write** | Authenticated POST/PUT/PATCH/DELETE request to a relative CodeAnt app API path, with exact org/provider context. Gated. |
|
|
37
|
+
|
|
38
|
+
Write tools are only registered when `CODEANT_READ_ONLY=0`. Default = read-only.
|
|
39
|
+
|
|
40
|
+
For complete finding coverage, examples, tenant/provider selection, and response details, see the [CodeAnt findings documentation](https://docs.codeant.ai/cli/findings).
|
|
41
|
+
|
|
42
|
+
Every tool carries MCP annotations (`title`, `readOnlyHint`, `destructiveHint`, `idempotentHint`, `openWorldHint`) so the client can decide whether to auto-approve calls.
|
|
43
|
+
|
|
44
|
+
## Configuration (env vars)
|
|
45
|
+
|
|
46
|
+
| Var | Purpose | Default |
|
|
47
|
+
|-----|---------|---------|
|
|
48
|
+
| `CODEANT_API_TOKEN` | API token (CodeAnt account → settings → API). Required. | — |
|
|
49
|
+
| `CODEANT_API_URL` | API base URL. Override for self-hosted. | `https://api.codeant.ai` |
|
|
50
|
+
| `CODEANT_READ_ONLY` | `1` to hide write tools, `0` to expose them. | `1` |
|
|
51
|
+
|
|
52
|
+
The CLI also reads these from `~/.codeant/config.json` when not set in env. For MCP usage prefer env — it keeps per-client config explicit.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Install paths
|
|
57
|
+
|
|
58
|
+
### A — Claude Code CLI (terminal / VS Code extension)
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
claude mcp add codeant -s user -e CODEANT_READ_ONLY=1 -- codeant mcp
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
`-s user` puts it in your user-scope config so it works in every project. Use `-s project` to scope it to one repo (writes a `.mcp.json` at the repo root).
|
|
65
|
+
|
|
66
|
+
For a single project, you can instead drop this `.mcp.json` next to the project root:
|
|
67
|
+
|
|
68
|
+
```json
|
|
69
|
+
{
|
|
70
|
+
"mcpServers": {
|
|
71
|
+
"codeant": {
|
|
72
|
+
"command": "codeant",
|
|
73
|
+
"args": ["mcp"],
|
|
74
|
+
"env": { "CODEANT_READ_ONLY": "1" }
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Verify with `/mcp` inside a Claude Code session.
|
|
81
|
+
|
|
82
|
+
### B — Claude Desktop (manual config)
|
|
83
|
+
|
|
84
|
+
Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or the equivalent on Windows and add a `codeant` block:
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"mcpServers": {
|
|
89
|
+
"codeant": {
|
|
90
|
+
"command": "codeant",
|
|
91
|
+
"args": ["mcp"],
|
|
92
|
+
"env": { "CODEANT_READ_ONLY": "1" }
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Requires the `codeant` CLI to be on the desktop app's PATH. If you hit "command not found" in `~/Library/Logs/Claude/mcp-server-codeant.log`, swap `"command": "codeant"` for `"command": "node"` with `"args": ["<absolute-path-to>/codeant-cli/src/index.js", "mcp"]`.
|
|
99
|
+
|
|
100
|
+
Quit Claude Desktop (Cmd-Q — not just close the window) and relaunch. The server appears under **Settings → Connectors**.
|
|
101
|
+
|
|
102
|
+
### C — Claude Desktop (MCPB double-click)
|
|
103
|
+
|
|
104
|
+
The MCPB bundle is the only path that does not assume the user has the CodeAnt CLI installed — it ships everything in the bundle. This is what we submit to the Anthropic directory.
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
npm run mcpb:build
|
|
108
|
+
open -a Claude dist/codeant.mcpb
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Claude pops an install dialog asking for the `user_config` fields:
|
|
112
|
+
- **CodeAnt API token** (sensitive, required)
|
|
113
|
+
- **API base URL** (defaults to `https://api.codeant.ai`)
|
|
114
|
+
- **Read-only mode** (defaults to on)
|
|
115
|
+
|
|
116
|
+
After install, manage it in **Settings → Connectors**.
|
|
117
|
+
|
|
118
|
+
If you also have a manual `claude_desktop_config.json` entry from path B, you'll see `codeant` listed twice — remove one to avoid duplicate tool listings.
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## Packaging the MCPB bundle
|
|
123
|
+
|
|
124
|
+
### What gets bundled
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
codeant.mcpb (zip)
|
|
128
|
+
├── manifest.json # from mcpb/manifest.json, version pinned to package.json
|
|
129
|
+
├── icon.png # 256×256, from mcpb/icon.png
|
|
130
|
+
├── server/
|
|
131
|
+
│ └── index.js # thin entry wrapper, calls startMcpServer()
|
|
132
|
+
├── src/ # the entire CLI source tree
|
|
133
|
+
├── node_modules/ # production deps only (npm install --omit=dev)
|
|
134
|
+
└── package.json # trimmed: only name/version/type/dependencies
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
The bundle is self-contained — Claude Desktop ships its own Node runtime, so no global install is required on the user's machine.
|
|
138
|
+
|
|
139
|
+
### Build it
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
npm run mcpb:build
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Under the hood this runs [scripts/build-mcpb.mjs](scripts/build-mcpb.mjs):
|
|
146
|
+
|
|
147
|
+
1. Clean `dist/mcpb-stage/` and `dist/codeant.mcpb`.
|
|
148
|
+
2. Copy `src/` and `mcpb/server/` into the staging dir.
|
|
149
|
+
3. Write a trimmed `package.json` containing only production deps.
|
|
150
|
+
4. Run `npm install --omit=dev` inside the staging dir.
|
|
151
|
+
5. Copy `mcpb/manifest.json` (with `version` overridden from the root `package.json`) and `mcpb/icon.png`.
|
|
152
|
+
6. Zip the staging dir as `dist/codeant.mcpb`.
|
|
153
|
+
|
|
154
|
+
Result is typically ~11 MB. Verify the bundled server speaks MCP:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
cd dist/mcpb-stage
|
|
158
|
+
(printf '%s\n' \
|
|
159
|
+
'{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"smoke","version":"0"}}}' \
|
|
160
|
+
'{"jsonrpc":"2.0","method":"notifications/initialized"}' \
|
|
161
|
+
'{"jsonrpc":"2.0","id":2,"method":"tools/list"}'; sleep 1) | node server/index.js
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Expect 23 tools in the `tools/list` response (or 26 if `CODEANT_READ_ONLY=0`).
|
|
165
|
+
|
|
166
|
+
### Bumping the version
|
|
167
|
+
|
|
168
|
+
Edit `version` in [package.json](package.json). The build script pins the manifest's `version` field from there, so you do not need to touch [mcpb/manifest.json](mcpb/manifest.json) for normal bumps.
|
|
169
|
+
|
|
170
|
+
### Replacing the icon
|
|
171
|
+
|
|
172
|
+
`mcpb/icon.png` should be a 256×256 PNG. The current one was rasterized from `../vscode-build/assets/Logo.svg` via `qlmanage`. To regenerate from a new SVG:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
qlmanage -t -s 256 -o /tmp /path/to/Logo.svg
|
|
176
|
+
cp /tmp/Logo.svg.png mcpb/icon.png
|
|
177
|
+
npm run mcpb:build
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## Submitting to the Anthropic directory
|
|
183
|
+
|
|
184
|
+
CodeAnt's MCP server uses stdio + a packaged bundle, so the submission route is **Desktop Extensions (MCPB)**, not the remote-connector form.
|
|
185
|
+
|
|
186
|
+
- **Submission URL:** https://claude.com/docs/connectors/building/submission
|
|
187
|
+
- **Bundle:** upload `dist/codeant.mcpb`
|
|
188
|
+
- **Required metadata:** already in [mcpb/manifest.json](mcpb/manifest.json) — display name, description, author, homepage, documentation, repository, license, keywords, `privacy_policies`, `tools` static listing, `user_config` schema.
|
|
189
|
+
- **Privacy policy.** Linked from both [README.md](README.md#privacy-policy) and the manifest's `privacy_policies` field (`https://www.codeant.ai/privacy-policy`).
|
|
190
|
+
|
|
191
|
+
Reviewer notes worth preparing:
|
|
192
|
+
|
|
193
|
+
- **Auth model.** CodeAnt uses a user-scoped API token entered into `user_config.api_token`. The token never leaves the user's machine — the bundle talks to `api.codeant.ai` (or the user's self-hosted URL) directly. No third-party OAuth flow needed.
|
|
194
|
+
- **Sandbox creds.** Email support@codeant.ai for a reviewer sandbox token; paste it into the submission form's reviewer-notes field along with an org slug that has scans + PRs to browse.
|
|
195
|
+
- **Write tools.** Gated behind `user_config.read_only` (defaults to on). Reviewers can toggle off to test `codeant_scans_start` / `codeant_pr_resolve`.
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## Troubleshooting
|
|
200
|
+
|
|
201
|
+
| Symptom | Where to look |
|
|
202
|
+
|---|---|
|
|
203
|
+
| Server fails to start in Claude Desktop | `~/Library/Logs/Claude/mcp-server-codeant.log` |
|
|
204
|
+
| Tool calls return errors | Same log — server stderr is captured there. |
|
|
205
|
+
| Tool not listed at all | Check `CODEANT_READ_ONLY` — write tools are hidden when set to `1`. |
|
|
206
|
+
| Auth errors on every tool | Confirm `CODEANT_API_TOKEN` is set in the MCP env (not just in `~/.codeant/config.json`). |
|
|
207
|
+
| MCPB install dialog never appears | Open `.mcpb` with `open -a Claude dist/codeant.mcpb` to force the desktop app to handle it. |
|
package/package.json
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codeant-cli",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.5",
|
|
4
4
|
"description": "Code review CLI tool",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/CodeAnt-AI/codeant-cli.git"
|
|
9
|
+
},
|
|
6
10
|
"bin": {
|
|
7
|
-
"codeant": "
|
|
11
|
+
"codeant": "src/index.js"
|
|
8
12
|
},
|
|
9
13
|
"scripts": {
|
|
10
14
|
"start": "node src/index.js",
|
|
@@ -19,10 +23,7 @@
|
|
|
19
23
|
],
|
|
20
24
|
"author": "",
|
|
21
25
|
"license": "MIT",
|
|
22
|
-
"
|
|
23
|
-
"type": "git",
|
|
24
|
-
"url": "https://github.com/CodeAnt-AI/codeant-cli"
|
|
25
|
-
},
|
|
26
|
+
"homepage": "https://docs.codeant.ai/cli/setup",
|
|
26
27
|
"main": "./src/reviewHeadless.js",
|
|
27
28
|
"exports": {
|
|
28
29
|
".": "./src/reviewHeadless.js",
|
|
@@ -34,10 +35,19 @@
|
|
|
34
35
|
"./scans/scan-history": "./src/scans/getScanHistory.js",
|
|
35
36
|
"./scans/fetch-results": "./src/scans/fetchScanResults.js",
|
|
36
37
|
"./scans/fetch-advanced-results": "./src/scans/fetchAdvancedScanResults.js",
|
|
37
|
-
"./scans/dismissed-alerts": "./src/scans/fetchDismissedAlerts.js"
|
|
38
|
+
"./scans/dismissed-alerts": "./src/scans/fetchDismissedAlerts.js",
|
|
39
|
+
"./hotlist": "./src/hotlist/client.js",
|
|
40
|
+
"./findings/cloud": "./src/findings/cloud.js",
|
|
41
|
+
"./findings/pentest": "./src/findings/pentest.js",
|
|
42
|
+
"./findings/antipatterns": "./src/findings/antipatterns.js",
|
|
43
|
+
"./api": "./src/commands/api/request.js"
|
|
38
44
|
},
|
|
39
45
|
"files": [
|
|
40
|
-
"src"
|
|
46
|
+
"src",
|
|
47
|
+
"findings.md",
|
|
48
|
+
"cli-api.md",
|
|
49
|
+
"scans.md",
|
|
50
|
+
"mcp.md"
|
|
41
51
|
],
|
|
42
52
|
"dependencies": {
|
|
43
53
|
"@gitbeaker/rest": "^43.8.0",
|