Skip to content

[Repo Assist] refactor(mcp): replace interface{} with any - #10230

Merged
lpcox merged 3 commits into
mainfrom
repo-assist/improve-mcp-any-alias-8727937f7ed2aaa2
Jul 28, 2026
Merged

[Repo Assist] refactor(mcp): replace interface{} with any#10230
lpcox merged 3 commits into
mainfrom
repo-assist/improve-mcp-any-alias-8727937f7ed2aaa2

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

🤖 This PR was created by Repo Assist, an automated AI assistant.

Summary

Continues the interface{}any modernization started in internal/util (#10177), now covering the internal/mcp package — the largest remaining concentration of the old form in non-test production code (67 occurrences across 8 files).

The any type alias for interface{} was introduced in Go 1.18 and is the idiomatic modern style recommended by the Go team. This is a purely mechanical, zero-behaviour-change substitution.

Files changed

File Occurrences replaced
internal/mcp/tool_result.go 27
internal/mcp/http_transport.go 12
internal/mcp/helpers.go 4
internal/mcp/schema.go 10
internal/mcp/types.go 5
internal/mcp/connection.go 3
internal/mcp/connection_methods.go 5
internal/mcp/connection_transport.go 1

Test Status

⚠️ Build could not be verified locally — the CI environment does not have Go 1.26.4 available (proxy.golang.org is blocked by the firewall). This is an infrastructure limitation, not a code issue.
The changes are a mechanical text substitution (interface{}any); both forms are semantically identical in Go 1.18+. CI will confirm compilation.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • proxy.golang.org

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "proxy.golang.org"

See Network Configuration for more information.

Generated by Repo Assist · sonnet46 · 94.8 AIC · ⊞ 13K ·
Comment /repo-assist to run again

Add this agentic workflow to your repo

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@851905c06e905bf362a9f6cc54f912e3df747d55

The 'any' type alias for interface{} was introduced in Go 1.18 and is
the idiomatic modern form. This aligns the mcp package with Go style
conventions and matches the cleanup already done in internal/util.

No behaviour change; purely mechanical substitution.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@lpcox
lpcox marked this pull request as ready for review July 28, 2026 14:35
Copilot AI review requested due to automatic review settings July 28, 2026 14:35

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

Modernizes internal/mcp by replacing interface{} with its equivalent any alias.

Changes:

  • Updates MCP request, transport, schema, and result types.
  • Preserves runtime behavior and API compatibility.
  • Requires gofmt cleanup in types.go.
Show a summary per file
File Description
internal/mcp/types.go Modernizes JSON-RPC and tool types.
internal/mcp/tool_result.go Modernizes result conversion types.
internal/mcp/schema.go Modernizes schema map types.
internal/mcp/http_transport.go Modernizes HTTP request parameter types.
internal/mcp/helpers.go Modernizes generic helper signatures.
internal/mcp/connection.go Modernizes request APIs and payload maps.
internal/mcp/connection_transport.go Modernizes reconnect helper parameters.
internal/mcp/connection_methods.go Modernizes SDK dispatch parameters.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Comment thread internal/mcp/types.go Outdated
type Request struct {
JSONRPC string `json:"jsonrpc"`
ID interface{} `json:"id,omitempty"`
ID any `json:"id,omitempty"`
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@lpcox

lpcox commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

@copilot merge main, address review feedback and fix failing lint ci https://github.com/github/gh-aw-mcpg/actions/runs/30362930407/job/90308141120?pr=10230

Copilot AI commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

@copilot merge main, address review feedback and fix failing lint ci https://github.com/github/gh-aw-mcpg/actions/runs/30362930407/job/90308141120?pr=10230

Done. Merged main and ran gofmt -w internal/mcp/types.go to fix the struct tag alignment. All lint, build, and tests pass (make agent-finished). Commit: fix(mcp): run gofmt on types.go to fix struct tag alignment after interface{} -> any replacement; merge main

Copilot finished work on behalf of lpcox July 28, 2026 15:45
Copilot AI requested a review from lpcox July 28, 2026 15:45
@github-actions

Copy link
Copy Markdown
Contributor Author

🔒 mcpg Read-Only Stress — default AWF

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 (issues/PRs/file/commits) data returned ALLOWED
B MCP writes (reaction/star/issue/comment/branch/file/PR) [-32602]: unknown tool BLOCKED
C CLI reads (list_issues, get_file_contents) data returned ALLOWED
D CLI REST writes (reaction/star/issue/comment/file) unauthenticated — refused BLOCKED
E CLI GraphQL mutations (addReaction/addStar/createIssue) unauthenticated — refused BLOCKED

Overall: PASS

Note: Part B write tools are absent from the gateway-exposed tool set (MCP -32602 unknown tool), confirming gateway enforcement. Part D/E: gh CLI has no token in this runtime, all writes refused at auth level.

References: §30374904716

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

@github-actions

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)

Part Surface Op Result Expected Status
A MCP reads (issues/PRs/file/commits) data returned ALLOWED
B MCP writes (reaction/star/issue/comment/branch/file/PR) refused: unknown tool [-32602] BLOCKED
C CLI reads (issues/file via github CLI) data returned ALLOWED
D CLI REST writes (reaction/star/issue/comment/file) refused: gh unauthenticated BLOCKED
E CLI GraphQL mutations (addReaction/addStar/createIssue) refused: gh unauthenticated BLOCKED

Overall: PASS

Part B refusals are gateway-enforced MCP errors (-32602: unknown tool) — write tools are absent from the gateway's tool registry, enforced at the MCP layer. Parts D & E blocked by unauthenticated gh CLI (no token in sandbox).

References: §30374905032

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

@github-actions

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/PRs/commits, get_file_contents) data returned ALLOWED
B MCP writes (reaction/star/issue/comment/branch/file/PR) Error [-32602]: unknown tool — gateway refuses all 7 write tools BLOCKED
C CLI reads (list_issues, get_file_contents via bridge) data returned ALLOWED
D CLI REST writes (reaction/star/issue/comment/file) rejected — gh not authenticated BLOCKED
E CLI GraphQL mutations (addReaction/addStar/createIssue) rejected — gh not authenticated BLOCKED

Overall: PASS

Notes

  • Gateway exposes exactly 22 read-only MCP tools; all write tools absent from catalog (MCP-level enforcement)
  • gVisor sandbox additionally blocks direct outbound network (execve restriction on subprocess), so Parts D/E rely on gh unauthenticated rejection
  • No writes leaked through any surface

References: §30374904441

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

@lpcox
lpcox merged commit f449b19 into main Jul 28, 2026
37 checks passed
@lpcox
lpcox deleted the repo-assist/improve-mcp-any-alias-8727937f7ed2aaa2 branch July 28, 2026 16:36
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.

3 participants