@yawlabs/nol-mcp 0.1.0 → 0.1.1
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/dist/index.js +32 -31
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -30948,6 +30948,35 @@ var StdioServerTransport = class {
|
|
|
30948
30948
|
}
|
|
30949
30949
|
};
|
|
30950
30950
|
|
|
30951
|
+
// src/runtime.ts
|
|
30952
|
+
async function runTool(handler, input) {
|
|
30953
|
+
try {
|
|
30954
|
+
const response = await handler(input);
|
|
30955
|
+
if (!response.ok) {
|
|
30956
|
+
return {
|
|
30957
|
+
content: [{ type: "text", text: `Error: ${response.error ?? "Unknown error"}` }],
|
|
30958
|
+
isError: true
|
|
30959
|
+
};
|
|
30960
|
+
}
|
|
30961
|
+
const text = JSON.stringify(response.data ?? { success: true }, null, 2);
|
|
30962
|
+
return { content: [{ type: "text", text }] };
|
|
30963
|
+
} catch (err) {
|
|
30964
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
30965
|
+
return { content: [{ type: "text", text: `Error: ${message}` }], isError: true };
|
|
30966
|
+
}
|
|
30967
|
+
}
|
|
30968
|
+
function assertUniqueToolNames(tools) {
|
|
30969
|
+
const seen = /* @__PURE__ */ new Set();
|
|
30970
|
+
const duplicates = [];
|
|
30971
|
+
for (const t of tools) {
|
|
30972
|
+
if (seen.has(t.name)) duplicates.push(t.name);
|
|
30973
|
+
else seen.add(t.name);
|
|
30974
|
+
}
|
|
30975
|
+
if (duplicates.length > 0) {
|
|
30976
|
+
throw new Error(`Duplicate tool name(s) registered: ${[...new Set(duplicates)].join(", ")}`);
|
|
30977
|
+
}
|
|
30978
|
+
}
|
|
30979
|
+
|
|
30951
30980
|
// src/api.ts
|
|
30952
30981
|
var API_URL = process.env.NOL_API_URL ?? "http://localhost:3001";
|
|
30953
30982
|
var API_KEY = process.env.NOL_API_KEY ?? "";
|
|
@@ -31072,24 +31101,14 @@ var spaceTools = [
|
|
|
31072
31101
|
];
|
|
31073
31102
|
|
|
31074
31103
|
// src/index.ts
|
|
31075
|
-
var version2 = true ? "0.1.
|
|
31104
|
+
var version2 = true ? "0.1.1" : (await null).createRequire(import.meta.url)("../package.json").version;
|
|
31076
31105
|
var subcommand = process.argv[2];
|
|
31077
31106
|
if (subcommand === "version" || subcommand === "--version" || subcommand === "-v" || subcommand === "-V") {
|
|
31078
31107
|
console.log(version2);
|
|
31079
31108
|
process.exit(0);
|
|
31080
31109
|
}
|
|
31081
31110
|
var allTools = [...searchTools, ...spaceTools, ...pageTools];
|
|
31082
|
-
|
|
31083
|
-
const seen = /* @__PURE__ */ new Set();
|
|
31084
|
-
const duplicates = [];
|
|
31085
|
-
for (const t of allTools) {
|
|
31086
|
-
if (seen.has(t.name)) duplicates.push(t.name);
|
|
31087
|
-
else seen.add(t.name);
|
|
31088
|
-
}
|
|
31089
|
-
if (duplicates.length > 0) {
|
|
31090
|
-
throw new Error(`Duplicate tool name(s) registered: ${[...new Set(duplicates)].join(", ")}`);
|
|
31091
|
-
}
|
|
31092
|
-
}
|
|
31111
|
+
assertUniqueToolNames(allTools);
|
|
31093
31112
|
var server = new McpServer({ name: "@yawlabs/nol-mcp", version: version2 });
|
|
31094
31113
|
for (const tool of allTools) {
|
|
31095
31114
|
server.tool(
|
|
@@ -31097,25 +31116,7 @@ for (const tool of allTools) {
|
|
|
31097
31116
|
tool.description,
|
|
31098
31117
|
tool.inputSchema.shape,
|
|
31099
31118
|
tool.annotations,
|
|
31100
|
-
|
|
31101
|
-
try {
|
|
31102
|
-
const response = await tool.handler(input);
|
|
31103
|
-
if (!response.ok) {
|
|
31104
|
-
return {
|
|
31105
|
-
content: [{ type: "text", text: `Error: ${response.error ?? "Unknown error"}` }],
|
|
31106
|
-
isError: true
|
|
31107
|
-
};
|
|
31108
|
-
}
|
|
31109
|
-
const text = JSON.stringify(response.data ?? { success: true }, null, 2);
|
|
31110
|
-
return { content: [{ type: "text", text }] };
|
|
31111
|
-
} catch (err) {
|
|
31112
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
31113
|
-
return {
|
|
31114
|
-
content: [{ type: "text", text: `Error: ${message}` }],
|
|
31115
|
-
isError: true
|
|
31116
|
-
};
|
|
31117
|
-
}
|
|
31118
|
-
}
|
|
31119
|
+
(input) => runTool(tool.handler, input)
|
|
31119
31120
|
);
|
|
31120
31121
|
}
|
|
31121
31122
|
var transport = new StdioServerTransport();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yawlabs/nol-mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"mcpName": "io.github.YawLabs/nol-mcp",
|
|
5
5
|
"description": "nol MCP server — query your team's knowledge base (search, cited Q&A, spaces, pages) from AI assistants",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"build": "tsc && node build.mjs",
|
|
34
34
|
"dev": "tsc --watch",
|
|
35
35
|
"start": "node dist/index.js",
|
|
36
|
-
"test": "npm run build && node --test dist
|
|
36
|
+
"test": "npm run build && node --test dist/**/*.test.js",
|
|
37
37
|
"test:ci": "npm run test",
|
|
38
38
|
"lint": "biome check src/",
|
|
39
39
|
"lint:fix": "biome check --write src/",
|