@domphy/mcp 0.17.0 → 0.19.0
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 +8 -3
- package/dist/index.js +10 -3
- package/dist/index.js.map +1 -1
- package/package.json +63 -62
package/README.md
CHANGED
|
@@ -9,12 +9,17 @@ A [Model Context Protocol](https://modelcontextprotocol.io) server that gives MC
|
|
|
9
9
|
| Tool | Does |
|
|
10
10
|
| --- | --- |
|
|
11
11
|
| `domphy_list_patches` | every `@domphy/ui` patch with host tag + signature |
|
|
12
|
-
| `domphy_get_patch` | one patch's full contract (host tag, signature, doc, source) |
|
|
12
|
+
| `domphy_get_patch` | one patch's full contract (host tag, signature, props, example, doc, source) |
|
|
13
13
|
| `domphy_list_packages` | all `@domphy/*` packages with versions + descriptions |
|
|
14
|
-
| `domphy_rules` | the Domphy code-generation rules (`llms.txt`) |
|
|
14
|
+
| `domphy_rules` | the Domphy code-generation rules (`llms.txt`) to follow |
|
|
15
|
+
| `domphy_tones` | the valid tone names + theme color names for `themeColor()`/`dataTone` |
|
|
15
16
|
| `domphy_diagnose` | run [`@domphy/doctor`](https://domphy.com/docs/doctor/) on a JSON element tree and return issues to fix |
|
|
17
|
+
| `domphy_validate` | run the doctor's aggregate `validate()` — returns `{ ok, issues, summary }` with severity counts |
|
|
18
|
+
| `domphy_fix` | apply the doctor's lossless autofix — returns `{ tree, applied, report }` (only provably-safe fixes applied) |
|
|
19
|
+
| `domphy_list_app_blocks` | list the current app's OWN reusable Domphy blocks from its `app-manifest.json` |
|
|
20
|
+
| `domphy_get_app_block` | get one app block's full source + signature + jsdoc, by name |
|
|
16
21
|
|
|
17
|
-
Patch/package data is fetched live from `domphy.com` (always current with the latest release); `domphy_diagnose`
|
|
22
|
+
Patch/package/rules/tones data is fetched live from `domphy.com` (always current with the latest release); `domphy_diagnose`/`domphy_validate`/`domphy_fix` run locally, and the app-block tools read the local `app-manifest.json`.
|
|
18
23
|
|
|
19
24
|
## Use
|
|
20
25
|
|
package/dist/index.js
CHANGED
|
@@ -19,8 +19,9 @@ import {
|
|
|
19
19
|
CallToolRequestSchema,
|
|
20
20
|
ListToolsRequestSchema
|
|
21
21
|
} from "@modelcontextprotocol/sdk/types.js";
|
|
22
|
+
var SERVER_VERSION = "0.17.0";
|
|
22
23
|
var server = new Server(
|
|
23
|
-
{ name: "domphy", version:
|
|
24
|
+
{ name: "domphy", version: SERVER_VERSION },
|
|
24
25
|
{ capabilities: { tools: {} } }
|
|
25
26
|
);
|
|
26
27
|
var tools = [
|
|
@@ -152,10 +153,16 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
152
153
|
text = await getAppBlock(String(args.name));
|
|
153
154
|
break;
|
|
154
155
|
default:
|
|
155
|
-
|
|
156
|
+
return {
|
|
157
|
+
content: [{ type: "text", text: `Unknown tool: ${name}` }],
|
|
158
|
+
isError: true
|
|
159
|
+
};
|
|
156
160
|
}
|
|
157
161
|
} catch (error) {
|
|
158
|
-
|
|
162
|
+
return {
|
|
163
|
+
content: [{ type: "text", text: `Error: ${error.message}` }],
|
|
164
|
+
isError: true
|
|
165
|
+
};
|
|
159
166
|
}
|
|
160
167
|
return { content: [{ type: "text", text }] };
|
|
161
168
|
});
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { Server } from \"@modelcontextprotocol/sdk/server/index.js\";\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\nimport {\n CallToolRequestSchema,\n ListToolsRequestSchema,\n} from \"@modelcontextprotocol/sdk/types.js\";\nimport {\n diagnoseTree,\n fixTree,\n getAppBlock,\n getPatch,\n getRules,\n getTones,\n listAppBlocks,\n listPackages,\n listPatches,\n validateTree,\n} from \"./tools.js\";\n\nconst server = new Server(\n { name: \"domphy\", version:
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { Server } from \"@modelcontextprotocol/sdk/server/index.js\";\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\nimport {\n CallToolRequestSchema,\n ListToolsRequestSchema,\n} from \"@modelcontextprotocol/sdk/types.js\";\nimport {\n diagnoseTree,\n fixTree,\n getAppBlock,\n getPatch,\n getRules,\n getTones,\n listAppBlocks,\n listPackages,\n listPatches,\n validateTree,\n} from \"./tools.js\";\n\n// Keep this in lockstep with the `version` field in package.json. The build\n// (tsup/esbuild) does not inject the package version, and a JSON import of\n// package.json is awkward under this dts/bundle setup, so it is hardcoded here.\n// Bump both together on every release.\nconst SERVER_VERSION = \"0.17.0\";\n\nconst server = new Server(\n { name: \"domphy\", version: SERVER_VERSION },\n { capabilities: { tools: {} } },\n);\n\nconst tools = [\n {\n name: \"domphy_list_patches\",\n description: \"List every @domphy/ui patch with its host tag and signature.\",\n inputSchema: { type: \"object\", properties: {} },\n },\n {\n name: \"domphy_get_patch\",\n description:\n \"Get one patch's full contract: host tag, signature, props (name/type/optional/doc), example, doc, and source.\",\n inputSchema: {\n type: \"object\",\n properties: {\n name: { type: \"string\", description: \"patch name, e.g. button\" },\n },\n required: [\"name\"],\n },\n },\n {\n name: \"domphy_list_packages\",\n description: \"List all @domphy/* packages with versions and descriptions.\",\n inputSchema: { type: \"object\", properties: {} },\n },\n {\n name: \"domphy_rules\",\n description: \"Get the Domphy code-generation rules (llms.txt) to follow.\",\n inputSchema: { type: \"object\", properties: {} },\n },\n {\n name: \"domphy_tones\",\n description:\n 'Get the valid tone names and theme color names for themeColor()/dataTone (e.g. themeColor(l, \"shift-9\", \"primary\")). Use this to avoid invented tones like \"surface\"/\"text\".',\n inputSchema: { type: \"object\", properties: {} },\n },\n {\n name: \"domphy_diagnose\",\n description:\n \"Run @domphy/doctor on a JSON Domphy element tree and return issues to fix (inline-typography, void-content, unknown-tag, missing/duplicate/unstable _key, …).\",\n inputSchema: {\n type: \"object\",\n properties: {\n element: {\n type: \"string\",\n description: \"JSON of the Domphy element tree\",\n },\n },\n required: [\"element\"],\n },\n },\n {\n name: \"domphy_validate\",\n description:\n \"Run @domphy/doctor's aggregate validate() on a JSON Domphy element tree. Returns a structured report { ok, issues, summary } with severity counts.\",\n inputSchema: {\n type: \"object\",\n properties: {\n element: {\n type: \"string\",\n description: \"JSON of the Domphy element tree\",\n },\n },\n required: [\"element\"],\n },\n },\n {\n name: \"domphy_fix\",\n description:\n \"Apply @domphy/doctor's lossless autofix to a JSON Domphy element tree. Returns { tree, applied, report }; only provably-safe fixes (e.g. void-content) are applied, remaining issues are in report.\",\n inputSchema: {\n type: \"object\",\n properties: {\n element: {\n type: \"string\",\n description: \"JSON of the Domphy element tree\",\n },\n },\n required: [\"element\"],\n },\n },\n {\n name: \"domphy_list_app_blocks\",\n description:\n \"List the current app's OWN reusable Domphy blocks (name, kind, signature, file) from its app-manifest.json. Run `app-manifest.mjs` first if absent.\",\n inputSchema: { type: \"object\", properties: {} },\n },\n {\n name: \"domphy_get_app_block\",\n description:\n \"Get one app block's full source plus signature and jsdoc, by name, from the app-manifest.\",\n inputSchema: {\n type: \"object\",\n properties: {\n name: { type: \"string\", description: \"app block name, e.g. App\" },\n },\n required: [\"name\"],\n },\n },\n];\n\nserver.setRequestHandler(ListToolsRequestSchema, async () => ({ tools }));\n\nserver.setRequestHandler(CallToolRequestSchema, async (request) => {\n const { name } = request.params;\n const args = (request.params.arguments ?? {}) as Record<string, unknown>;\n let text: string;\n try {\n switch (name) {\n case \"domphy_list_patches\":\n text = await listPatches();\n break;\n case \"domphy_get_patch\":\n text = await getPatch(String(args.name));\n break;\n case \"domphy_list_packages\":\n text = await listPackages();\n break;\n case \"domphy_rules\":\n text = await getRules();\n break;\n case \"domphy_tones\":\n text = await getTones();\n break;\n case \"domphy_diagnose\":\n text = diagnoseTree(String(args.element));\n break;\n case \"domphy_validate\":\n text = validateTree(String(args.element));\n break;\n case \"domphy_fix\":\n text = fixTree(String(args.element));\n break;\n case \"domphy_list_app_blocks\":\n text = await listAppBlocks();\n break;\n case \"domphy_get_app_block\":\n text = await getAppBlock(String(args.name));\n break;\n default:\n // Unknown tool is a client error — flag it so callers can distinguish\n // it from a successful result that happens to mention \"Unknown\".\n return {\n content: [{ type: \"text\", text: `Unknown tool: ${name}` }],\n isError: true,\n };\n }\n } catch (error) {\n // A handler threw — surface a readable message AND mark the result as an\n // error so MCP clients do not treat the failure text as a normal answer.\n return {\n content: [{ type: \"text\", text: `Error: ${(error as Error).message}` }],\n isError: true,\n };\n }\n return { content: [{ type: \"text\", text }] };\n});\n\nawait server.connect(new StdioServerTransport());\n"],"mappings":";;;;;;;;;;;;;;;AACA,SAAS,cAAc;AACvB,SAAS,4BAA4B;AACrC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAkBP,IAAM,iBAAiB;AAEvB,IAAM,SAAS,IAAI;AAAA,EACjB,EAAE,MAAM,UAAU,SAAS,eAAe;AAAA,EAC1C,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,EAAE;AAChC;AAEA,IAAM,QAAQ;AAAA,EACZ;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,IACb,aAAa,EAAE,MAAM,UAAU,YAAY,CAAC,EAAE;AAAA,EAChD;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aACE;AAAA,IACF,aAAa;AAAA,MACX,MAAM;AAAA,MACN,YAAY;AAAA,QACV,MAAM,EAAE,MAAM,UAAU,aAAa,0BAA0B;AAAA,MACjE;AAAA,MACA,UAAU,CAAC,MAAM;AAAA,IACnB;AAAA,EACF;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,IACb,aAAa,EAAE,MAAM,UAAU,YAAY,CAAC,EAAE;AAAA,EAChD;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,IACb,aAAa,EAAE,MAAM,UAAU,YAAY,CAAC,EAAE;AAAA,EAChD;AAAA,EACA;AAAA,IACE,MAAM;AAAA,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AAI;AACJ,MAAI;AACF,YAAQ,MAAM;AAAA,MACZ,KAAK;AACH,eAAO,MAAM,YAAY;AACzB;AAAA,MACF,KAAK;AACH,eAAO,MAAM,SAAS,OAAO,KAAK,IAAI,CAAC;AACvC;AAAA,MACF,KAAK;AACH,eAAO,MAAM,aAAa;AAC1B;AAAA,MACF,KAAK;AACH,eAAO,MAAM,SAAS;AACtB;AAAA,MACF,KAAK;AACH,eAAO,MAAM,SAAS;AACtB;AAAA,MACF,KAAK;AACH,eAAO,aAAa,OAAO,KAAK,OAAO,CAAC;AACxC;AAAA,MACF,KAAK;AACH,eAAO,aAAa,OAAO,KAAK,OAAO,CAAC;AACxC;AAAA,MACF,KAAK;AACH,eAAO,QAAQ,OAAO,KAAK,OAAO,CAAC;AACnC;AAAA,MACF,KAAK;AACH,eAAO,MAAM,cAAc;AAC3B;AAAA,MACF,KAAK;AACH,eAAO,MAAM,YAAY,OAAO,KAAK,IAAI,CAAC;AAC1C;AAAA,MACF;AAGE,eAAO;AAAA,UACL,SAAS,CAAC,EAAE,MAAM,QAAQ,MAAM,iBAAiB,IAAI,GAAG,CAAC;AAAA,UACzD,SAAS;AAAA,QACX;AAAA,IACJ;AAAA,EACF,SAAS,OAAO;AAGd,WAAO;AAAA,MACL,SAAS,CAAC,EAAE,MAAM,QAAQ,MAAM,UAAW,MAAgB,OAAO,GAAG,CAAC;AAAA,MACtE,SAAS;AAAA,IACX;AAAA,EACF;AACA,SAAO,EAAE,SAAS,CAAC,EAAE,MAAM,QAAQ,KAAK,CAAC,EAAE;AAC7C,CAAC;AAED,MAAM,OAAO,QAAQ,IAAI,qBAAqB,CAAC;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,62 +1,63 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@domphy/mcp",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Domphy MCP server - exposes patches, packages, rules, and the doctor to MCP-capable AI agents",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"bin": {
|
|
7
|
-
"domphy-mcp": "./dist/index.js"
|
|
8
|
-
},
|
|
9
|
-
"main": "./dist/index.js",
|
|
10
|
-
"types": "./dist/index.d.ts",
|
|
11
|
-
"exports": {
|
|
12
|
-
".": {
|
|
13
|
-
"import": {
|
|
14
|
-
"types": "./dist/index.d.ts",
|
|
15
|
-
"default": "./dist/index.js"
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
"./tools": {
|
|
19
|
-
"import": {
|
|
20
|
-
"types": "./dist/tools.d.ts",
|
|
21
|
-
"default": "./dist/tools.js"
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
"
|
|
44
|
-
},
|
|
45
|
-
"
|
|
46
|
-
"@
|
|
47
|
-
"
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
"@domphy/core": "
|
|
51
|
-
},
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
"
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
"
|
|
61
|
-
|
|
62
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@domphy/mcp",
|
|
3
|
+
"version": "0.19.0",
|
|
4
|
+
"description": "Domphy MCP server - exposes patches, packages, rules, and the doctor to MCP-capable AI agents",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"domphy-mcp": "./dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"main": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"default": "./dist/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"./tools": {
|
|
19
|
+
"import": {
|
|
20
|
+
"types": "./dist/tools.d.ts",
|
|
21
|
+
"default": "./dist/tools.js"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "tsup",
|
|
27
|
+
"dev": "tsup --watch",
|
|
28
|
+
"prepublishOnly": "npm run build",
|
|
29
|
+
"test": "vitest run",
|
|
30
|
+
"test:watch": "vitest"
|
|
31
|
+
},
|
|
32
|
+
"keywords": [
|
|
33
|
+
"domphy",
|
|
34
|
+
"mcp",
|
|
35
|
+
"ai",
|
|
36
|
+
"model-context-protocol"
|
|
37
|
+
],
|
|
38
|
+
"author": "Huu Khanh Nguyen",
|
|
39
|
+
"license": "MIT",
|
|
40
|
+
"repository": {
|
|
41
|
+
"type": "git",
|
|
42
|
+
"url": "https://github.com/domphy/domphy.git",
|
|
43
|
+
"directory": "packages/mcp"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
47
|
+
"@domphy/doctor": "workspace:^"
|
|
48
|
+
},
|
|
49
|
+
"peerDependencies": {
|
|
50
|
+
"@domphy/core": "workspace:^"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@domphy/core": "workspace:*",
|
|
54
|
+
"@types/node": "^25.9.2",
|
|
55
|
+
"tsup": "^8.5.0",
|
|
56
|
+
"typescript": "^5.8.3",
|
|
57
|
+
"vitest": "^4.0.18"
|
|
58
|
+
},
|
|
59
|
+
"files": [
|
|
60
|
+
"dist",
|
|
61
|
+
"README.md"
|
|
62
|
+
]
|
|
63
|
+
}
|