-
Notifications
You must be signed in to change notification settings - Fork 7
add claude desktop extension #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
0ada41b
feat: add config-only Claude Desktop MCPB for Paper CLI
itsdouges cbc5bce
chore: move
itsdouges 605a9cc
chore: readme
itsdouges 94f3f2d
chore: rename
itsdouges 8581cd1
chore: validate
itsdouges 50b3919
chore: copy into manifest
itsdouges 3decbd2
chore: update readme
itsdouges dbda5a1
chore: add build
itsdouges ffa6a78
chore: update
itsdouges a95c064
feat: assets / extra meta
itsdouges 78c32bc
chore: add platform override for win32
itsdouges b58c156
chore: commit dist
itsdouges 01cf020
chore: allow mcpb
itsdouges de49c44
fix: validate mcpb
itsdouges ce4e0fb
chore: include
itsdouges ef83f52
chore: remove win32 override
itsdouges 978b6b2
fix: review
itsdouges File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,3 +17,5 @@ jobs: | |
| - run: bun install | ||
|
|
||
| - run: bun run build | ||
|
|
||
| - run: bun ./scripts/validate-mcpb-artifact.mjs | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../plugins/paper-desktop/README.md | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../plugins/paper-desktop/assets |
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| { | ||
| "$schema": "https://raw.githubusercontent.com/anthropics/mcpb/main/schemas/mcpb-manifest-v0.4.schema.json", | ||
| "manifest_version": "0.4", | ||
| "name": "paper", | ||
| "display_name": "Paper", | ||
| "version": "0.1.0", | ||
| "description": "Design on a canvas that Claude can read and write to — built on web standards.", | ||
| "author": { | ||
| "name": "Paper", | ||
| "email": "team@paper.design", | ||
| "url": "https://paper.design" | ||
| }, | ||
| "homepage": "https://paper.design", | ||
| "documentation": "https://paper.design/docs/mcp", | ||
| "support": "mailto:team@paper.design", | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/paper-design/agent-plugins" | ||
| }, | ||
| "license": "MIT", | ||
| "privacy_policies": ["https://paper.design/privacy"], | ||
| "icon": "assets/logo@512w.png", | ||
| "screenshots": [ | ||
| "assets/barley-layout.png", | ||
| "assets/barley-feedback.png", | ||
| "assets/barley-responsive-frames.png" | ||
| ], | ||
| "keywords": [ | ||
| "paper", | ||
| "design", | ||
| "ui", | ||
| "canvas", | ||
| "html", | ||
| "css", | ||
| "design-to-code", | ||
| "code-to-design", | ||
| "mcp", | ||
| "design-system" | ||
| ], | ||
| "server": { | ||
| "type": "binary", | ||
| "entry_point": "${HOME}/.paper/bin/paper", | ||
| "mcp_config": { | ||
| "command": "${HOME}/.paper/bin/paper", | ||
| "args": ["mcp"] | ||
| } | ||
| }, | ||
| "compatibility": { | ||
| "claude_desktop": ">=0.1.0", | ||
| "platforms": ["darwin", "win32", "linux"] | ||
| }, | ||
| "tools_generated": true | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "name": "@paper/claude-desktop-mcpb", | ||
| "private": true, | ||
| "type": "module", | ||
| "scripts": { | ||
| "pack": "bun ./scripts/pack.ts" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| #!/usr/bin/env bun | ||
| /** | ||
| * Pack a config-only MCPB (zip with manifest.json at archive root). | ||
| * | ||
| * Injects README.md as long_description at pack time — the source | ||
| * manifest.json is left unchanged. | ||
| * | ||
| * Bundles icon/screenshot paths referenced by the built manifest (resolving | ||
| * symlinks into the archive). | ||
| * | ||
| * Uses a plain zip instead of `mcpb pack` because the binary entry_point is an | ||
| * external `${HOME}/.paper/bin/paper` path installed by Paper Desktop — not a | ||
| * file inside the bundle. | ||
| */ | ||
| import { | ||
| chmod, | ||
| cp, | ||
| mkdir, | ||
| readdir, | ||
| rm, | ||
| stat, | ||
| utimes, | ||
| writeFile, | ||
| } from "node:fs/promises"; | ||
| import { dirname, join } from "node:path"; | ||
| import { fileURLToPath } from "node:url"; | ||
| import { $ } from "bun"; | ||
| import { buildMcpbManifest } from "../../../scripts/mcpb-manifest.mjs"; | ||
|
|
||
| /** DOS-era zip epoch — fixed so rebuilds are bit-identical across runs. */ | ||
| const ZIP_EPOCH = new Date(Date.UTC(1980, 0, 1, 0, 0, 0)); | ||
| /** Fixed Unix modes so Info-ZIP external attributes ignore umask / cp defaults. */ | ||
| const FILE_MODE = 0o644; | ||
| const DIR_MODE = 0o755; | ||
|
|
||
| async function normalizeStaging(dir: string) { | ||
| await chmod(dir, DIR_MODE); | ||
| await utimes(dir, ZIP_EPOCH, ZIP_EPOCH); | ||
| for (const name of await readdir(dir)) { | ||
| const path = join(dir, name); | ||
| if ((await stat(path)).isDirectory()) { | ||
| await normalizeStaging(path); | ||
| } else { | ||
| await chmod(path, FILE_MODE); | ||
| await utimes(path, ZIP_EPOCH, ZIP_EPOCH); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| const extensionDir = join(dirname(fileURLToPath(import.meta.url)), ".."); | ||
| const repoRoot = join(extensionDir, "../.."); | ||
| const distDir = join(extensionDir, "dist"); | ||
| const stageDir = join(distDir, "stage"); | ||
| const outFile = join(distDir, "paper.mcpb"); | ||
| const builtManifestPath = join(stageDir, "manifest.json"); | ||
|
|
||
| const { manifest, readmeLabel } = buildMcpbManifest(extensionDir, { | ||
| root: repoRoot, | ||
| }); | ||
|
|
||
| const assetPaths = [ | ||
| ...(typeof manifest.icon === "string" ? [manifest.icon] : []), | ||
| ...(Array.isArray(manifest.screenshots) ? manifest.screenshots : []), | ||
| ]; | ||
|
|
||
| await rm(distDir, { recursive: true, force: true }); | ||
| await mkdir(stageDir, { recursive: true }); | ||
| await writeFile(builtManifestPath, `${JSON.stringify(manifest, null, 2)}\n`); | ||
|
|
||
| for (const rel of assetPaths) { | ||
| if (typeof rel !== "string" || rel.includes("..") || rel.startsWith("/")) { | ||
| console.error(`Refusing to pack unsafe asset path: ${rel}`); | ||
| process.exit(1); | ||
| } | ||
| const src = join(extensionDir, rel); | ||
| const dest = join(stageDir, rel); | ||
| await mkdir(dirname(dest), { recursive: true }); | ||
| await cp(src, dest); | ||
| } | ||
|
|
||
| await normalizeStaging(stageDir); | ||
|
|
||
| // TZ=UTC so DOS timestamps in the zip are timezone-independent (CI is UTC). | ||
| const result = await $`zip -r -X ${outFile} manifest.json ${assetPaths}` | ||
| .cwd(stageDir) | ||
| .env({ ...process.env, TZ: "UTC" }) | ||
| .nothrow(); | ||
|
cursor[bot] marked this conversation as resolved.
|
||
|
|
||
| if (result.exitCode !== 0) { | ||
| console.error(result.stderr.toString() || result.stdout.toString()); | ||
| process.exit(result.exitCode ?? 1); | ||
| } | ||
|
|
||
| // Keep a copy of the built manifest next to the .mcpb for inspection | ||
| await cp(builtManifestPath, join(distDir, "manifest.json")); | ||
| await rm(stageDir, { recursive: true, force: true }); | ||
|
|
||
| const listing = await $`unzip -l ${outFile}`.text(); | ||
| console.log(listing.trimEnd()); | ||
| console.log(`\nInjected long_description from ${readmeLabel}`); | ||
| console.log(`Wrote ${outFile}`); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.