forge-media
forge-media is an optional submodule that adds file upload, storage, and serving to a Forge application. AI agents can upload and manage files via MCP with no extra configuration.
Install
go get forge-cms.dev/forge-media
Wiring
Three lines to wire forge-media into a Forge app:
import forgemedia "forge-cms.dev/forge-media"
store := forgemedia.NewLocalMediaStore(app)
mediaSrv := forgemedia.Register(app, store)
mcpSrv := forgemcp.New(app, forgemcp.WithModule(mediaSrv))
Register mounts the HTTP endpoints. WithModule exposes the MCP tools to AI agents.
What you get
HTTP endpoints
| Method | Path | Auth | Description |
|---|---|---|---|
POST | /media | Author+ | Upload a file |
GET | /media/{filename} | Public | Serve a stored file |
GET | /media | Editor+ | List all files |
DELETE | /media/{id} | Editor+ | Delete a file |
MCP tools (available to AI agents via forge-mcp)
| Tool | Role | Description |
|---|---|---|
create_file | Author+ | Upload a file (base64-encoded) |
list_files | Editor+ | List all uploaded files |
get_file | Editor+ | Fetch a single file record by ID |
delete_file | Editor+ | Delete a file and its record |
Image uploads require a description field (alt text, enforced for WCAG 1.1.1).