Skip to content

Commit a2aac30

Browse files
authored
Reconcile docs with MCP_GATEWAY_PORT runtime behavior and Rust guard test guidance (#6039)
Nightly docs reconciliation found mismatches between documented env/test behavior and implementation, centered on `MCP_GATEWAY_PORT` semantics/defaults and incomplete contributor guidance. This PR aligns docs and one config comment with current runtime behavior. - **Environment variable semantics (`docs/ENVIRONMENT_VARIABLES.md`)** - Corrects `MCP_GATEWAY_PORT` wording: it is used by `run.sh` / `run_containerized.sh` to construct `--listen`, and by `awmg` only for `--validate-env` checks. - Removes conflicting value by aligning the production-table value with the script default (`8000`). - Expands the note to clearly separate script-read vars (`HOST`/`PORT`/`MODE`) from binary behavior. - **Contributor workflow clarity (`CONTRIBUTING.md`)** - Adds a dedicated **Rust Guard Tests** section for `make test-rust` and its `cargo` requirement. - Tightens `make agent-finished` wording to reflect what it actually runs (`go test ./...` + Rust guard tests). - **Agent quick reference alignment (`AGENTS.md`)** - Updates `Agent-Finished` description to explicitly include unit, integration, and Rust guard tests. - **JSON stdin config intent (`internal/config/config_stdin.go`)** - Adds a `StdinServerConfig` comment clarifying intentional omission of `command` in JSON stdin format (stdio uses `container`). ```md `MCP_GATEWAY_PORT` is read by the binary for `--validate-env` port-mapping checks only; it does **not** auto-configure the listen address. ```
2 parents 96b68d8 + c252aaa commit a2aac30

4 files changed

Lines changed: 14 additions & 5 deletions

File tree

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Quick reference for AI agents working with MCP Gateway (Go-based MCP proxy serve
1515
**Coverage**: `make coverage` (unit tests with coverage report)
1616
**Format**: `make format` (auto-format code with gofmt)
1717
**Clean**: `make clean` (remove build artifacts)
18-
**Agent-Finished**: `make agent-finished` (run format, build, lint, and all tests - ALWAYS run before completion)
18+
**Agent-Finished**: `make agent-finished` (run format, build, lint, and all tests (unit, integration, Rust guard) - ALWAYS run before completion)
1919
**Run**: `./awmg --config config.toml`
2020
**Run sequentially**: `./awmg --config config.toml --sequential-launch`
2121
**Run with Custom Log Directory**: `./awmg --config config.toml --log-dir /path/to/logs`

CONTRIBUTING.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,13 @@ Run both unit and integration tests (always rebuilds the binary first):
9797
make test-all
9898
```
9999

100+
#### Rust Guard Tests
101+
Run Rust guard unit tests (requires `cargo`):
102+
```bash
103+
make test-rust
104+
```
105+
Install the Rust toolchain from [rustup.rs](https://rustup.rs/) if not already present.
106+
100107
#### Serena MCP Tests (Optional)
101108
Run Serena MCP Server tests (requires Docker and network access):
102109
```bash
@@ -589,7 +596,7 @@ Required environment variables:
589596
3. **Add tests** for new functionality
590597
4. **Run linters and tests** before submitting:
591598
```bash
592-
make agent-finished # format + build + lint + all tests (unit, integration, rust-guard)
599+
make agent-finished # format + build + lint + go test ./... + Rust guard tests
593600
```
594601
5. **Update documentation** if you change behavior or add features
595602
6. **Keep changes minimal** - smaller PRs are easier to review

docs/ENVIRONMENT_VARIABLES.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ When running in a container (`run_containerized.sh`), these variables **must** b
88

99
| Variable | Description | Example |
1010
|----------|-------------|---------|
11-
| `MCP_GATEWAY_PORT` | The port the gateway listens on (used for `--listen` address) | `8080` |
11+
| `MCP_GATEWAY_PORT` | Port used by `run.sh`/`run_containerized.sh` to build the `--listen` address; also read by `awmg --validate-env` for port-mapping checks | `8000` |
1212
| `MCP_GATEWAY_DOMAIN` | The domain name for the gateway | `localhost` |
1313
| `MCP_GATEWAY_API_KEY` | API key checked by `run_containerized.sh` as a deployment gate; must be referenced in your JSON config via `"${MCP_GATEWAY_API_KEY}"` to enable authentication | `your-secret-key` |
1414

@@ -18,7 +18,7 @@ When running locally (`run.sh`), these variables are optional (warnings shown if
1818

1919
| Variable | Description | Default |
2020
|----------|-------------|---------|
21-
| `MCP_GATEWAY_PORT` | Gateway listening port | `8000` |
21+
| `MCP_GATEWAY_PORT` | Port used by `run.sh` to build the `--listen` address; also read by `awmg --validate-env` for port-mapping checks | `8000` |
2222
| `MCP_GATEWAY_DOMAIN` | Gateway domain | `localhost` |
2323
| `MCP_GATEWAY_API_KEY` | Informational only — not read directly by the binary; must be referenced in your config via `"${MCP_GATEWAY_API_KEY}"` to enable authentication | (disabled) |
2424
| `MCP_GATEWAY_LOG_DIR` | Log file directory (sets default for `--log-dir` flag) | `/tmp/gh-aw/mcp-logs` |
@@ -39,7 +39,7 @@ When running locally (`run.sh`), these variables are optional (warnings shown if
3939
| `DEBUG_COLORS` | Control colored debug output (0 to disable, auto-disabled when piping) | Auto-detect |
4040
| `RUNNING_IN_CONTAINER` | Manual override; set to `"true"` to force container detection when `/.dockerenv` and cgroup detection are unavailable | (unset) |
4141

42-
**Note:** `PORT`, `HOST`, and `MODE` are not read by the `awmg` binary directly. However, `run.sh` uses `HOST` (default: `0.0.0.0`), `MODE` (default: `--routed`), and falls back to `PORT` (when `MCP_GATEWAY_PORT` is unset) to set the bind address and routing mode. Use the `--listen` and `--routed`/`--unified` flags when running `awmg` directly.
42+
**Note:** `PORT`, `HOST`, and `MODE` are not read by the `awmg` binary directly. `MCP_GATEWAY_PORT` is read by the binary for `--validate-env` port-mapping checks only; it does **not** auto-configure the listen address. `run.sh` uses `HOST` (default: `0.0.0.0`), `MODE` (default: `--routed`), and falls back to `PORT` (when `MCP_GATEWAY_PORT` is unset) to set the bind address and routing mode. Use the `--listen` and `--routed`/`--unified` flags when running `awmg` directly.
4343

4444
## Test / Development Overrides
4545

internal/config/config_stdin.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ type StdinGuardConfig struct {
8080
}
8181

8282
// StdinServerConfig represents a single server configuration in stdin JSON format.
83+
// Note: unlike TOML ServerConfig, this struct intentionally has no Command field;
84+
// stdio servers must use Container instead.
8385
type StdinServerConfig struct {
8486
// Type is the server type: "stdio", "local", or "http"
8587
Type string `json:"type"`

0 commit comments

Comments
 (0)