@schemacast/mcp 0.5.0 → 0.5.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
@@ -4,41 +4,39 @@ Stdio MCP server with a `visualize_json` tool and a bundled MCP Apps UI.
4
4
 
5
5
  **0.x — API may change.**
6
6
 
7
- ## Install / build
7
+ ## Run with npx
8
8
 
9
- From the monorepo root:
9
+ Prefer pinning a version so hosts stay reproducible:
10
10
 
11
11
  ```bash
12
- pnpm --filter @schemacast/mcp build
12
+ npx -y @schemacast/mcp@0.5.2
13
13
  ```
14
14
 
15
- Run the server entry at `packages/mcp/dist/main.js` (bin name: `schemacast-mcp`).
16
-
17
- ## Library usage
18
-
19
- ```ts
20
- import { registerAutoVisualTool } from '@schemacast/mcp';
15
+ (`npx -y @schemacast/mcp` also works and tracks latest.)
21
16
 
22
- registerAutoVisualTool(server, 'existing_report', existingToolConfig, existingHandler);
23
- ```
17
+ On start the process prints one stderr line, for example `schemacast-mcp 0.5.2 ready (stdio)`, and never writes to stdout (stdout is reserved for MCP stdio).
24
18
 
25
19
  ## Host configuration
26
20
 
27
- Replace the path with the absolute location of `dist/main.js` on your machine.
28
-
29
21
  Claude Desktop and Cursor (`mcpServers`):
30
22
 
31
23
  ```json
32
24
  {
33
25
  "mcpServers": {
34
26
  "schemacast": {
35
- "command": "node",
36
- "args": ["/absolute/path/to/schemacast/packages/mcp/dist/main.js"]
27
+ "command": "npx",
28
+ "args": ["-y", "@schemacast/mcp@0.5.2"]
37
29
  }
38
30
  }
39
31
  }
40
32
  ```
41
33
 
34
+ Claude Code:
35
+
36
+ ```bash
37
+ claude mcp add schemacast -- npx -y @schemacast/mcp@0.5.2
38
+ ```
39
+
42
40
  VS Code (`.vscode/mcp.json`):
43
41
 
44
42
  ```json
@@ -46,11 +44,34 @@ VS Code (`.vscode/mcp.json`):
46
44
  "servers": {
47
45
  "schemacast": {
48
46
  "type": "stdio",
49
- "command": "node",
50
- "args": ["/absolute/path/to/schemacast/packages/mcp/dist/main.js"]
47
+ "command": "npx",
48
+ "args": ["-y", "@schemacast/mcp@0.5.2"]
51
49
  }
52
50
  }
53
51
  }
54
52
  ```
55
53
 
56
54
  After updating, restart the host (Claude Desktop) or start a new request (Cursor/VS Code).
55
+
56
+ ### From a clone
57
+
58
+ Build locally, then point the host at the built entry:
59
+
60
+ ```bash
61
+ pnpm --filter @schemacast/mcp build
62
+ ```
63
+
64
+ ```json
65
+ {
66
+ "command": "node",
67
+ "args": ["/absolute/path/to/schemacast/packages/mcp/dist/main.js"]
68
+ }
69
+ ```
70
+
71
+ ## Library usage
72
+
73
+ ```ts
74
+ import { registerAutoVisualTool } from '@schemacast/mcp';
75
+
76
+ registerAutoVisualTool(server, 'existing_report', existingToolConfig, existingHandler);
77
+ ```
package/dist/main.js CHANGED
@@ -1,11 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
  import { readFile } from 'node:fs/promises';
3
3
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
4
+ import { PACKAGE_VERSION } from './package-version.js';
4
5
  import { createMcpServer } from './server.js';
6
+ import { writeMcpReadyLine } from './startup.js';
5
7
  async function main() {
6
8
  const uiResourceHtml = await readFile(new URL('./ui.html', import.meta.url), 'utf8');
7
9
  const server = createMcpServer(uiResourceHtml);
8
10
  await server.connect(new StdioServerTransport());
11
+ writeMcpReadyLine(PACKAGE_VERSION);
9
12
  }
10
13
  main().catch((error) => {
11
14
  console.error(error);
package/dist/server.js CHANGED
@@ -26,7 +26,9 @@ const FIELD_HINTS_SCHEMA = z.object({
26
26
  });
27
27
  const PREFER_VIEW_DESCRIPTION = 'View id to show first, e.g. "bar-chart". Only views that fit the data are accepted; otherwise the reason is reported in assumptions.';
28
28
  const FIELD_HINTS_DESCRIPTION = 'Field names that override inference: label, group, value, x, y (string or list), source, target. Unknown or non-numeric fields are ignored and explained in assumptions. Field roles by view: x = category/horizontal axis of bar-chart, line-chart, pie-chart; y or value = numeric series (value is a single y); label = card title in kanban, detail-card and timeline, and the category of bar-chart and pie-chart; group = kanban lane, or the field whose values become one line each on a line-chart (each x and group pair must be unique); source/target = node-graph edge ends. A kanban card label is not a chart category: use x for a chart category. With x or label plus y or value, a bar-chart is built even when inference rejected it. A y/value hint may name a lat/lng field, which is otherwise excluded from metrics.';
29
+ const VISUALIZE_JSON_IDENTITY = `schemacast ${PACKAGE_VERSION} (@schemacast/mcp on npm) by Yosr AI. Deterministic, no AI model.`;
29
30
  const VISUALIZE_JSON_DESCRIPTION = [
31
+ VISUALIZE_JSON_IDENTITY,
30
32
  'Picks the best visual for JSON data and returns a VisualSpec rendered by the linked UI.',
31
33
  'The data must be complete, valid JSON. Partial or streaming JSON input is not accepted.',
32
34
  'A bare string must be sent as quoted JSON (with its double quotes), not as raw text.',
@@ -51,7 +53,7 @@ const VISUALIZE_JSON_DESCRIPTION = [
51
53
  */
52
54
  export function createMcpServer(uiResourceHtml) {
53
55
  const server = new McpServer({
54
- name: 'schemacast',
56
+ name: 'schemacast-mcp',
55
57
  version: PACKAGE_VERSION,
56
58
  });
57
59
  registerAppTool(server, 'visualize_json', {
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Stderr-only startup notice so hosts can see the server is up without touching the MCP stdio stream.
3
+ *
4
+ * @example
5
+ * ```ts
6
+ * writeMcpReadyLine('0.5.2');
7
+ * // stderr: schemacast-mcp 0.5.2 ready (stdio)
8
+ * ```
9
+ */
10
+ export declare function writeMcpReadyLine(version: string, write?: (chunk: string) => void): void;
11
+ //# sourceMappingURL=startup.d.ts.map
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Stderr-only startup notice so hosts can see the server is up without touching the MCP stdio stream.
3
+ *
4
+ * @example
5
+ * ```ts
6
+ * writeMcpReadyLine('0.5.2');
7
+ * // stderr: schemacast-mcp 0.5.2 ready (stdio)
8
+ * ```
9
+ */
10
+ export function writeMcpReadyLine(version, write = (chunk) => {
11
+ process.stderr.write(chunk);
12
+ }) {
13
+ write(`schemacast-mcp ${version} ready (stdio)\n`);
14
+ }
15
+ //# sourceMappingURL=startup.js.map