Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

@ammar-agent ammar-agent commented Dec 8, 2025

Large base64-encoded images from MCP servers (like chrome-devtools-mcp screenshots) were overflowing the model's context window.

Changes

Image Overflow Fix

  • Extract mcpResultTransform module with 256KB limit for image data
  • Oversized images replaced with descriptive text message showing the size
  • Add comprehensive tests for image truncation logic

CLI MCP Support

  • Add MCP server support to mux run CLI command
  • Add --mcp option for inline server specification: mux run --mcp "name=command"
  • Can be repeated: --mcp server1=cmd1 --mcp server2=cmd2
  • Add --no-mcp-config to ignore .mux/mcp.jsonc file

Examples

# Use config file servers (default)
mux run "Take a screenshot"

# Add inline servers (merged with config)
mux run --mcp "memory=npx -y @modelcontextprotocol/server-memory" "Remember this"

# Use only inline servers (ignore config file)
mux run --no-mcp-config --mcp "chrome=npx chrome-devtools-mcp" "Screenshot google.com"

Testing

  • Unit tests: 10 new tests for image truncation
  • CLI tests: 6 new tests for --mcp argument parsing
  • E2E: Verified with real chrome MCP server

Generated with mux

@chatgpt-codex-connector
Copy link

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

Copy link
Collaborator Author

@ammar-agent ammar-agent left a comment

Choose a reason for hiding this comment

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

The implementation uses indexOf("=") to find only the first = sign (line 164), so everything after it becomes the command:

--mcp "memory=npx -y @modelcontextprotocol/server-memory"
       ^^^^^  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       name   command (everything after first =)

The shell handles grouping via quotes. The help examples show this:

mux run --mcp "memory=npx -y @modelcontextprotocol/server-memory" "Remember this"
mux run --mcp "chrome=npx chrome-devtools-mcp" --mcp "fs=npx @anthropic/mcp-fs" "Take a screenshot"

Large base64-encoded images from MCP servers (like chrome-devtools-mcp
screenshots) were overflowing the model's context window.

- Extract mcpResultTransform module with 256KB limit for image data
- Oversized images replaced with descriptive text message
- Add MCP server support to `mux run` CLI command
- Add comprehensive tests for image truncation logic

_Generated with `mux`_
- Add --mcp flag: mux run --mcp "name=command" (can be repeated)
- Add --no-mcp-config flag to ignore .mux/mcp.jsonc file
- MCPServerManager accepts inlineServers and ignoreConfigFile options
- Inline servers override config file servers with the same name
- Add CLI tests for --mcp argument parsing and validation

_Generated with `mux`_
@ammar-agent ammar-agent force-pushed the mcp-image-overflow-fix branch from b68df88 to 3fdc8ed Compare December 9, 2025 02:35
@ammario ammario merged commit 1cecc36 into main Dec 9, 2025
19 checks passed
@ammario ammario deleted the mcp-image-overflow-fix branch December 9, 2025 02:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants