typst-mcp 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,11 +1,15 @@
1
1
  <div align="center">
2
2
 
3
- # Typst Web MCP (`typst-web-mcp`)
3
+ # Typst Web MCP
4
4
 
5
- **Model Context Protocol (MCP) Server for [`https://typst.app`](https://typst.app) Cloud Collaboration, Real-Time Yjs CRDT Editing & Compiler Diagnostics**
5
+ **Model Context Protocol (MCP) server for [`https://typst.app`](https://typst.app) — cloud projects, Yjs CRDT editing, and Typst compiler diagnostics**
6
+
7
+ Install from npm as [`typst-mcp`](https://www.npmjs.com/package/typst-mcp). Source repo: [`typst-web-mcp`](https://github.com/caphefalumi/typst-web-mcp).
6
8
 
7
9
  [![npm version](https://img.shields.io/npm/v/typst-mcp.svg?style=flat-square)](https://www.npmjs.com/package/typst-mcp)
10
+ [![Downloads](https://img.shields.io/npm/dt/typst-mcp.svg?style=flat-square)](https://www.npmjs.com/package/typst-mcp)
8
11
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square)](./LICENSE)
12
+ [![CI](https://github.com/caphefalumi/typst-web-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/caphefalumi/typst-web-mcp/actions/workflows/ci.yml)
9
13
  [![Node.js Package](https://github.com/caphefalumi/typst-web-mcp/actions/workflows/npm-publish.yml/badge.svg)](https://github.com/caphefalumi/typst-web-mcp/actions/workflows/npm-publish.yml)
10
14
  [![Runtime: Bun](https://img.shields.io/badge/Runtime-Bun_%E2%89%A51.2-f9f1e1?style=flat-square&logo=bun&logoColor=black)](https://bun.sh)
11
15
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.8-3178C6?style=flat-square&logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
@@ -33,7 +37,7 @@
33
37
 
34
38
  ```mermaid
35
39
  flowchart LR
36
- Agent["AI Agent\n(Pi / Claude / Cursor)"] <-->|"JSON-RPC (stdio)"| MCP["typst-web-mcp\n(Bun / TypeScript)"]
40
+ Agent["AI Agent\n(Pi / Claude / Cursor)"] <-->|"JSON-RPC (stdio)"| MCP["typst-mcp\n(Node / TypeScript)"]
37
41
  MCP <-->|"GraphQL (/v1/graphql)\n+ X-Typst-Preflight"| API["https://api.typst.app"]
38
42
  MCP <-->|"REST Yjs & Blobs\n(/v1/files/:pid/:fid/yjs)"| API
39
43
  MCP <-->|"Binary lib0 WebSocket\n(wss://api.typst.app/editing/v3)"| WS["typst.app Real-Time Sync"]
@@ -82,7 +86,7 @@ See [`docs/PROTOCOL.md`](./docs/PROTOCOL.md) for the complete reverse-engineered
82
86
  npx -y typst-mcp
83
87
  ```
84
88
 
85
- Use that same `npx -y typst-mcp` command in MCP config (see below). `-y` skips the install prompt.
89
+ Runs the published [`typst-mcp`](https://www.npmjs.com/package/typst-mcp) package (Node `>= 18`). Use the same command in MCP config below. `-y` skips the npx install prompt.
86
90
 
87
91
  **From source (development):**
88
92
 
@@ -125,15 +129,25 @@ bun run build
125
129
  # Typecheck with strict TypeScript
126
130
  bun run typecheck
127
131
 
128
- # Run full unit, mock server, and live api.typst.app protocol test suite
132
+ # Full suite (includes test/smoke.test.ts: dist bin + npx -y typst-mcp)
129
133
  bun test
134
+
135
+ # Smoke only (same as pi npx MCP config)
136
+ bun run test:smoke
130
137
  ```
131
138
 
139
+ Push/PR to `main` runs [`.github/workflows/ci.yml`](./.github/workflows/ci.yml) (`bun ci`, build, typecheck, `bun test`).
140
+
132
141
  ### Publishing to npm
133
142
 
134
- Matches [Canvas-CLI](https://github.com/caphefalumi/Canvas-CLI): GitHub **Release created** (or manual **workflow_dispatch**) runs [`.github/workflows/npm-publish.yml`](./.github/workflows/npm-publish.yml) — `bun ci`, `bun run build`, `npm publish` with OIDC environment `npm-publish` on npmjs.com.
143
+ Same flow as [Canvas-CLI](https://github.com/caphefalumi/Canvas-CLI):
144
+
145
+ 1. Bump `version` in `package.json` (must not match a version already on npm).
146
+ 2. Commit, push, and create a GitHub **Release** for that tag — or run **Actions → Publish → Run workflow** (`workflow_dispatch`).
147
+
148
+ [`.github/workflows/npm-publish.yml`](./.github/workflows/npm-publish.yml) runs the same checks as CI (`bun test`, including smoke) in a `test` job; the `publish` job runs only if that passes, on the `npm-publish` environment: `bun ci`, `bun run build`, then `npm publish --access public` via [npm trusted publishing](https://docs.npmjs.com/trusted-publishers) (OIDC). The publish step clears `NODE_AUTH_TOKEN` so the CLI uses GitHub OIDC instead of a stale token from `setup-node`.
135
149
 
136
- **One-time (new package name):** on [npmjs.com](https://www.npmjs.com) add a **Trusted Publisher** for package `typst-mcp` — GitHub Actions, org/user `caphefalumi`, repo `typst-web-mcp`, workflow `npm-publish.yml`, environment `npm-publish`, allow **npm publish**. First successful CI publish must happen within 2 days of creating that config.
150
+ **Trusted publisher (maintainers):** package [`typst-mcp`](https://www.npmjs.com/package/typst-mcp) → Settings → Trusted publishing → GitHub Actions — user/org `caphefalumi`, repo `typst-web-mcp`, workflow file `npm-publish.yml`, environment `npm-publish`, allow **npm publish**.
137
151
 
138
152
  ### Project Structure
139
153
 
@@ -153,7 +167,7 @@ typst-web-mcp/
153
167
  │ │ └── typst-client.ts # TypstCloudClient (REST, GraphQL, WebSocket v3, Compiler facade)
154
168
  │ ├── tools/
155
169
  │ │ └── definitions.ts # MCP JSON Schema definitions for all 16 tools
156
- │ └── index.ts # MCP stdio server entrypoint & tool dispatcher
170
+ │ └── index.ts # MCP stdio server entrypoint (dev); npm bin runs dist/index.js
157
171
  ├── test/
158
172
  │ └── typst-mcp.test.ts # 7 test suites (57 assertions) covering codecs, CRDTs & E2E
159
173
  ├── LICENSE # MIT License
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ import "./node-shim.js";
2
3
  import { readFileSync } from "node:fs";
3
4
  import { resolve } from "node:path";
4
5
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
@@ -0,0 +1,5 @@
1
+ // Node 22+ installs a localStorage getter that warns on access; lib0 probes it at load time.
2
+ if (Object.getOwnPropertyDescriptor(globalThis, "localStorage")) {
3
+ Reflect.deleteProperty(globalThis, "localStorage");
4
+ }
5
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typst-mcp",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Model Context Protocol (MCP) server for https://typst.app/ cloud projects, Yjs real-time text editing, asset management, and Typst compiler diagnostics",
5
5
  "keywords": [
6
6
  "mcp",
@@ -41,6 +41,7 @@
41
41
  "dev": "bun run src/index.ts",
42
42
  "typecheck": "tsc --noEmit",
43
43
  "test": "bun test",
44
+ "test:smoke": "bun test test/smoke.test.ts",
44
45
  "prepublishOnly": "bun run build"
45
46
  },
46
47
  "dependencies": {