MediaStore Configuration¶
Configure where media files are stored — local filesystem or S3-compatible storage.
Overview¶
MediaStore is the storage abstraction behind all multimodal operations. When a tool uploads media via upload_media() or MediaResult, it goes to the configured MediaStore. When an LLM needs to resolve a resource_link, it fetches from the same store.
Two backends are available:
| Backend | Best For | URI Format |
|---|---|---|
| Local (default) | Development, single-machine | file:///tmp/mcp-mesh-media/media/chart.png |
| S3 | Production, multi-agent | s3://mcp-mesh-media/media/chart.png |
Local Filesystem (Default)¶
No configuration needed for development. Files are stored at /tmp/mcp-mesh-media/media/ by default.
# Optional — customize the path
export MCP_MESH_MEDIA_STORAGE=local
export MCP_MESH_MEDIA_STORAGE_PATH=/var/lib/mcp-mesh-media
export MCP_MESH_MEDIA_STORAGE_PREFIX=media/
Shared Storage for Multi-Agent
When running multiple agents locally, they all share the same filesystem, so local storage works out of the box. In Docker or Kubernetes, use S3 or a shared volume.
S3 / S3-Compatible (Production)¶
For production deployments with MinIO, AWS S3, or any S3-compatible service:
export MCP_MESH_MEDIA_STORAGE=s3
export MCP_MESH_MEDIA_STORAGE_BUCKET=mcp-mesh-media
export MCP_MESH_MEDIA_STORAGE_ENDPOINT=http://minio:9000 # omit for AWS
export MCP_MESH_MEDIA_STORAGE_PREFIX=media/
# Standard AWS credentials
export AWS_ACCESS_KEY_ID=minioadmin
export AWS_SECRET_ACCESS_KEY=minioadmin
S3 Dependencies¶
Environment Variables¶
| Variable | Default | Description |
|---|---|---|
MCP_MESH_MEDIA_STORAGE | local | Backend: local or s3 |
MCP_MESH_MEDIA_STORAGE_PATH | /tmp/mcp-mesh-media | Local filesystem base path |
MCP_MESH_MEDIA_STORAGE_BUCKET | mcp-mesh-media | S3 bucket name |
MCP_MESH_MEDIA_STORAGE_ENDPOINT | (none) | S3-compatible endpoint URL |
MCP_MESH_MEDIA_STORAGE_PREFIX | media/ | Key/directory prefix |
Security¶
- Path traversal protection — Local storage validates all paths against directory traversal attacks
- S3 credentials — Use IAM roles or environment variables; never hardcode
- Storage isolation — Each deployment's media is isolated by the configured prefix
See Also¶
- Returning Media — How to upload and return media from tools
- Environment Variables — Full configuration reference