# Putcode MCP server Endpoint: `https://putcode.dev/mcp` Transport: Streamable HTTP (stateless). JSON-RPC over POST. Server name: `putcode` ## Authentication Every request needs `Authorization: Bearer `. Without one the server answers 401 with `WWW-Authenticate: Bearer resource_metadata="https://putcode.dev/.well-known/oauth-protected-resource/mcp"`. **OAuth 2.1 (preferred).** Authorization code with PKCE (S256 only) and dynamic client registration. - Protected resource metadata: https://putcode.dev/.well-known/oauth-protected-resource/mcp - Authorization server metadata: https://putcode.dev/.well-known/oauth-authorization-server - Register: `POST https://putcode.dev/oauth/register` (RFC 7591) - Authorize: `https://putcode.dev/oauth/authorize`. The user signs in and approves on a consent page - Token: `POST https://putcode.dev/oauth/token` (`authorization_code` and `refresh_token`) - Access tokens last 24 hours. Refresh tokens rotate on every use; a used refresh token stops working. **Personal tokens.** `pc_…` tokens from https://putcode.dev/app/agents, for clients without OAuth. They don't expire until revoked. ## Permissions (scopes) - `read`: search public snippets; read the user's snippets, favorites, collections and usage notes. Always granted. - `write`: create, update and fork snippets; favorites; collections; usage notes. - `publish`: publish without waiting, if the user's publish setting is "Publish right away". - `delete`: delete snippets and collections. The user chooses permissions on the consent page. Identity always comes from the token, never from tool arguments. ## Publishing `publish_playground` follows the user's setting: - `review` (default): the request waits in the user's dashboard; the tool returns `outcome: "pending_review"`. - `allow`: publishes immediately if the connection has the `publish` permission. - `never`: refused. ## Limits Limits depend on the user's plan (https://putcode.dev/pricing). Errors over a plan limit come back with code `plan_limit`; tell the user and point them to the pricing page. - Requests: 30 per minute per connection on Free, 600 on Pro (429 with `Retry-After` above that). - HTML, CSS and JS: 100 KB each on Free, 500 KB on Pro. - Free: 100 public snippets, 10 private or unlisted, 3 collections, 2 agent connections. On Free, `publish_playground` always waits for the user's approval, and esm.sh packages only load on public snippets. ## Tools - `search_playgrounds`: query, category, tags, sort, page, limit. Full-text search over public snippets - `get_playground`: playground_id (id or slug). One snippet with its full HTML, CSS and JS - `list_popular`: category, limit. Public snippets ranked by forks, favorites and views - `list_categories`: Categories with counts - `search_components`: query, category, tags, sort, limit. Public snippets that have usage notes - `create_playground`: title, html, css, js, description, category, tags, team. Creates a private draft, optionally in a team library - `update_playground`: id + any changed fields. Records a revision - `fork_playground`: source_id. Copies a public snippet into the user's account, keeping attribution - `delete_playground`: id. Needs the delete permission; confirm with the user first - `publish_playground`: id, visibility (public | unlisted). Publishes now or waits for the user's approval - `create_collection`: name, description, visibility - `add_to_collection`: collection_id, playground_id - `remove_from_collection`: collection_id, playground_id - `list_collections`: The user's collections - `get_collection`: collection_id. A collection and its snippets in order - `get_my_playgrounds`: query, status, page. The user's own snippets - `get_my_favorites`: Snippets the user has favorited - `list_teams`: The user's teams, their role in each, and whether the team plan is active - `get_team_playgrounds`: team, query, page. Snippets in a team's shared library - `get_my_profile`: Profile, this connection's permissions, and the agent publish setting - `save_favorite`: playground_id, favorite - `save_component`: playground_id, usage, dependencies, browser_support (the browsers it was tested in). Adds or updates usage notes - `get_component`: component_id (or the snippet id/slug). Source plus usage notes - `list_my_components`: query. The user's snippets that have usage notes Results are JSON in both `content[0].text` and `structuredContent`. Snippet results include `url` (https://putcode.dev/u//s/), `edit_url` and `preview_url`. ## Resources - `putcode://categories`: the list of categories - `putcode://popular`: popular public snippets - `putcode://guidelines`: contribution guidelines (Markdown) - `putcode://my-library`: the user's snippets and favorites - `putcode://my-collections`: the user's collections ## Prompts - `create_css_component` - `improve_css_component` - `make_responsive` - `convert_design_to_css` - `review_css_accessibility` - `optimize_css` - `document_component` ## Preview sandbox Snippets render on `preview.putcode.dev` in an opaque-origin sandbox with `connect-src 'none'`: no fetch, no XHR, no WebSockets, and no access to Putcode cookies. Scripts can only load from `https://esm.sh` (npm packages as ES modules; pin versions, e.g. `https://esm.sh/gsap@3.12.5`). Web Workers, WebAssembly, WebGPU and eval are disabled, and a preview that keeps the browser busy for several seconds is paused. Google Fonts stylesheets and https images work. ## Agent activity Every tool call is logged and shown to the user at https://putcode.dev/app/agents.