@xoong/mcp 0.0.39 → 0.0.42

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 +5 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xoong/mcp",
3
- "version": "0.0.39",
3
+ "version": "0.0.42",
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.39"
14
+ "@xoong/cli": "0.0.42"
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.',
@@ -102,7 +106,7 @@ export function createServer(ctx) {
102
106
  const fail = (code, message) => ({ jsonrpc: '2.0', id: msg.id, error: { code, message } });
103
107
  try {
104
108
  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.' });
109
+ 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
110
  case 'ping': return reply({});
107
111
  case 'tools/list': return reply({ tools: TOOLS });
108
112
  case 'tools/call': return reply(await callTool(msg.params?.name, msg.params?.arguments));