Skip to content

Commit 41284f1

Browse files
docs: document --validate-actor flag for mcp-server command (#15181)
1 parent bcfb18a commit 41284f1

2 files changed

Lines changed: 61 additions & 3 deletions

File tree

docs/src/content/docs/setup/cli.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -517,13 +517,20 @@ gh aw pr transfer <pr-url> --repo target-owner/target-repo
517517
Run MCP server exposing gh-aw commands as tools. Spawns subprocesses to isolate GitHub tokens.
518518

519519
```bash wrap
520-
gh aw mcp-server # stdio transport
521-
gh aw mcp-server --port 8080 # HTTP server with SSE
520+
gh aw mcp-server # stdio transport
521+
gh aw mcp-server --port 8080 # HTTP server with SSE
522+
gh aw mcp-server --validate-actor # Enable actor validation
522523
```
523524

524-
**Options:** `--port`, `--cmd`
525+
**Options:**
526+
- `--port`: HTTP server port for SSE transport
527+
- `--cmd`: Custom command for subprocess execution
528+
- `--validate-actor`: Enforce actor validation for logs and audit tools
529+
525530
**Available Tools:** status, compile, logs, audit, mcp-inspect, add, update
526531

532+
**Actor Validation:** When `--validate-actor` is enabled, logs and audit tools require write+ repository access. The server uses `GITHUB_ACTOR` and `GITHUB_REPOSITORY` environment variables to validate permissions via GitHub API. Permission checks are cached for 1 hour.
533+
527534
See [MCP Server Guide](/gh-aw/setup/mcp-server/).
528535

529536
### Utility Commands

docs/src/content/docs/setup/mcp-server.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,57 @@ Run with HTTP/SSE transport using `--port`:
3131
gh aw mcp-server --port 8080
3232
```
3333

34+
### Actor Validation
35+
36+
Control access to logs and audit tools based on repository permissions using `--validate-actor`:
37+
38+
```bash wrap
39+
gh aw mcp-server --validate-actor
40+
```
41+
42+
When actor validation is enabled:
43+
- Logs and audit tools require write, maintain, or admin repository access
44+
- The server reads `GITHUB_ACTOR` and `GITHUB_REPOSITORY` environment variables to determine actor permissions
45+
- Permission checks are performed at runtime using the GitHub API
46+
- Results are cached for 1 hour to minimize API calls
47+
48+
When actor validation is disabled (default):
49+
- All tools are available without permission checks
50+
- Backward compatible with existing configurations
51+
52+
**Environment Variables:**
53+
- `GITHUB_ACTOR`: GitHub username of the current actor (required when validation enabled)
54+
- `GITHUB_REPOSITORY`: Repository in `owner/repo` format (optional, improves performance)
55+
56+
**Permission Requirements:**
57+
58+
Restricted tools (logs, audit) require:
59+
- Minimum role: write, maintain, or admin
60+
- Permission check via GitHub API: `GET /repos/{owner}/{repo}/collaborators/{username}/permission`
61+
62+
**Error Handling:**
63+
64+
When `GITHUB_ACTOR` is not set and validation is enabled:
65+
```json
66+
{
67+
"error": "GITHUB_ACTOR environment variable not set",
68+
"tool": "logs",
69+
"reason": "This tool requires at least write access to the repository. Set GITHUB_ACTOR environment variable to enable access."
70+
}
71+
```
72+
73+
When actor has insufficient permissions:
74+
```json
75+
{
76+
"error": "insufficient repository permissions",
77+
"actor": "username",
78+
"repository": "owner/repo",
79+
"role": "read",
80+
"required": "write, maintain, or admin",
81+
"reason": "Actor username has read access to owner/repo. This tool requires at least write access."
82+
}
83+
```
84+
3485
## Configuring with GitHub Copilot Agent
3586

3687
Configure GitHub Copilot Agent to use gh-aw MCP server:

0 commit comments

Comments
 (0)