openpencil/packages/mcp/package.json
Danila Poyarkov e532f616ba
refactor!: move shared primitives below dom-css and core (#771)
* refactor!: move shared primitives below dom-css and core

dom-css depended on core for color conversion, base64 helpers, text
direction, and web-font assets, so core could not use dom-css and every
caller special-cased HTML and Tailwind output.

Color conversion and management, base64 helpers, and text/layout
direction now live in scene-graph under `color`, `bytes`, and
`text-direction`. dom-css takes web-font resolution as an injected
`fonts` option and owns the font face types, so it depends only on
scene-graph and core can depend on it.

BREAKING CHANGE: `@open-pencil/core/color` and `@open-pencil/core/bytes`
are removed, and the direction helpers are no longer exported from
`@open-pencil/core/text`; import them from `@open-pencil/scene-graph`
subpaths. `exportHTMLBundle` takes a font resolver in `fonts` instead of
`'assets'`.

* fix(tools): import color parsing from scene-graph in visual bisect

* fix(mcp): declare the scene-graph dependency

MCP imports `@open-pencil/scene-graph/bytes` since base64 helpers moved
there, but only reached scene-graph through core, so isolated installs
and package checks depended on transitive resolution.

* refactor!: use js-base64 directly instead of a base64 wrapper

Base64 helpers had moved into scene-graph only to sit below dom-css,
but they are a thin wrapper over js-base64 and unrelated to the graph;
fig already called js-base64 directly.

Callers use js-base64 and check `isValid` where input comes from outside
(clipboard, imported HTML, tool arguments, the plugin API). A new
`open-pencil/no-hand-rolled-base64` lint rule rejects atob, btoa, and
Buffer Base64 conversions, and AGENTS.md records the convention.

BREAKING CHANGE: `@open-pencil/core/bytes` is removed; use `js-base64`.

* fix(dom-css): keep images with invalid Base64 inline in HTML export

`exportHTMLBundle` accepts documents parsed from outside HTML, and
js-base64 drops characters it cannot decode, so extracting an invalid
image data URL wrote different bytes. Such images now stay inline.
2026-09-26 11:39:11 +04:00

82 lines
2 KiB
JSON

{
"name": "@open-pencil/mcp",
"version": "0.15.1",
"license": "MIT",
"type": "module",
"imports": {
"#mcp/*": {
"types": "./src/*.ts",
"bun": "./src/*.ts",
"default": "./dist/*.mjs"
}
},
"main": "./dist/server.mjs",
"exports": {
".": {
"types": "./dist/server.d.mts",
"import": "./dist/server.mjs",
"default": "./dist/server.mjs"
},
"./stdio": {
"types": "./dist/stdio.d.mts",
"import": "./dist/stdio.mjs",
"default": "./dist/stdio.mjs"
},
"./transport": {
"types": "./dist/transport.d.mts",
"bun": "./src/transport/paths.ts",
"import": "./dist/transport.mjs",
"default": "./dist/transport.mjs"
},
"./discovery": {
"types": "./dist/discovery.d.mts",
"bun": "./src/transport/discovery.ts",
"import": "./dist/discovery.mjs",
"default": "./dist/discovery.mjs"
},
"./tools": {
"types": "./dist/tools.d.mts",
"bun": "./src/tool/index.ts",
"import": "./dist/tools.mjs",
"default": "./dist/tools.mjs"
}
},
"bin": {
"openpencil-mcp": "./dist/stdio.mjs",
"openpencil-mcp-http": "./dist/index.mjs"
},
"files": [
"dist",
"src"
],
"scripts": {
"build": "bunx tsdown --config tsdown.config.ts",
"prepublishOnly": "bun run build"
},
"repository": {
"type": "git",
"url": "git+https://github.com/open-pencil/open-pencil.git",
"directory": "packages/mcp"
},
"publishConfig": {
"access": "public",
"provenance": true
},
"dependencies": {
"@hono/node-server": "^1.19.17",
"@modelcontextprotocol/server": "^2.0.0",
"@open-pencil/core": "workspace:*",
"@open-pencil/scene-graph": "workspace:*",
"@valibot/to-json-schema": "^1.8.0",
"hono": "^4.13.2",
"js-base64": "^3.9.3",
"package-manager-detector": "^1.8.0",
"valibot": "^1.4.2",
"ws": "^8.21.3"
},
"devDependencies": {
"@types/node": "^25.9.5",
"@types/ws": "^8.18.1"
}
}