aixischeck-mcp 0.1.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 +72 -0
- package/dist/index.js +73 -0
- package/dist/lib.js +43 -0
- package/package.json +36 -0
package/README.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# aixischeck-mcp
|
|
2
|
+
|
|
3
|
+
A local [MCP](https://modelcontextprotocol.io) server that lets Claude Desktop create
|
|
4
|
+
documents straight into your [AIxisCheck](https://aixischeck.com) workspace — no manual
|
|
5
|
+
upload. Generate an HTML one-pager in chat, and it lands in your workspace, rendered.
|
|
6
|
+
|
|
7
|
+
## Tools
|
|
8
|
+
|
|
9
|
+
- **`list_workspaces`** — lists the workspaces you can write to (`id`, `name`, `role`).
|
|
10
|
+
- **`create_doc`** — `{ workspace_id, title?, content, doc_type? }`. Creates a doc and
|
|
11
|
+
returns its URL. `doc_type` defaults to `"html"` (a rendered prototype); pass
|
|
12
|
+
`"markdown"` for a markdown doc.
|
|
13
|
+
|
|
14
|
+
## Setup
|
|
15
|
+
|
|
16
|
+
1. In the AIxisCheck web app, go to **Settings → Claude integrations → Generate token**.
|
|
17
|
+
Copy the token (it's shown once).
|
|
18
|
+
2. Add this to your Claude Desktop config
|
|
19
|
+
(`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
{
|
|
23
|
+
"mcpServers": {
|
|
24
|
+
"aixischeck": {
|
|
25
|
+
"command": "npx",
|
|
26
|
+
"args": ["-y", "aixischeck-mcp"],
|
|
27
|
+
"env": {
|
|
28
|
+
"AIXIS_TOKEN": "<paste your token from Settings>",
|
|
29
|
+
"AIXIS_URL": "https://zsmcmjdbncacemtkuzdh.supabase.co"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
3. Restart Claude Desktop.
|
|
37
|
+
|
|
38
|
+
## Use
|
|
39
|
+
|
|
40
|
+
In Claude Desktop:
|
|
41
|
+
|
|
42
|
+
> Create an HTML one-pager about our Q3 launch and save it to my workspace.
|
|
43
|
+
|
|
44
|
+
Claude calls `list_workspaces`, then `create_doc`, and replies with the doc's URL. Open it
|
|
45
|
+
in AIxisCheck — it appears in your doc list (with an "Exploration" pill for HTML) and
|
|
46
|
+
renders faithfully.
|
|
47
|
+
|
|
48
|
+
## Security
|
|
49
|
+
|
|
50
|
+
- `AIXIS_TOKEN` is a long-lived, revocable credential — treat it like a password. Revoke it
|
|
51
|
+
anytime in **Settings → Claude integrations**.
|
|
52
|
+
- The token is only ever stored as a SHA-256 hash on the server; the plaintext lives only in
|
|
53
|
+
your Claude Desktop config.
|
|
54
|
+
- The server talks to AIxisCheck over HTTPS via a Supabase Edge Function and acts strictly as
|
|
55
|
+
you — it can only touch workspaces you're a member of.
|
|
56
|
+
|
|
57
|
+
## Env
|
|
58
|
+
|
|
59
|
+
| Variable | Description |
|
|
60
|
+
| ------------- | -------------------------------------------------------- |
|
|
61
|
+
| `AIXIS_TOKEN` | Token from web Settings → Claude integrations. |
|
|
62
|
+
| `AIXIS_URL` | Your Supabase project URL (`https://<ref>.supabase.co`). |
|
|
63
|
+
|
|
64
|
+
## Develop
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
npm install
|
|
68
|
+
npm run build # tsc → dist/
|
|
69
|
+
npm test # builds, then runs node:test unit tests
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Stdio transport only — no network listener.
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// aixischeck-mcp — a local stdio MCP server for AIxisCheck.
|
|
3
|
+
//
|
|
4
|
+
// Lets Claude Desktop (or any MCP client) create docs straight into an
|
|
5
|
+
// AIxisCheck workspace. Auth is a long-lived opaque token generated in
|
|
6
|
+
// web Settings → Claude integrations, passed as AIXIS_TOKEN. Each tool
|
|
7
|
+
// call hits a Supabase Edge Function that validates the token and acts
|
|
8
|
+
// under the user's identity (RLS-enforced).
|
|
9
|
+
//
|
|
10
|
+
// Env:
|
|
11
|
+
// AIXIS_TOKEN — token from web Settings (treat like a password)
|
|
12
|
+
// AIXIS_URL — Supabase project URL, e.g. https://<ref>.supabase.co
|
|
13
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
14
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
15
|
+
import { buildCreateDocBody, createDocShape, edgeErrorMessage, functionUrl } from "./lib.js";
|
|
16
|
+
const AIXIS_TOKEN = process.env.AIXIS_TOKEN ?? "";
|
|
17
|
+
const AIXIS_URL = process.env.AIXIS_URL ?? "";
|
|
18
|
+
if (!AIXIS_TOKEN || !AIXIS_URL) {
|
|
19
|
+
console.error("aixischeck-mcp: set AIXIS_TOKEN (from web Settings → Claude integrations) and AIXIS_URL (your Supabase project URL).");
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
async function callEdge(name, method, body) {
|
|
23
|
+
const res = await fetch(functionUrl(AIXIS_URL, name), {
|
|
24
|
+
method,
|
|
25
|
+
headers: {
|
|
26
|
+
Authorization: `Bearer ${AIXIS_TOKEN}`,
|
|
27
|
+
"Content-Type": "application/json",
|
|
28
|
+
},
|
|
29
|
+
body: body === undefined ? undefined : JSON.stringify(body),
|
|
30
|
+
});
|
|
31
|
+
let payload = null;
|
|
32
|
+
try {
|
|
33
|
+
payload = await res.json();
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
// non-JSON response; leave payload null
|
|
37
|
+
}
|
|
38
|
+
if (!res.ok)
|
|
39
|
+
throw new Error(edgeErrorMessage(res.status, payload));
|
|
40
|
+
return payload;
|
|
41
|
+
}
|
|
42
|
+
function errorResult(e) {
|
|
43
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
44
|
+
return { content: [{ type: "text", text: message }], isError: true };
|
|
45
|
+
}
|
|
46
|
+
const server = new McpServer({ name: "aixischeck-mcp", version: "0.1.0" });
|
|
47
|
+
server.registerTool("list_workspaces", {
|
|
48
|
+
description: "List the AIxisCheck workspaces you can write to. Returns each workspace's id, name, and your role. Call this first to get a workspace_id for create_doc.",
|
|
49
|
+
inputSchema: {},
|
|
50
|
+
}, async () => {
|
|
51
|
+
try {
|
|
52
|
+
const data = await callEdge("mcp-list-workspaces", "GET");
|
|
53
|
+
const workspaces = (data && data.workspaces) || [];
|
|
54
|
+
return { content: [{ type: "text", text: JSON.stringify(workspaces, null, 2) }] };
|
|
55
|
+
}
|
|
56
|
+
catch (e) {
|
|
57
|
+
return errorResult(e);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
server.registerTool("create_doc", {
|
|
61
|
+
description: "Create a document in an AIxisCheck workspace from generated content. Defaults to an HTML prototype (doc_type='html'); pass doc_type='markdown' for a markdown doc. Use list_workspaces first to get a workspace_id. Returns the URL of the new doc.",
|
|
62
|
+
inputSchema: createDocShape,
|
|
63
|
+
}, async (args) => {
|
|
64
|
+
try {
|
|
65
|
+
const data = await callEdge("mcp-create-doc", "POST", buildCreateDocBody(args));
|
|
66
|
+
return { content: [{ type: "text", text: `Created. View it at ${data.url}` }] };
|
|
67
|
+
}
|
|
68
|
+
catch (e) {
|
|
69
|
+
return errorResult(e);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
const transport = new StdioServerTransport();
|
|
73
|
+
await server.connect(transport);
|
package/dist/lib.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// Pure helpers for the aixischeck-mcp server. Kept free of I/O so they
|
|
2
|
+
// can be unit-tested with node:test (see test/lib.test.mjs).
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
// Build the Supabase Edge Function URL for a given function name.
|
|
5
|
+
// AIXIS_URL is the project URL (e.g. https://<ref>.supabase.co).
|
|
6
|
+
export function functionUrl(baseUrl, name) {
|
|
7
|
+
return `${baseUrl.replace(/\/+$/, "")}/functions/v1/${name}`;
|
|
8
|
+
}
|
|
9
|
+
// Input shape for create_doc, shared between the MCP tool registration
|
|
10
|
+
// and validation. doc_type is optional here; the body builder defaults
|
|
11
|
+
// it to 'html' (the Shaed prototype-capture flow).
|
|
12
|
+
export const createDocShape = {
|
|
13
|
+
workspace_id: z.string().min(1, "workspace_id is required"),
|
|
14
|
+
title: z.string().optional(),
|
|
15
|
+
content: z.string().min(1, "content is required"),
|
|
16
|
+
doc_type: z.enum(["html", "markdown"]).optional(),
|
|
17
|
+
};
|
|
18
|
+
export const CreateDocSchema = z.object(createDocShape);
|
|
19
|
+
// Shape the POST body for the mcp-create-doc edge function, applying
|
|
20
|
+
// the doc_type='html' default and normalizing an absent title to ''.
|
|
21
|
+
export function buildCreateDocBody(input) {
|
|
22
|
+
return {
|
|
23
|
+
workspace_id: input.workspace_id,
|
|
24
|
+
title: input.title ?? "",
|
|
25
|
+
content: input.content,
|
|
26
|
+
doc_type: input.doc_type ?? "html",
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
// Map an edge-function error response to a clear, human-readable
|
|
30
|
+
// message for the MCP client. Prefers the server's own { error }
|
|
31
|
+
// string when present.
|
|
32
|
+
export function edgeErrorMessage(status, payload) {
|
|
33
|
+
const detail = payload && typeof payload === "object" && typeof payload.error === "string"
|
|
34
|
+
? payload.error
|
|
35
|
+
: "";
|
|
36
|
+
if (status === 401)
|
|
37
|
+
return detail || "Authentication failed — check AIXIS_TOKEN.";
|
|
38
|
+
if (status === 403)
|
|
39
|
+
return detail || "Not allowed to create docs in that workspace.";
|
|
40
|
+
if (status >= 500)
|
|
41
|
+
return detail || "AIxisCheck server error. Try again.";
|
|
42
|
+
return detail || `Request failed (HTTP ${status}).`;
|
|
43
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "aixischeck-mcp",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "MCP server for AIxisCheck — create docs in your workspace from Claude Desktop.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"aixischeck-mcp": "dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"README.md"
|
|
13
|
+
],
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": ">=18"
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsc",
|
|
19
|
+
"prepublishOnly": "npm run build",
|
|
20
|
+
"test": "npm run build && node --test test/*.test.mjs"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"mcp",
|
|
24
|
+
"modelcontextprotocol",
|
|
25
|
+
"aixischeck",
|
|
26
|
+
"claude"
|
|
27
|
+
],
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@modelcontextprotocol/sdk": "^1.12.0",
|
|
30
|
+
"zod": "^3.23.8"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@types/node": "^20.14.0",
|
|
34
|
+
"typescript": "^5.4.0"
|
|
35
|
+
}
|
|
36
|
+
}
|