Skip to content

Add file manager and tool tester UI to mcpproxy frontend#24

Merged
BillJr99 merged 1 commit into
mainfrom
claude/festive-newton-jbm58h
Jun 12, 2026
Merged

Add file manager and tool tester UI to mcpproxy frontend#24
BillJr99 merged 1 commit into
mainfrom
claude/festive-newton-jbm58h

Conversation

@BillJr99

Copy link
Copy Markdown
Owner

Summary

This PR adds two new interactive features to the mcpproxy UI: a file manager for browsing/uploading files to volume-mounted directories, and a tool tester for invoking registered MCP tools with custom arguments.

Key Changes

File Manager (/api/files endpoints)

  • New REST API endpoints for file operations:

    • GET /api/files — list directory contents with metadata (type, size, mtime)
    • POST /api/files/mkdir — create nested directories
    • POST /api/files/upload — multipart file upload with size limits
    • GET /api/files/download — download files
    • DELETE /api/files — delete files/directories with optional recursive flag
  • Security: Implemented _resolve_in_root() helper that validates all paths using Path.resolve() and relative_to() to prevent directory traversal attacks and symlink escapes. Symlinks are detected and listed but cannot be followed for reads.

  • Configuration: Added file_roots parameter to create_app() to define whitelisted root directories (tools, files, repos). Defaults to CONFIG_DIR, FILES_DIR, and REPOS_DIR.

  • Upload limits: Configurable via MCPPROXY_MAX_UPLOAD_BYTES environment variable (default 50 MB). Partial uploads are cleaned up on failure.

Tool Tester UI

  • New modal interface for discovering and invoking registered MCP tools
  • Dynamic form generation from tool JSON schemas with support for:
    • Required/optional field indicators
    • Type-specific inputs (text, number, boolean, enum, JSON)
    • Default values and descriptions
  • Result rendering with error/success indicators and formatted output display
  • Tool filtering by name with provider-based grouping (e.g., provider__tool)

Frontend UI Updates

  • Added two new navbar buttons: "📁 Files" and "🧪 Test Tools"
  • Implemented file browser with breadcrumb navigation, directory listing, and delegated click handlers
  • Added modal dialogs for both features with responsive layouts
  • Integrated with existing toast notifications and modal management

Dependencies

  • Added python-multipart for FastAPI multipart form handling

Implementation Details

  • File paths are always relative to whitelisted roots and validated before any filesystem operation
  • Symlinks are safely handled: listed as symlinks but cannot be read through; the link itself can be deleted
  • Upload handler streams chunks to prevent memory exhaustion and validates size limits incrementally
  • Tool tester collects form arguments with type coercion (integers, JSON parsing) and proper error handling
  • All untrusted output (tool results, filenames) is escaped or rendered as text content to prevent XSS

https://claude.ai/code/session_01WnK1rtXGHDCNpsycAvxFqC

File manager (navbar → 📁 Files): browse the volume-mounted roots
(tools, files, repos), create subdirectories (e.g. tools/secrets),
upload files like client_secret.json, download, and delete — backed by
new /api/files endpoints with root whitelisting, resolve()+relative_to
path-traversal/symlink protection, basename-sanitized upload filenames,
and a streamed size cap (MCPPROXY_MAX_UPLOAD_BYTES, default 50 MB).

Tool tester (navbar → 🧪 Test Tools): lists every registered tool
grouped by provider, generates an argument form from each tool's JSON
input schema (enum/boolean/number/string fields with a raw-JSON
fallback for objects/arrays), invokes via the existing
/v1/tools/{name}/invoke endpoint, and renders the result with error
styling. Shows a restart hint when the registry is empty.

Adds python-multipart (required for FastAPI multipart uploads) and
tests covering the file API round-trip, traversal/symlink rejection,
filename sanitization, and the upload size limit.

https://claude.ai/code/session_01WnK1rtXGHDCNpsycAvxFqC
@BillJr99 BillJr99 merged commit a3344f9 into main Jun 12, 2026
2 checks passed
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