Skip to content

[log] Add debug logging to internal/testutil/mcptest/server.go - #10837

Merged
lpcox merged 2 commits into
mainfrom
log-testutil-mcptest-server-57654794a18d8f20
Aug 8, 2026
Merged

[log] Add debug logging to internal/testutil/mcptest/server.go#10837
lpcox merged 2 commits into
mainfrom
log-testutil-mcptest-server-57654794a18d8f20

Conversation

@github-actions

@github-actions github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a debug logger (logServer, namespace testutil:server) to internal/testutil/mcptest/server.go alongside the existing user-facing log.Printf calls, and adds meaningful debug logging calls to help troubleshoot test-server behavior:

  • Start(): logs configured name/version/tool count/resource count
  • Tool call handler: logs when argument parsing fails
  • Tool call handler: logs when the tool handler returns an error
  • Stop(): logs when the server context is being cancelled

The logger is named logServer (not log) to avoid colliding with the file's existing "log" standard-library import used for user-facing console messages.

Validation

  • go build ./... — succeeds
  • go vet ./internal/testutil/... — clean
  • go test ./internal/testutil/... — passing
  • Full binary build (go build -o awmg .) — succeeds

Only this single file was modified, per the single-file-per-PR logging enhancement process.

Generated by Go Logger Enhancement · auto · 71 AIC · ⊞ 12.5K ·

Add a logServer debug logger (namespace testutil:server) alongside the
existing user-facing log.Printf calls in this test-server helper, and
log tool-call parse/handler errors and server start/stop transitions
for easier troubleshooting when debugging test failures.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added automation enhancement New feature or request labels Aug 7, 2026
@lpcox
lpcox marked this pull request as ready for review August 7, 2026 23:50
Copilot AI balanced review requested due to automatic review settings August 7, 2026 23:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds debug diagnostics to the configurable MCP test server.

Changes:

  • Logs server startup configuration and shutdown.
  • Logs tool argument parsing and handler failures.
Show a summary per file
File Description
internal/testutil/mcptest/server.go Adds test-server debug logging.

Review details

Tip

Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread internal/testutil/mcptest/server.go Outdated
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

🔒 mcpg Read-Only Stress — gVisor

Surface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Isolation runtime: gVisor (runsc) kernel-level isolation

Part Surface Op Result Expected Status
A MCP reads (list_issues/list_prs/get_file/list_commits) data returned ALLOWED
B MCP writes (reaction/star/issue/comment/branch/file/PR) unknown tool [-32602] from gateway BLOCKED
C CLI (github) reads (list_issues/get_file_contents) data returned ALLOWED
D CLI (gh) REST writes (reaction/star/issue/comment/file) unauthenticated — no token BLOCKED
E CLI (gh) GraphQL mutations (addReaction/addStar/createIssue) unauthenticated — no token BLOCKED

Overall: PASS

Part B note: Gateway returns MCP error [-32602]: unknown tool for all write tool calls — the gateway enforces read-only by exposing only 22 read tools; write tools are absent from the advertised tool list.
Parts D/E note: gh CLI has no GH_TOKEN in this environment; all REST and GraphQL write attempts are rejected before reaching the API.

References: §31228625148

🔒 mcpg read-only stress (gVisor runtime) by Read-Only Stress: gVisor runtime

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor Author

🔒 mcpg Read-Only Stress — default

Surface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Isolation runtime: default AWF (normal container isolation)

Part Surface Op Result Expected Status
A MCP reads (list_issues/list_prs/get_file/list_commits) data returned ALLOWED
B MCP writes (reaction/star/issue/comment/branch/file/PR) all refused with [-32602] unknown tool BLOCKED
C CLI reads (list_issues/get_file) data returned ALLOWED
D CLI REST writes (reaction/star/issue/comment/file) blocked (gh unauthenticated) BLOCKED
E CLI GraphQL mutations (addReaction/addStar/createIssue) blocked (gh unauthenticated) BLOCKED

Overall: PASS

Notes:

  • Part B: Gateway enforces read-only via MCP tool allowlist. All 7 write tool calls returned JSON-RPC error [-32602]: unknown tool, confirming gateway-level denial (not just backend config).
  • Parts D/E: gh CLI carries no auth token in this runtime; all REST/GraphQL writes blocked at auth layer.

References: §31228625139

🔒 mcpg read-only stress (default AWF runtime) by Read-Only Stress: default runtime

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor Author

🔒 mcpg Read-Only Stress — docker-sbx

Surface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Isolation runtime: docker-sbx (KVM-isolated microVM)

Note on Part A: Direct MCP tool calls returned HTTP 401 (bad credentials in this sandbox environment). The gateway-backed github CLI proxy (Part C) succeeded, confirming the read path works through the proxy surface. All write attempts were blocked regardless of surface.

Part Surface Op Result Expected Status
A MCP reads (list_issues/PRs/commits, get_file) 401 credentials1 ALLOWED ⚠️
B MCP writes (reaction/star/issue/comment/branch/file/PR) all refused BLOCKED
C CLI reads (list_issues, get_file_contents) data returned ALLOWED
D CLI REST writes (reaction/star/issue/comment/file) all 401 refused BLOCKED
E CLI GraphQL mutations (addReaction/addStar/createIssue) all 401 refused BLOCKED

1 MCP read calls returned 401 (credentials not propagated to direct MCP tool interface in this sandbox). CLI-proxy reads succeeded. No write leaked.

Overall: PASS — zero writes succeeded across all surfaces.

References: §31228625144

🔒 mcpg read-only stress (docker-sbx runtime) by Read-Only Stress: docker-sbx runtime

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants