- Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
SEP: Binary Mode Elicitation for File Uploads
Status: Proposal
Author: @localden
Created: August 5, 2025
Type: Standards Track
Note
This is an exploratory proposal. There are more questions to be hashed out.
Abstract
This SEP proposes extending the Model Context Protocol (MCP) elicitation feature to support a new binary mode for file uploads. The current elicitation mechanism supports form mode for structured text data and URL mode for out-of-band interactions, but lacks the ability to request file uploads directly. This extension would add a third mode enabling servers to request binary files (images, documents, archives, etc.) from users while maintaining the same security principles and user interaction model as the existing elicitation specification.
Motivation
The current MCP elicitation specification supports two modes:
- Form mode: For structured text data collection with JSON schema validation
- URL mode (in review SEP-1036): For secure out-of-band interactions (OAuth, payments, etc.)
However, many real-world use cases require servers to process binary files directly within the MCP workflow:
- Image Analysis: Computer vision servers need to analyze user-uploaded images
- Document Processing: PDF analyzers, OCR services, and document parsers need access to binary documents
- Code Analysis: Static analysis tools may need to process compiled binaries or archives
- Data Import: Servers may need to process CSV, Excel, or other binary data formats
- Model Training: ML servers may need training data in various binary formats
Currently, these scenarios require workarounds such as:
- Complex base64 encoding within text fields (inefficient, size-limited)
- External file hosting with URL sharing (security concerns, complexity)
- Pre-uploading files to shared locations (poor user experience)
The existing elicitation model provides the perfect foundation for binary file requests because it already:
- Maintains client control over user interactions
- Provides clear security boundaries
- Supports structured validation
- Offers a consistent three-action response model (accept/decline/cancel)
- Uses a flexible mode-based architecture that can accommodate new interaction types
Specification
1. Capability Declaration
Clients that support binary elicitation MUST declare the binary mode within the existing elicitation capability during initialization (similar to what was proposed in SEP-1036 for out-of-band elicitations):
{ "capabilities": { "elicitation": { "form": {}, "url": {}, "binary": { "maxFileSize": 104857600, "supportedMimeTypes": ["*/*"] } } } }The binary mode capability includes:
maxFileSize(optional): Maximum file size in bytes the client will acceptsupportedMimeTypes(optional): Array of supported MIME types (default:["*/*"]for all types)
2. Binary Mode Elicitation Requests
Binary file requests use mode: "binary" within the existing elicitation/create method. The server provides upload endpoints for each file field:
{ "jsonrpc": "2.0", "id": 1, "method": "elicitation/create", "params": { "mode": "binary", "message": "Please upload an image for analysis", "requestedSchema": { "type": "object", "properties": { "imageFile": { "type": "file", "title": "Image File", "description": "Select an image file to analyze", "accept": ["image/*"], "maxSize": 5242880, "required": true }, "description": { "type": "string", "title": "Description", "description": "Optional description of the image", "maxLength": 500 } }, "required": ["imageFile"] }, "uploadEndpoints": { "imageFile": { "url": "https://server.example.com/mcp/upload/session-abc123", "method": "POST", "uploadId": "550e8400-e29b-41d4-a716-446655440000" } } } }File Schema Properties
The file type schema supports the following properties:
type: MUST be"file"title: Display name for the file inputdescription: Help text for the useraccept: Array of MIME types or file extensions (e.g.,["image/*", ".pdf", "application/json"])maxSize: Maximum file size in bytes for this specific fieldmultiple: Boolean indicating if multiple files are allowed (default:false)required: Boolean indicating if the file is required (inherited from parent object)
Upload Endpoints
The uploadEndpoints object maps file field names to their upload configuration:
url: Server endpoint URL for uploading the file contentmethod: HTTP method to use for upload (typically "POST" or "PUT")uploadId: Unique identifier for this upload (GUID format recommended)
For multiple file fields, each field has its own upload endpoint:
{ "uploadEndpoints": { "imageFile": { "url": "https://server.example.com/mcp/upload/session-abc123", "method": "POST", "uploadId": "550e8400-e29b-41d4-a716-446655440000" }, "documentFile": { "url": "https://server.example.com/mcp/upload/session-def456", "method": "POST", "uploadId": "6ba7b810-9dad-11d1-80b4-00c04fd430c8" } } }3. Response Format
Binary file responses include file metadata that confirms which files the user selected and uploaded:
Accept Response
{ "jsonrpc": "2.0", "id": 1, "result": { "action": "accept", "content": { "imageFile": { "name": "sunset.jpg", "size": 2097152, "mimeType": "image/jpeg", "uploadId": "550e8400-e29b-41d4-a716-446655440000" }, "description": "A beautiful sunset over the ocean" } } }File Object Structure
Each file in the response contains:
name: Original filenamesize: File size in bytesmimeType: MIME type of the fileuploadId: The upload ID provided by the server in the upload endpoint configuration
Multiple Files
When multiple: true is specified, the file field contains an array of file objects:
{ "content": { "documents": [ { "name": "document1.pdf", "size": 1048576, "mimeType": "application/pdf", "uploadId": "6ba7b810-9dad-11d1-80b4-00c04fd430c8" }, { "name": "document2.pdf", "size": 2097152, "mimeType": "application/pdf", "uploadId": "6ba7b810-9dad-11d1-80b4-00c04fd430c8" } ] } }Decline/Cancel Responses
Decline and cancel responses remain unchanged from the base elicitation specification:
{ "jsonrpc": "2.0", "id": 1, "result": { "action": "decline" } }5. File Upload Protocol
The file upload process follows this sequence:
- Server sends
elicitation/createrequest withuploadEndpointscontaining upload URLs for each file field - Client presents file selection interface to user
- User selects files and confirms
- Client uploads files directly to the server's provided endpoints
- Client sends elicitation response with file metadata confirming successful uploads
File Upload Request
Files are uploaded to the endpoints provided by the server using the specified HTTP method:
POST /mcp/upload/session-abc123 HTTP/1.1 Host: server.example.com Authorization: Bearer {mcp-client-auth-token} Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW ------WebKitFormBoundary7MA4YWxkTrZu0gW Content-Disposition: form-data; name="file"; filename="sunset.jpg" Content-Type: image/jpeg [binary file content] ------WebKitFormBoundary7MA4YWxkTrZu0gW--File Upload Response
Servers MUST respond with an HTTP success status code (2xx) to indicate successful upload. The response format is implementation-specific, but servers MAY include additional information in the response. Clients are not obligated to parse the response or pass it back to the server beyond knowing the response HTTP code.
HTTP/1.1 200 OK Content-Type: application/json { "uploadId": "550e8400-e29b-41d4-a716-446655440000", "status": "completed" }Upload Requirements
Clients MUST:
- Use the exact
urlprovided in the elicitation request'suploadEndpoints - Include the MCP client's authorization token in the
Authorizationheader - Use
multipart/form-dataencoding for file uploads - Use "file" as the form field name for the uploaded file
- Include the original filename in the
Content-Dispositionheader - Set the appropriate
Content-Typefor the file within the multipart section
For multiple files, each file should be included as a separate form field:
POST /mcp/upload/session-def456 HTTP/1.1 Host: server.example.com Authorization: Bearer {mcp-client-auth-token} Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW ------WebKitFormBoundary7MA4YWxkTrZu0gW Content-Disposition: form-data; name="file"; filename="document1.pdf" Content-Type: application/pdf [binary file content for document1.pdf] ------WebKitFormBoundary7MA4YWxkTrZu0gW Content-Disposition: form-data; name="file"; filename="document2.pdf" Content-Type: application/pdf [binary file content for document2.pdf] ------WebKitFormBoundary7MA4YWxkTrZu0gW--Upload Progress Reporting
Servers MAY request progress updates for file uploads by including a progressToken in the elicitation request metadata:
{ "jsonrpc": "2.0", "id": 1, "method": "elicitation/create", "params": { "_meta": { "progressToken": "upload-progress-123" }, "mode": "binary", "message": "Please upload an image for analysis", "requestedSchema": { // ... schema definition } } }During file upload, clients MAY send progress notifications to the server:
{ "jsonrpc": "2.0", "method": "notifications/progress", "params": { "progressToken": "upload-progress-123", "progress": 1048576, "total": 2097152, "message": "Uploading sunset.jpg..." } }Progress notifications:
progress: Bytes uploaded so fartotal: Total file size in bytes (from the elicitation response)message: Optional human-readable status message
Servers MAY:
- Request progress notifications by including a
progressTokenin the elicitation request - Use progress information for monitoring, logging, or user feedback purposes
Clients MAY:
- Send progress notifications if a
progressTokenwas provided in the elicitation request - Report upload progress using the
notifications/progressmethod
6. Size and Type Validation
Clients MUST validate file uploads against the specified constraints:
- Size validation: Files exceeding
maxSize(field-level) ormaxFileSize(capability-level) MUST be rejected - Type validation: Files not matching the
acceptcriteria SHOULD be filtered from file selection - Multiple files: When
multiple: false(default), only one file MUST be accepted per field
Backwards Compatibility with Existing Implementations
For maximum compatibility:
- Clients that declare
"elicitation": {}without mode specification should be treated as supporting form mode only - Servers should gracefully handle clients that don't support binary mode by either offering alternative workflows or clear error messages
Security Implications
Trust and Safety
- User control: Users maintain complete control over file uploads through the client interface
- Validation: Size and type restrictions constrained on the client
- No direct access: Servers cannot directly access user file systems - all uploads are user-initiated
Security Considerations
- File size limits: Prevent DoS attacks through large file uploads
- Type restrictions: MIME type validation reduces risk of unwanted file uploads
- Content scanning: Servers SHOULD implement malware scanning on uploaded files
- User consent: Clear UI indicating which server is requesting files and why
- Rate limiting: Servers SHOULD implement rate limiting for upload endpoints
- Audit trail: File upload requests and responses SHOULD be logged for security auditing
- Upload authentication: Upload endpoints must validate MCP client authorization tokens
- Upload session security: Upload URLs should include upload-specific identifiers to prevent unauthorized uploads
- File storage: Uploaded files should be stored securely with appropriate access controls
Privacy Implications
- File content: Files are uploaded directly to servers - users must be clearly informed
- Metadata exposure: File names and sizes are shared and may contain sensitive information
- Upload logs: Server logs of file uploads may reveal sensitive patterns and should be handled carefully
- Transport security: File uploads must use secure transport (HTTPS/TLS)
- Authorization reuse: The same MCP authorization token is used for uploads, maintaining consistent security model
Relevant Discussions
Metadata
Metadata
Assignees
Labels
Type
Projects
Status