publish_app
Publish a project as a forkable app on run402. Set visibility and tags to make your app discoverable to other users.
Instructions
Publish a project as a forkable app. Set visibility and tags for discoverability.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | The project ID to publish | |
| description | No | App description | |
| tags | No | Tags for discoverability (e.g. ['auth', 'rls', 'todo']) | |
| visibility | No | Visibility: public (listed in browse_apps), unlisted (accessible by ID), private (default) | |
| fork_allowed | No | Whether other users can fork this app (default: false) |
Implementation Reference
- src/tools/publish-app.ts:20-75 (handler)The main handler function that executes the publish_app tool logic. It validates the project exists, makes a POST request to the /admin/v1/projects/{project_id}/publish endpoint with description, tags, visibility, and fork_allowed parameters, and returns a formatted markdown response with the published app details.
export async function handlePublishApp(args: { project_id: string; description?: string; tags?: string[]; visibility?: string; fork_allowed?: boolean; }): Promise<{ content: Array<{ type: "text"; text: string }>; isError?: boolean }> { const project = getProject(args.project_id); if (!project) return projectNotFound(args.project_id); const res = await apiRequest(`/admin/v1/projects/${args.project_id}/publish`, { method: "POST", headers: { Authorization: `Bearer ${project.service_key}`, }, body: { description: args.description, tags: args.tags, visibility: args.visibility, fork_allowed: args.fork_allowed, }, }); if (!res.ok) return formatApiError(res, "publishing app"); const body = res.body as { id: string; project_id: string; project_name: string; description: string | null; tags: string[]; visibility: string; fork_allowed: boolean; created_at: string; }; const lines = [ `## App Published`, ``, `| Field | Value |`, `|-------|-------|`, `| version_id | \`${body.id}\` |`, `| project | \`${body.project_id}\` |`, `| name | ${body.project_name} |`, `| visibility | ${body.visibility} |`, `| forkable | ${body.fork_allowed ? "Yes" : "No"} |`, `| tags | ${body.tags.length > 0 ? body.tags.join(", ") : "-"} |`, ]; if (body.fork_allowed && body.visibility === "public") { lines.push(``); lines.push(`This app is now listed in \`browse_apps\` and can be forked by other users.`); } return { content: [{ type: "text", text: lines.join("\n") }] }; } - src/tools/publish-app.ts:6-18 (schema)Zod schema defining the input parameters for the publish_app tool: project_id (required string), description (optional string), tags (optional string array), visibility (optional enum: public/unlisted/private), and fork_allowed (optional boolean).
export const publishAppSchema = { project_id: z.string().describe("The project ID to publish"), description: z.string().optional().describe("App description"), tags: z.array(z.string()).optional().describe("Tags for discoverability (e.g. ['auth', 'rls', 'todo'])"), visibility: z .enum(["public", "unlisted", "private"]) .optional() .describe("Visibility: public (listed in browse_apps), unlisted (accessible by ID), private (default)"), fork_allowed: z .boolean() .optional() .describe("Whether other users can fork this app (default: false)"), }; - src/index.ts:250-255 (registration)Registration of the publish_app tool with the MCP server. Registers the tool name, description, schema, and handler function.
server.tool( "publish_app", "Publish a project as a forkable app. Set visibility and tags for discoverability.", publishAppSchema, async (args) => handlePublishApp(args), );