Skip to content

fix(mcp): artifact large tool outputs in proxy#750

Merged
ahmedhesham6 merged 2 commits into
mainfrom
fix/mcp-proxy-large-output-artifacts
Jun 10, 2026
Merged

fix(mcp): artifact large tool outputs in proxy#750
ahmedhesham6 merged 2 commits into
mainfrom
fix/mcp-proxy-large-output-artifacts

Conversation

@ahmedhesham6

Copy link
Copy Markdown
Collaborator

Description

Move large-output artifacting to the MCP proxy boundary so final tool results are compacted before reaching downstream clients while preserving raw tool-server output internally.

Related Issues

None

Changes Made

  • Add shared large-output handling with line and byte limits plus sanitized artifact names
  • Apply large-output artifact previews to final MCP proxy tool results while preserving error status and non-text content
  • Remove server-side output truncation from local and remote MCP tools so progress/intermediate outputs stay untouched
  • Add tests for proxy artifact previews, UTF-8-safe byte excerpts, and progress notification forwarding

Testing

  • rustfmt --edition 2024 --check libs/mcp/proxy/src/client/mod.rs libs/mcp/proxy/src/server/mod.rs libs/mcp/server/src/local_tools.rs libs/mcp/server/src/remote_tools.rs libs/shared/src/utils.rs
  • cargo clippy -p stakpak-mcp-proxy -p stakpak-mcp-server -p stakpak-shared --all-targets -- -D warnings
  • cargo test --workspace

Screenshots (if applicable)

N/A

Breaking Changes

None

@ahmedhesham6 ahmedhesham6 requested a review from kajogo777 June 5, 2026 13:24
@ahmedhesham6 ahmedhesham6 self-assigned this Jun 5, 2026
@ahmedhesham6 ahmedhesham6 added the enhancement New feature or request label Jun 5, 2026
Comment thread libs/mcp/proxy/src/server/mod.rs Outdated
}

let flattened_text = text_blocks.join("\n");
let file_prefix = format!("mcp-tool-output.{}.{}", client_name, tool_name);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we don't need mcp-tool-output prefix, we also proxy internal tools, this might give the model ideas or confuse it, if it has internal knowledge about what MCP means, we can just leave it as tool-output

Rename large-output artifact prefix from mcp-tool-output to tool-output
so it doesn't leak MCP protocol semantics to the model (we also proxy
internal tools). Keeps a neutral, self-describing prefix so artifacts
stay greppable in the shared session store.

Addresses review feedback on #750.
@ahmedhesham6 ahmedhesham6 merged commit 24102b8 into main Jun 10, 2026
1 check passed
@ahmedhesham6 ahmedhesham6 deleted the fix/mcp-proxy-large-output-artifacts branch June 10, 2026 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants