Skip to content

Commit a510f85

Browse files
authored
Merge pull request #155 from githubnext/copilot/update-readme-mcp-gateway-log-dir
2 parents 8aabce7 + 6fc9c82 commit a510f85

2 files changed

Lines changed: 19 additions & 4 deletions

File tree

AGENTS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,11 @@ DEBUG_COLORS=0 DEBUG=* ./awmg --config config.toml
224224
- `PORT`, `HOST`, `MODE` - Server config (via run.sh)
225225
- `DEBUG` - Enable debug logging (e.g., `DEBUG=*`, `DEBUG=server:*,launcher:*`)
226226
- `DEBUG_COLORS` - Control colored output (0 to disable, auto-disabled when piping)
227+
- `MCP_GATEWAY_LOG_DIR` - Log file directory (sets default for `--log-dir` flag, default: `/tmp/gh-aw/mcp-logs`)
227228

228229
**File Logging:**
229230
- Operational logs are always written to `mcp-gateway.log` in the configured log directory
230-
- Default log directory: `/tmp/gh-aw/mcp-logs` (configurable via `--log-dir` flag)
231+
- Default log directory: `/tmp/gh-aw/mcp-logs` (configurable via `--log-dir` flag or `MCP_GATEWAY_LOG_DIR` env var)
231232
- Falls back to stdout if log directory cannot be created
232233
- Logs include: startup, client interactions, backend operations, auth events, errors
233234

README.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ For detailed setup instructions, building from source, and local development, se
6262
- `-i`: Enables stdin for passing JSON configuration
6363
- `-e MCP_GATEWAY_*`: Required environment variables
6464
- `-v /var/run/docker.sock`: Required for spawning backend MCP servers
65-
- `-v /path/to/logs:/tmp/gh-aw/mcp-logs`: Mount for persistent gateway logs
65+
- `-v /path/to/logs:/tmp/gh-aw/mcp-logs`: Mount for persistent gateway logs (or use `-e MCP_GATEWAY_LOG_DIR=/custom/path` with matching volume mount)
6666
- `-p 8000:8000`: Port mapping must match `MCP_GATEWAY_PORT`
6767

6868
MCPG will start in routed mode on `http://0.0.0.0:8000` (using `MCP_GATEWAY_PORT`), proxying MCP requests to your configured backend servers.
@@ -225,7 +225,7 @@ When running locally (`run.sh`), these variables are optional (warnings shown if
225225
| `MCP_GATEWAY_API_KEY` | API authentication key | (disabled) |
226226
| `MCP_GATEWAY_HOST` | Gateway bind address | `0.0.0.0` |
227227
| `MCP_GATEWAY_MODE` | Gateway mode | `--routed` |
228-
| `MCP_GATEWAY_LOG_DIR` | Log file directory | `/tmp/gh-aw/mcp-logs` |
228+
| `MCP_GATEWAY_LOG_DIR` | Log file directory (sets default for `--log-dir` flag) | `/tmp/gh-aw/mcp-logs` |
229229

230230
### Docker Configuration
231231

@@ -253,13 +253,15 @@ docker run -i \
253253
-e MCP_GATEWAY_DOMAIN=localhost \
254254
-e MCP_GATEWAY_API_KEY=your-key \
255255
-v /var/run/docker.sock:/var/run/docker.sock \
256+
-v /path/to/logs:/tmp/gh-aw/mcp-logs \
256257
-p 8080:8080 \
257258
ghcr.io/githubnext/gh-aw-mcpg:latest < config.json
258259
```
259260

260261
**Important flags:**
261262
- `-i`: Required for passing configuration via stdin
262263
- `-v /var/run/docker.sock:/var/run/docker.sock`: Required for spawning backend MCP servers
264+
- `-v /path/to/logs:/tmp/gh-aw/mcp-logs`: Optional but recommended for persistent logs (path matches default or `MCP_GATEWAY_LOG_DIR`)
263265
- `-p <host>:<container>`: Port mapping must match `MCP_GATEWAY_PORT`
264266

265267
### Validation Checks
@@ -299,8 +301,20 @@ MCPG provides comprehensive logging of all gateway operations to help diagnose i
299301

300302
### Log File Location
301303

302-
By default, logs are written to `/tmp/gh-aw/mcp-logs/mcp-gateway.log`. This location can be configured using the `--log-dir` flag or `MCP_GATEWAY_LOG_DIR` environment variable:
304+
By default, logs are written to `/tmp/gh-aw/mcp-logs/mcp-gateway.log`. This location can be configured using either:
303305

306+
1. **`MCP_GATEWAY_LOG_DIR` environment variable** - Sets the default log directory
307+
2. **`--log-dir` flag** - Overrides the environment variable and default
308+
309+
The precedence order is: `--log-dir` flag → `MCP_GATEWAY_LOG_DIR` env var → default (`/tmp/gh-aw/mcp-logs`)
310+
311+
**Using the environment variable:**
312+
```bash
313+
export MCP_GATEWAY_LOG_DIR=/var/log/mcp-gateway
314+
./awmg --config config.toml
315+
```
316+
317+
**Using the command-line flag:**
304318
```bash
305319
./awmg --config config.toml --log-dir /var/log/mcp-gateway
306320
```

0 commit comments

Comments
 (0)