@xoong/mcp 0.0.41 → 0.0.43

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.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/src/server.js +6 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xoong/mcp",
3
- "version": "0.0.41",
3
+ "version": "0.0.43",
4
4
  "description": "MCP server for xoong: gives AI assistants the spec (llms.txt), the API's operations, `xoong check` and error explanations over stdio.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "license": "MIT",
13
13
  "dependencies": {
14
- "@xoong/cli": "0.0.41"
14
+ "@xoong/cli": "0.0.43"
15
15
  },
16
16
  "files": [
17
17
  "src"
@@ -34,7 +34,7 @@
34
34
  "bugs": {
35
35
  "url": "https://github.com/fpt-duongtx/xoong/issues"
36
36
  },
37
- "homepage": "https://github.com/fpt-duongtx/xoong#readme",
37
+ "homepage": "https://fpt-duongtx.github.io/xoong/",
38
38
  "publishConfig": {
39
39
  "access": "public"
40
40
  }
package/src/server.js CHANGED
@@ -10,12 +10,16 @@
10
10
  * explain_error what an XO code means and how to fix it
11
11
  * search_docs find a term in the docs folder (when one is configured)
12
12
  */
13
+ import { readFileSync } from 'node:fs';
13
14
  import { readFile, readdir } from 'node:fs/promises';
14
15
  import { join } from 'node:path';
15
16
  import { checkHtml, checkScript } from '@xoong/cli/check';
16
17
 
17
18
  export const PROTOCOL_VERSION = '2024-11-05';
18
19
 
20
+ /** The version of this package, read from its own package.json (it ships with every npm package). */
21
+ export const VERSION = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version;
22
+
19
23
  /** Meaning and fix for every code `xoong check` and `xoong doctor` can print. Kept in step with check.js by a test. */
20
24
  export const EXPLANATIONS = {
21
25
  XO201: 'An operation name in xo-click, xo-submit, <xo-view get> or <xo-form op> does not exist in the synced API. Use the closest name the message gives, or run `xoong sync` if the API changed.',
@@ -26,6 +30,7 @@ export const EXPLANATIONS = {
26
30
  XO220: 'xo-submit is only valid on a <form>. Move the attribute to the form element.',
27
31
  XO221: 'xo-each, xo-if or xo-body has no path. Give it one, for example xo-each="items".',
28
32
  XO230: 'An xo-* element or attribute that xoong does not define, usually a typo. The message names the closest valid one.',
33
+ XO243: 'An <img> whose src or srcset has {data} inside an <xo-view> is requested by the browser with the literal text before the data is bound. Use <xo-image src="{path}" alt="..."> instead.',
29
34
  XO242: '<xo-image> has no alt attribute. Describe the image, or write alt="" when it is only decoration.',
30
35
  XO240: 'A button or link triggered by xo-click has no accessible name. Add visible text or aria-label.',
31
36
  XO241: 'xo-click is on an element that keyboards cannot reach. Use a <button>, or add role="button" and tabindex="0".',
@@ -102,7 +107,7 @@ export function createServer(ctx) {
102
107
  const fail = (code, message) => ({ jsonrpc: '2.0', id: msg.id, error: { code, message } });
103
108
  try {
104
109
  switch (msg.method) {
105
- case 'initialize': return reply({ protocolVersion: PROTOCOL_VERSION, capabilities: { tools: {} }, serverInfo: { name: 'xoong', version: '0.0.1' }, instructions: 'Call get_spec first. Write xoong screens, then call check on the HTML and fix every error from its message.' });
110
+ case 'initialize': return reply({ protocolVersion: PROTOCOL_VERSION, capabilities: { tools: {} }, serverInfo: { name: 'xoong', version: VERSION }, instructions: 'Call get_spec first. Write xoong screens, then call check on the HTML and fix every error from its message.' });
106
111
  case 'ping': return reply({});
107
112
  case 'tools/list': return reply({ tools: TOOLS });
108
113
  case 'tools/call': return reply(await callTool(msg.params?.name, msg.params?.arguments));