@sit-onyx/modelcontextprotocol 0.1.0-dev-20260409155058 → 0.1.0-dev-20260410090100
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 +84 -25
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -99,6 +99,17 @@ var run = async (server) => {
|
|
|
99
99
|
httpServer.listen(PORT, HOST);
|
|
100
100
|
log(`MCP http server listening on ${HOST}:${PORT}.`);
|
|
101
101
|
};
|
|
102
|
+
//#endregion
|
|
103
|
+
//#region src/config.ts
|
|
104
|
+
var { version: version$2 } = package_default;
|
|
105
|
+
var USER_AGENT = `onyx-mcp/${version$2}`;
|
|
106
|
+
var REGISTRY_URL = process.env.REGISTRY_URL ?? "https://registry.npmjs.org";
|
|
107
|
+
/**
|
|
108
|
+
* Minimum `sit-onyx` version that provides the `component-meta.json` file
|
|
109
|
+
*/
|
|
110
|
+
var SIT_ONYX_MIN_VERSION = "1.12.0";
|
|
111
|
+
var SIT_ONYX_COMPONENT_META_FILE = "package/dist/component-meta.json";
|
|
112
|
+
var SIT_ONYX_ICONS_METADATA_FILE = "package/dist/metadata.json";
|
|
102
113
|
Object.freeze({ status: "aborted" });
|
|
103
114
|
function $constructor(name, initializer, params) {
|
|
104
115
|
function init(inst, def) {
|
|
@@ -1067,7 +1078,7 @@ var Doc = class {
|
|
|
1067
1078
|
};
|
|
1068
1079
|
//#endregion
|
|
1069
1080
|
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/versions.js
|
|
1070
|
-
var version$
|
|
1081
|
+
var version$1 = {
|
|
1071
1082
|
major: 4,
|
|
1072
1083
|
minor: 3,
|
|
1073
1084
|
patch: 6
|
|
@@ -1079,7 +1090,7 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
1079
1090
|
inst ?? (inst = {});
|
|
1080
1091
|
inst._zod.def = def;
|
|
1081
1092
|
inst._zod.bag = inst._zod.bag || {};
|
|
1082
|
-
inst._zod.version = version$
|
|
1093
|
+
inst._zod.version = version$1;
|
|
1083
1094
|
const checks = [...inst._zod.def.checks ?? []];
|
|
1084
1095
|
if (inst._zod.traits.has("$ZodCheck")) checks.unshift(inst);
|
|
1085
1096
|
for (const ch of checks) for (const fn of ch._zod.onattach) fn(inst);
|
|
@@ -6866,28 +6877,19 @@ var require_pack = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
6866
6877
|
}
|
|
6867
6878
|
}));
|
|
6868
6879
|
//#endregion
|
|
6869
|
-
//#region src/
|
|
6880
|
+
//#region src/util/package.ts
|
|
6870
6881
|
var import_tar_stream = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports) => {
|
|
6871
6882
|
exports.extract = require_extract();
|
|
6872
6883
|
exports.pack = require_pack();
|
|
6873
6884
|
})))(), 1);
|
|
6874
|
-
var { version: version$1 } = package_default;
|
|
6875
|
-
var USER_AGENT = `onyx-mcp/${version$1}`;
|
|
6876
|
-
var REGISTRY_URL = process.env.REGISTRY_URL ?? "https://registry.npmjs.org";
|
|
6877
|
-
/**
|
|
6878
|
-
* Minimum `sit-onyx` version that provides `vue-component-meta`
|
|
6879
|
-
*/
|
|
6880
|
-
var SIT_ONYX_MIN_VERSION = "1.12.0";
|
|
6881
|
-
//#endregion
|
|
6882
|
-
//#region src/util/component-meta-json.ts
|
|
6883
6885
|
var SuccessfulAbort = class {
|
|
6884
6886
|
constructor(data) {
|
|
6885
6887
|
this.data = data;
|
|
6886
6888
|
}
|
|
6887
6889
|
};
|
|
6888
|
-
async function
|
|
6889
|
-
const { dist } = await getPackageManifest(
|
|
6890
|
-
const { body } = await fetch(dist.tarball, { headers: { "User-Agent":
|
|
6890
|
+
async function getSingleFileFromPackage(packageIdent, matcher, userAgent) {
|
|
6891
|
+
const { dist } = await getPackageManifest(packageIdent.name, packageIdent.versionOrTag, packageIdent.registry);
|
|
6892
|
+
const { body } = await fetch(dist.tarball, { headers: { "User-Agent": userAgent } });
|
|
6891
6893
|
if (!body) throw new Error(`No body in response for tarball request to "${dist.tarball}"!`);
|
|
6892
6894
|
/**
|
|
6893
6895
|
* Allows us to stop the stream pipeline at any time.
|
|
@@ -6896,26 +6898,23 @@ async function retrieveComponentMetaJsonFile(version) {
|
|
|
6896
6898
|
const abortController = new AbortController();
|
|
6897
6899
|
const archiveDownload = Readable.fromWeb(body);
|
|
6898
6900
|
const decompress = createGunzip();
|
|
6899
|
-
const fileSearcher = createTarFileSearcher(abortController);
|
|
6901
|
+
const fileSearcher = createTarFileSearcher(matcher, abortController);
|
|
6900
6902
|
try {
|
|
6901
6903
|
await pipeline(archiveDownload, decompress, fileSearcher, { signal: abortController.signal });
|
|
6902
|
-
throw new Error("No
|
|
6904
|
+
throw new Error("No matching file found!");
|
|
6903
6905
|
} catch (error) {
|
|
6904
|
-
if (error instanceof Error && error.name === "AbortError" && error.cause instanceof SuccessfulAbort)
|
|
6905
|
-
const { data } = error.cause;
|
|
6906
|
-
return JSON.parse(data.toString("utf-8"));
|
|
6907
|
-
}
|
|
6906
|
+
if (error instanceof Error && error.name === "AbortError" && error.cause instanceof SuccessfulAbort) return error.cause.data;
|
|
6908
6907
|
throw error;
|
|
6909
6908
|
}
|
|
6910
6909
|
}
|
|
6911
6910
|
/**
|
|
6912
|
-
* Returns a writable stream, which searches a file in a tar archive
|
|
6911
|
+
* Returns a writable stream, which searches a file in a tar archive.
|
|
6913
6912
|
* If found, will call the AbortController with the file content as reason.
|
|
6914
6913
|
*/
|
|
6915
|
-
function createTarFileSearcher(abortController) {
|
|
6914
|
+
function createTarFileSearcher(matcher, abortController) {
|
|
6916
6915
|
const searchFile = import_tar_stream.extract();
|
|
6917
6916
|
searchFile.on("entry", async (headers, stream, next) => {
|
|
6918
|
-
if (headers
|
|
6917
|
+
if (matcher(headers)) {
|
|
6919
6918
|
const data = await buffer(stream);
|
|
6920
6919
|
abortController.abort(new SuccessfulAbort(data));
|
|
6921
6920
|
} else {
|
|
@@ -6926,6 +6925,15 @@ function createTarFileSearcher(abortController) {
|
|
|
6926
6925
|
return searchFile;
|
|
6927
6926
|
}
|
|
6928
6927
|
//#endregion
|
|
6928
|
+
//#region src/util/component-meta-json.ts
|
|
6929
|
+
async function retrieveComponentMetaJsonFile(versionOrTag) {
|
|
6930
|
+
const data = await getSingleFileFromPackage({
|
|
6931
|
+
name: "sit-onyx",
|
|
6932
|
+
versionOrTag
|
|
6933
|
+
}, (header) => header.name === SIT_ONYX_COMPONENT_META_FILE, USER_AGENT);
|
|
6934
|
+
return JSON.parse(data.toString("utf-8"));
|
|
6935
|
+
}
|
|
6936
|
+
//#endregion
|
|
6929
6937
|
//#region src/resources/get-component-api.ts
|
|
6930
6938
|
/**
|
|
6931
6939
|
* Returns true if both parameters are defined and equal (ignoring surrounding whitespaces and case)
|
|
@@ -7033,6 +7041,53 @@ var listComponents = [
|
|
|
7033
7041
|
}
|
|
7034
7042
|
];
|
|
7035
7043
|
//#endregion
|
|
7044
|
+
//#region src/util/icons-metadata-json.ts
|
|
7045
|
+
async function retrieveIconsMetadataJsonFile(versionOrTag) {
|
|
7046
|
+
const data = await getSingleFileFromPackage({
|
|
7047
|
+
name: "@sit-onyx/icons",
|
|
7048
|
+
versionOrTag
|
|
7049
|
+
}, (header) => header.name === SIT_ONYX_ICONS_METADATA_FILE, USER_AGENT);
|
|
7050
|
+
return JSON.parse(data.toString("utf-8"));
|
|
7051
|
+
}
|
|
7052
|
+
//#endregion
|
|
7053
|
+
//#region src/resources/list-icons.ts
|
|
7054
|
+
var listIcons = [
|
|
7055
|
+
"list-icons",
|
|
7056
|
+
new ResourceTemplate("icons://sit-onyx/{version}", { list: void 0 }),
|
|
7057
|
+
{
|
|
7058
|
+
title: "List @sit-onyx/icons icons",
|
|
7059
|
+
description: "List all icons available in a specific version of @sit-onyx/icons",
|
|
7060
|
+
mimeType: "text/markdown"
|
|
7061
|
+
},
|
|
7062
|
+
async (uri, { version: _version }) => {
|
|
7063
|
+
const version = Array.isArray(_version) ? _version[0] : _version;
|
|
7064
|
+
const iconsMetadata = await retrieveIconsMetadataJsonFile(version);
|
|
7065
|
+
const categoryMap = /* @__PURE__ */ new Map();
|
|
7066
|
+
Object.entries(iconsMetadata).forEach(([name, data]) => {
|
|
7067
|
+
if (!categoryMap.has(data.category)) categoryMap.set(data.category, []);
|
|
7068
|
+
categoryMap.get(data.category).push({
|
|
7069
|
+
name,
|
|
7070
|
+
...data
|
|
7071
|
+
});
|
|
7072
|
+
});
|
|
7073
|
+
const text = `# Icons for \`@sit-onyx/icons@${version}\`
|
|
7074
|
+
|
|
7075
|
+
This is a list of all icons offered by the \`@sit-onyx/icons@${version}\` package.
|
|
7076
|
+
The icons are grouped by category.
|
|
7077
|
+
|
|
7078
|
+
${categoryMap.entries().toArray().toSorted(([a], [b]) => a.localeCompare(b)).map(([category, icons]) => {
|
|
7079
|
+
return `## ${category}
|
|
7080
|
+
|
|
7081
|
+
${icons.map(({ aliases, name }) => `- \`${name}\` (aliases: ${aliases.join(", ")})`).join("\n")}`;
|
|
7082
|
+
}).join("\n\n")}`;
|
|
7083
|
+
return { contents: [{
|
|
7084
|
+
uri: uri.href,
|
|
7085
|
+
text,
|
|
7086
|
+
mimeType: "text/markdown"
|
|
7087
|
+
}] };
|
|
7088
|
+
}
|
|
7089
|
+
];
|
|
7090
|
+
//#endregion
|
|
7036
7091
|
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/mini/schemas.js
|
|
7037
7092
|
var ZodMiniType = /* @__PURE__ */ $constructor("ZodMiniType", (inst, def) => {
|
|
7038
7093
|
if (!inst._zod) throw new Error("Uninitialized schema in ZodMiniType.");
|
|
@@ -7100,7 +7155,11 @@ var resourceToTool = (resource) => {
|
|
|
7100
7155
|
//#endregion
|
|
7101
7156
|
//#region src/server/server.ts
|
|
7102
7157
|
var { name, version, description } = package_default;
|
|
7103
|
-
var resources = [
|
|
7158
|
+
var resources = [
|
|
7159
|
+
listComponents,
|
|
7160
|
+
getComponentApi,
|
|
7161
|
+
listIcons
|
|
7162
|
+
];
|
|
7104
7163
|
var createServer = ({ resourcesAsTools }) => {
|
|
7105
7164
|
/**
|
|
7106
7165
|
* Internal McpServer, which provides the MCP resources.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sit-onyx/modelcontextprotocol",
|
|
3
|
-
"version": "0.1.0-dev-
|
|
3
|
+
"version": "0.1.0-dev-20260410090100",
|
|
4
4
|
"description": "MCP (Model Context Protocol) Server that provide onyx specific tools and resources.",
|
|
5
5
|
"homepage": "https://onyx.schwarz",
|
|
6
6
|
"bugs": {
|