gist.pubCLI & HTTP docsagents.md

Publish from your agent.

Connect to gist.pub over MCP to publish files, read your gists, and edit them in place. The server is hosted: no local binary or server process is needed.

Agents: start here. Connect with the endpoint below, let your MCP client handle sign-in, then discover tool schemas with tools/list. Read local files yourself and send their contents; the server cannot read your filesystem.

Connect

https://app.gist.pub/api/mcp

Choose a remote Streamable HTTP MCP server in your client and enter this URL. A client that accepts JSON server configuration can use:

{
  "mcpServers": {
    "gist-pub": {
      "url": "https://app.gist.pub/api/mcp"
    }
  }
}

The gist.pub Codex plugin bundles this connection and agent instructions. Once connected, try “List my gists” or “Publish this markdown file to gist.pub.”

This is a stateless MCP endpoint: clients use POST for protocol requests. GET and DELETE return 405; there is no persistent event stream or session ID. Opening the endpoint in a browser does not start a connection.

Authentication

Your MCP client opens gist.pub sign-in in a browser. Sign in with GitHub or email and approve the connection. The gists scope lets the client publish and manage the connected account’s gists, including work from other signed-in machines.

The client handles OAuth discovery, dynamic registration, authorization-code exchange with mandatory S256 PKCE, and token refresh. Access tokens last one hour; rotating refresh tokens last 30 days. Credentials belong in the client’s credential store, never in tool arguments, published files, or chat messages.

Unauthenticated POST requests return 401 with a WWW-Authenticate discovery header. Scripts can instead send an existing CLI edit token as Authorization: Bearer <token>. Browser session cookies do not authenticate MCP requests. Use gist_whoami to check which identity is connected.

Tool reference

Tools that take url accept a secret gist URL, a named https://gist.pub/@handle/name URL, or its 16-character secret. Discover exact parameter schemas with tools/list.

Publish and replace

Call gist_preview with files to inspect the plan, then gist_publish with the same files to publish. These examples are tool arguments, not standalone HTTP request bodies:

{
  "files": [
    {
      "path": "report.md",
      "content": "# Report\nThe release is ready.",
      "encoding": "utf8"
    }
  ],
  "title": "Release report"
}

The result contains the published URL. Supported inputs include markdown, HTML, CSV/TSV, JSON, images, and static sites. File paths are relative names inside the gist. Binary files use encoding: "base64" with standard padded base64.

To replace a gist, add update with its current URL. This preserves the address and removes files absent from the new version. Extract archives on the client; respect .gitignore when collecting folders. Hidden and build files are skipped by default. Include hidden files with all: true only when requested.

Edit existing content

Read with gist_read first. For a CSV or TSV, call gist_set:

{
  "url": "https://gist.pub/k3f9x2mqp7ad4nrt",
  "target": "B2",
  "values": [
    "42"
  ]
}

Targets are B2 for a cell, 2 for a whole row,B for a column (header first), or + to append a row. Row 1 is the header. Values are supplied as an array of strings.

For JSON, use a path such as .port or .servers[0].host:

{
  "url": "https://gist.pub/k3f9x2mqp7ad4nrt",
  "target": ".port",
  "values": [
    "8080"
  ]
}

JSON values parse as JSON when possible; set string: true to preserve a literal string. gist_del takes url and target: it clears a cell or deletes a row, column, or JSON path. Row and column deletion shifts subsequent entries. To delete the whole gist, use gist_remove.

Larger uploads

  1. Call gist_publish_start with kind and a files manifest of {path, size} entries; sizes are bytes. Use canonical source names: source.md, source.json,source.csv / source.tsv, index.html, or site paths.
  2. Keep the returned secret and uploadToken. The token is scoped to this publish and identity and expires after 15 minutes.
  3. Call gist_publish_upload per file with that secret and token plus path, content, and encoding.
  4. After all uploads succeed, call gist_publish_finish with the same secret and token, kind, and files as an array of uploaded path strings. Include your title and, for JSON, the intended editable flag.

For binary files near the per-file limit, base64 will exceed the MCP request cap. Send raw bytes with PUT /api/publish/upload?secret=<secret>&path=<encoded-path> on https://app.gist.pub, using the scoped upload token as the bearer credential, then finish through MCP. Never finish an incomplete upload.

Limits and safe use