@sit-onyx/modelcontextprotocol 0.1.0-dev-20260409100058 → 0.1.0-dev-20260409155058
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 +65 -0
- package/dist/index.d.ts +9 -7
- package/dist/index.js +206 -126
- package/package.json +3 -2
package/README.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# onyx MCP
|
|
2
|
+
|
|
3
|
+
This is the official [onyx](https://onyx.schwarz/) Model Context Protocol (or "MCP" for short) server.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
- [Node.js](https://nodejs.org/en) version as specified in [.node-version](./.node-version) file
|
|
8
|
+
|
|
9
|
+
## Getting started
|
|
10
|
+
|
|
11
|
+
Install the CLI globally:
|
|
12
|
+
|
|
13
|
+
```shell
|
|
14
|
+
# npm
|
|
15
|
+
npm install -g @sit-onyx/modelcontextprotocol
|
|
16
|
+
|
|
17
|
+
# pnpm
|
|
18
|
+
pnpm install -g @sit-onyx/modelcontextprotocol
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Now you can run the `onyx-mcp` command:
|
|
23
|
+
|
|
24
|
+
```shell
|
|
25
|
+
onyx-mcp -h
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Using with the Gemini CLI
|
|
29
|
+
|
|
30
|
+
Add this entry to your Gemini settings (in `~/.gemini/settings.json`):
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"$schema": "https://raw.githubusercontent.com/google-gemini/gemini-cli/main/schemas/settings.schema.json",
|
|
35
|
+
"mcp": {
|
|
36
|
+
"allowed": ["onyx-mcp"]
|
|
37
|
+
},
|
|
38
|
+
"mcpServers": {
|
|
39
|
+
"onyx-mcp": {
|
|
40
|
+
"description": "Information about components of the onyx UI component library",
|
|
41
|
+
"command": "onyx-mcp",
|
|
42
|
+
"args": ["-r"]
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Save the file and confirm that the MCP has been set up correctly:
|
|
49
|
+
|
|
50
|
+
```shell
|
|
51
|
+
gemini mcp list
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Development
|
|
55
|
+
|
|
56
|
+
Run this command in the monorepo root:
|
|
57
|
+
|
|
58
|
+
```shell
|
|
59
|
+
pnpm run dev modelcontextprotocol
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
This starts the "build" watcher and the [`@modelcontextprotocol/inspector`](https://github.com/modelcontextprotocol/inspector) locally.
|
|
63
|
+
|
|
64
|
+
You must reload the inspector browser website after changes to the `@sit-onyx/modelcontextprotocol` source code.
|
|
65
|
+
**Using the "Reconnect" button does not suffice!**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { McpServer as McpServer_2 } from '@modelcontextprotocol/sdk/server/mcp';
|
|
3
|
+
|
|
4
|
+
export declare const createServer: ({ resourcesAsTools }: CreateServerOptions) => McpServer;
|
|
5
|
+
|
|
6
|
+
declare type CreateServerOptions = {
|
|
7
|
+
resourcesAsTools: boolean;
|
|
8
|
+
};
|
|
2
9
|
|
|
3
10
|
/**
|
|
4
11
|
* MCP server running as a http server.
|
|
5
12
|
* `HOST` and `PORT` environment variable can be used to change the server settings.
|
|
6
13
|
*/
|
|
7
|
-
export declare const http: () => Promise<void>;
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Internal McpServer, which provides the MCP resources.
|
|
11
|
-
*/
|
|
12
|
-
export declare const server: McpServer;
|
|
14
|
+
export declare const http: (server: McpServer_2) => Promise<void>;
|
|
13
15
|
|
|
14
16
|
/**
|
|
15
17
|
* MCP server running via stdio.
|
|
16
18
|
* All logging has to use stderr, otherwise the logging to stdio will break the transport.
|
|
17
19
|
*/
|
|
18
|
-
export declare const stdio: () => Promise<void>;
|
|
20
|
+
export declare const stdio: (server: McpServer_2) => Promise<void>;
|
|
19
21
|
|
|
20
22
|
export { }
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { error, log } from "node:console";
|
|
|
4
4
|
import { parseArgs } from "node:util";
|
|
5
5
|
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
6
6
|
import { randomUUID } from "node:crypto";
|
|
7
|
-
import { createServer } from "node:http";
|
|
7
|
+
import { createServer as createServer$1 } from "node:http";
|
|
8
8
|
import { McpServer, ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
9
9
|
import { Readable } from "node:stream";
|
|
10
10
|
import { buffer } from "node:stream/consumers";
|
|
@@ -66,7 +66,7 @@ var package_default = {
|
|
|
66
66
|
scripts: {
|
|
67
67
|
"dev": "pnpm run \"/build-dev|inspect-mcp/\"",
|
|
68
68
|
"build-dev": "vite build --ssr -w",
|
|
69
|
-
"inspect-mcp": "pnpm dlx @modelcontextprotocol/inspector
|
|
69
|
+
"inspect-mcp": "pnpm dlx @modelcontextprotocol/inspector --config inspector.json",
|
|
70
70
|
"build": "vite build --ssr"
|
|
71
71
|
},
|
|
72
72
|
dependencies: { "@modelcontextprotocol/sdk": "^1.29.0" },
|
|
@@ -79,10 +79,26 @@ var package_default = {
|
|
|
79
79
|
"typescript": "catalog:",
|
|
80
80
|
"vite": "catalog:",
|
|
81
81
|
"vite-plugin-dts": "^4.5.4",
|
|
82
|
-
"vue-component-meta": "^3.2.6"
|
|
82
|
+
"vue-component-meta": "^3.2.6",
|
|
83
|
+
"zod": "^4.3.6"
|
|
83
84
|
},
|
|
84
85
|
engines: { "node": ">=20" }
|
|
85
86
|
};
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region src/server/http.ts
|
|
89
|
+
/**
|
|
90
|
+
* MCP server running as a http server.
|
|
91
|
+
* `HOST` and `PORT` environment variable can be used to change the server settings.
|
|
92
|
+
*/
|
|
93
|
+
var run = async (server) => {
|
|
94
|
+
const transport = new StreamableHTTPServerTransport({ sessionIdGenerator: () => randomUUID() });
|
|
95
|
+
await server.connect(transport);
|
|
96
|
+
const httpServer = createServer$1(transport.handleRequest);
|
|
97
|
+
const PORT = Number.parseInt(process.env["PORT"] ?? "3000");
|
|
98
|
+
const HOST = process.env["HOST"] ?? "0.0.0.0";
|
|
99
|
+
httpServer.listen(PORT, HOST);
|
|
100
|
+
log(`MCP http server listening on ${HOST}:${PORT}.`);
|
|
101
|
+
};
|
|
86
102
|
Object.freeze({ status: "aborted" });
|
|
87
103
|
function $constructor(name, initializer, params) {
|
|
88
104
|
function init(inst, def) {
|
|
@@ -522,6 +538,7 @@ var _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
|
522
538
|
}
|
|
523
539
|
return result.value;
|
|
524
540
|
};
|
|
541
|
+
var parse$1 = /* @__PURE__ */ _parse($ZodRealError);
|
|
525
542
|
var _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
|
|
526
543
|
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
527
544
|
let result = schema._zod.run({
|
|
@@ -536,6 +553,7 @@ var _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
|
|
|
536
553
|
}
|
|
537
554
|
return result.value;
|
|
538
555
|
};
|
|
556
|
+
var parseAsync$1 = /* @__PURE__ */ _parseAsync($ZodRealError);
|
|
539
557
|
var _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
540
558
|
const ctx = _ctx ? {
|
|
541
559
|
..._ctx,
|
|
@@ -648,7 +666,7 @@ function datetime$1(args) {
|
|
|
648
666
|
const timeRegex = `${time}(?:${opts.join("|")})`;
|
|
649
667
|
return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
|
|
650
668
|
}
|
|
651
|
-
var string$
|
|
669
|
+
var string$2 = (params) => {
|
|
652
670
|
const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
|
|
653
671
|
return new RegExp(`^${regex}$`);
|
|
654
672
|
};
|
|
@@ -1146,7 +1164,7 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
1146
1164
|
});
|
|
1147
1165
|
var $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
|
|
1148
1166
|
$ZodType.init(inst, def);
|
|
1149
|
-
inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string$
|
|
1167
|
+
inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string$2(inst._zod.bag);
|
|
1150
1168
|
inst._zod.parse = (payload, _) => {
|
|
1151
1169
|
if (def.coerce) try {
|
|
1152
1170
|
payload.value = String(payload.value);
|
|
@@ -3529,7 +3547,7 @@ var ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
|
|
|
3529
3547
|
inst.time = (params) => inst.check(time(params));
|
|
3530
3548
|
inst.duration = (params) => inst.check(duration(params));
|
|
3531
3549
|
});
|
|
3532
|
-
function string(params) {
|
|
3550
|
+
function string$1(params) {
|
|
3533
3551
|
return /* @__PURE__ */ _string(ZodString, params);
|
|
3534
3552
|
}
|
|
3535
3553
|
var ZodStringFormat = /* @__PURE__ */ $constructor("ZodStringFormat", (inst, def) => {
|
|
@@ -4008,34 +4026,34 @@ function superRefine(fn) {
|
|
|
4008
4026
|
}
|
|
4009
4027
|
//#endregion
|
|
4010
4028
|
//#region ../../node_modules/.pnpm/zod-package-json@2.1.0_zod@4.3.6/node_modules/zod-package-json/dist/package-json.js
|
|
4011
|
-
var Bugs = union([string(), object({
|
|
4012
|
-
url: optional(string()),
|
|
4013
|
-
email: optional(string())
|
|
4029
|
+
var Bugs = union([string$1(), object({
|
|
4030
|
+
url: optional(string$1()),
|
|
4031
|
+
email: optional(string$1())
|
|
4014
4032
|
})]);
|
|
4015
4033
|
var Funding = union([
|
|
4016
|
-
string(),
|
|
4034
|
+
string$1(),
|
|
4017
4035
|
object({
|
|
4018
|
-
url: string(),
|
|
4019
|
-
type: optional(string())
|
|
4036
|
+
url: string$1(),
|
|
4037
|
+
type: optional(string$1())
|
|
4020
4038
|
}),
|
|
4021
|
-
array(union([string(), object({
|
|
4022
|
-
url: string(),
|
|
4023
|
-
type: optional(string())
|
|
4039
|
+
array(union([string$1(), object({
|
|
4040
|
+
url: string$1(),
|
|
4041
|
+
type: optional(string$1())
|
|
4024
4042
|
})]))
|
|
4025
4043
|
]);
|
|
4026
|
-
var Person = union([string(), object({
|
|
4027
|
-
name: string(),
|
|
4028
|
-
email: optional(string()),
|
|
4029
|
-
url: optional(string())
|
|
4044
|
+
var Person = union([string$1(), object({
|
|
4045
|
+
name: string$1(),
|
|
4046
|
+
email: optional(string$1()),
|
|
4047
|
+
url: optional(string$1())
|
|
4030
4048
|
})]);
|
|
4031
|
-
var Repository = union([string(), object({
|
|
4032
|
-
type: string(),
|
|
4033
|
-
url: string(),
|
|
4034
|
-
directory: optional(string())
|
|
4049
|
+
var Repository = union([string$1(), object({
|
|
4050
|
+
type: string$1(),
|
|
4051
|
+
url: string$1(),
|
|
4052
|
+
directory: optional(string$1())
|
|
4035
4053
|
})]);
|
|
4036
4054
|
var DevEngineDependency = object({
|
|
4037
|
-
name: string(),
|
|
4038
|
-
version: optional(string()),
|
|
4055
|
+
name: string$1(),
|
|
4056
|
+
version: optional(string$1()),
|
|
4039
4057
|
onFail: optional(literal([
|
|
4040
4058
|
"ignore",
|
|
4041
4059
|
"warn",
|
|
@@ -4051,57 +4069,57 @@ var DevEngines = object({
|
|
|
4051
4069
|
packageManager: optional(DevEngineDependencies)
|
|
4052
4070
|
});
|
|
4053
4071
|
var PackageJson = looseObject({
|
|
4054
|
-
name: string(),
|
|
4055
|
-
version: string(),
|
|
4056
|
-
description: optional(string()),
|
|
4057
|
-
keywords: optional(array(string())),
|
|
4058
|
-
homepage: optional(string()),
|
|
4072
|
+
name: string$1(),
|
|
4073
|
+
version: string$1(),
|
|
4074
|
+
description: optional(string$1()),
|
|
4075
|
+
keywords: optional(array(string$1())),
|
|
4076
|
+
homepage: optional(string$1()),
|
|
4059
4077
|
bugs: optional(Bugs),
|
|
4060
|
-
license: optional(string()),
|
|
4078
|
+
license: optional(string$1()),
|
|
4061
4079
|
author: optional(Person),
|
|
4062
4080
|
contributors: optional(array(Person)),
|
|
4063
4081
|
maintainers: optional(array(Person)),
|
|
4064
4082
|
funding: optional(Funding),
|
|
4065
|
-
files: optional(array(string())),
|
|
4083
|
+
files: optional(array(string$1())),
|
|
4066
4084
|
exports: optional(union([
|
|
4067
4085
|
_null(),
|
|
4068
|
-
string(),
|
|
4069
|
-
array(string()),
|
|
4070
|
-
record(string(), unknown())
|
|
4086
|
+
string$1(),
|
|
4087
|
+
array(string$1()),
|
|
4088
|
+
record(string$1(), unknown())
|
|
4071
4089
|
])),
|
|
4072
4090
|
type: optional(literal(["module", "commonjs"])),
|
|
4073
|
-
main: optional(string()),
|
|
4074
|
-
browser: optional(union([string(), record(string(), union([string(), boolean()]))])),
|
|
4075
|
-
bin: optional(union([string(), record(string(), string())])),
|
|
4076
|
-
man: optional(union([string(), array(string())])),
|
|
4077
|
-
directories: optional(record(string(), string())),
|
|
4091
|
+
main: optional(string$1()),
|
|
4092
|
+
browser: optional(union([string$1(), record(string$1(), union([string$1(), boolean()]))])),
|
|
4093
|
+
bin: optional(union([string$1(), record(string$1(), string$1())])),
|
|
4094
|
+
man: optional(union([string$1(), array(string$1())])),
|
|
4095
|
+
directories: optional(record(string$1(), string$1())),
|
|
4078
4096
|
repository: optional(Repository),
|
|
4079
|
-
scripts: optional(record(string(), string())),
|
|
4080
|
-
config: optional(record(string(), unknown())),
|
|
4081
|
-
dependencies: optional(record(string(), string())),
|
|
4082
|
-
devDependencies: optional(record(string(), string())),
|
|
4083
|
-
peerDependencies: optional(record(string(), string())),
|
|
4084
|
-
peerDependenciesMeta: optional(record(string(), object({ optional: boolean() }))),
|
|
4085
|
-
bundleDependencies: optional(union([boolean(), array(string())])),
|
|
4086
|
-
bundledDependencies: optional(union([boolean(), array(string())])),
|
|
4087
|
-
optionalDependencies: optional(record(string(), string())),
|
|
4088
|
-
overrides: optional(record(string(), unknown())),
|
|
4089
|
-
engines: optional(record(string(), string())),
|
|
4090
|
-
os: optional(array(string())),
|
|
4091
|
-
cpu: optional(array(string())),
|
|
4092
|
-
libc: optional(string()),
|
|
4097
|
+
scripts: optional(record(string$1(), string$1())),
|
|
4098
|
+
config: optional(record(string$1(), unknown())),
|
|
4099
|
+
dependencies: optional(record(string$1(), string$1())),
|
|
4100
|
+
devDependencies: optional(record(string$1(), string$1())),
|
|
4101
|
+
peerDependencies: optional(record(string$1(), string$1())),
|
|
4102
|
+
peerDependenciesMeta: optional(record(string$1(), object({ optional: boolean() }))),
|
|
4103
|
+
bundleDependencies: optional(union([boolean(), array(string$1())])),
|
|
4104
|
+
bundledDependencies: optional(union([boolean(), array(string$1())])),
|
|
4105
|
+
optionalDependencies: optional(record(string$1(), string$1())),
|
|
4106
|
+
overrides: optional(record(string$1(), unknown())),
|
|
4107
|
+
engines: optional(record(string$1(), string$1())),
|
|
4108
|
+
os: optional(array(string$1())),
|
|
4109
|
+
cpu: optional(array(string$1())),
|
|
4110
|
+
libc: optional(string$1()),
|
|
4093
4111
|
devEngines: optional(DevEngines),
|
|
4094
4112
|
private: optional(boolean()),
|
|
4095
|
-
publishConfig: optional(record(string(), unknown())),
|
|
4096
|
-
workspaces: optional(array(string())),
|
|
4097
|
-
deprecated: optional(string()),
|
|
4098
|
-
module: optional(string()),
|
|
4099
|
-
types: optional(string()),
|
|
4100
|
-
typings: optional(string()),
|
|
4101
|
-
typesVersions: optional(record(string(), record(string(), array(string())))),
|
|
4102
|
-
packageManager: optional(string()),
|
|
4103
|
-
sideEffects: optional(union([boolean(), array(string())])),
|
|
4104
|
-
imports: optional(record(string(), unknown()))
|
|
4113
|
+
publishConfig: optional(record(string$1(), unknown())),
|
|
4114
|
+
workspaces: optional(array(string$1())),
|
|
4115
|
+
deprecated: optional(string$1()),
|
|
4116
|
+
module: optional(string$1()),
|
|
4117
|
+
types: optional(string$1()),
|
|
4118
|
+
typings: optional(string$1()),
|
|
4119
|
+
typesVersions: optional(record(string$1(), record(string$1(), array(string$1())))),
|
|
4120
|
+
packageManager: optional(string$1()),
|
|
4121
|
+
sideEffects: optional(union([boolean(), array(string$1())])),
|
|
4122
|
+
imports: optional(record(string$1(), unknown()))
|
|
4105
4123
|
});
|
|
4106
4124
|
//#endregion
|
|
4107
4125
|
//#region ../../node_modules/.pnpm/quick-lru@7.3.0/node_modules/quick-lru/index.js
|
|
@@ -4502,14 +4520,14 @@ function assertValidPackageName(name) {
|
|
|
4502
4520
|
(e.g., `{ "latest": "1.0.0" }`).
|
|
4503
4521
|
*/
|
|
4504
4522
|
var DistTags = object({
|
|
4505
|
-
latest: string(),
|
|
4506
|
-
next: string().optional(),
|
|
4507
|
-
alpha: string().optional(),
|
|
4508
|
-
beta: string().optional(),
|
|
4509
|
-
rc: string().optional(),
|
|
4510
|
-
canary: string().optional(),
|
|
4511
|
-
dev: string().optional()
|
|
4512
|
-
}).catchall(string());
|
|
4523
|
+
latest: string$1(),
|
|
4524
|
+
next: string$1().optional(),
|
|
4525
|
+
alpha: string$1().optional(),
|
|
4526
|
+
beta: string$1().optional(),
|
|
4527
|
+
rc: string$1().optional(),
|
|
4528
|
+
canary: string$1().optional(),
|
|
4529
|
+
dev: string$1().optional()
|
|
4530
|
+
}).catchall(string$1());
|
|
4513
4531
|
//#endregion
|
|
4514
4532
|
//#region ../../node_modules/.pnpm/query-registry@4.3.0_zod@4.3.6/node_modules/query-registry/dist/fetch-data.js
|
|
4515
4533
|
async function fetchData(schema, url, headers) {
|
|
@@ -4534,36 +4552,36 @@ var npmRegistryUrl = "https://registry.npmjs.org";
|
|
|
4534
4552
|
@see {@link https://github.com/npm/registry/blob/master/docs/responses/package-metadata.md#dist}
|
|
4535
4553
|
*/
|
|
4536
4554
|
var Dist = object({
|
|
4537
|
-
tarball: string(),
|
|
4538
|
-
shasum: string(),
|
|
4539
|
-
integrity: string().optional(),
|
|
4555
|
+
tarball: string$1(),
|
|
4556
|
+
shasum: string$1(),
|
|
4557
|
+
integrity: string$1().optional(),
|
|
4540
4558
|
fileCount: number().optional(),
|
|
4541
4559
|
unpackedSize: number().optional(),
|
|
4542
|
-
"npm-signature": string().optional(),
|
|
4560
|
+
"npm-signature": string$1().optional(),
|
|
4543
4561
|
signatures: array(object({
|
|
4544
|
-
keyid: string(),
|
|
4545
|
-
sig: string()
|
|
4562
|
+
keyid: string$1(),
|
|
4563
|
+
sig: string$1()
|
|
4546
4564
|
})).optional()
|
|
4547
4565
|
});
|
|
4548
4566
|
var PackageManifest = object({
|
|
4549
4567
|
...PackageJson.shape,
|
|
4550
|
-
_id: string(),
|
|
4568
|
+
_id: string$1(),
|
|
4551
4569
|
dist: Dist,
|
|
4552
|
-
readme: string().optional(),
|
|
4553
|
-
readmeFilename: string().optional(),
|
|
4554
|
-
gitHead: string().optional(),
|
|
4570
|
+
readme: string$1().optional(),
|
|
4571
|
+
readmeFilename: string$1().optional(),
|
|
4572
|
+
gitHead: string$1().optional(),
|
|
4555
4573
|
_hasShrinkwrap: boolean().optional(),
|
|
4556
|
-
_nodeVersion: string().optional(),
|
|
4557
|
-
_npmVersion: string().optional(),
|
|
4574
|
+
_nodeVersion: string$1().optional(),
|
|
4575
|
+
_npmVersion: string$1().optional(),
|
|
4558
4576
|
_npmUser: PackageJson.shape.author.optional(),
|
|
4559
4577
|
_npmOperationalInternal: object({
|
|
4560
|
-
host: string().optional(),
|
|
4561
|
-
tmp: string().optional()
|
|
4578
|
+
host: string$1().optional(),
|
|
4579
|
+
tmp: string$1().optional()
|
|
4562
4580
|
}).optional(),
|
|
4563
|
-
engines: record(string(), string()).optional().catch(void 0),
|
|
4564
|
-
license: string().optional().catch(void 0),
|
|
4565
|
-
homepage: string().optional().catch(void 0),
|
|
4566
|
-
deprecated: union([string(), boolean()]).optional(),
|
|
4581
|
+
engines: record(string$1(), string$1()).optional().catch(void 0),
|
|
4582
|
+
license: string$1().optional().catch(void 0),
|
|
4583
|
+
homepage: string$1().optional().catch(void 0),
|
|
4584
|
+
deprecated: union([string$1(), boolean()]).optional(),
|
|
4567
4585
|
type: literal(["module", "commonjs"]).optional().catch(void 0)
|
|
4568
4586
|
});
|
|
4569
4587
|
/**
|
|
@@ -4582,10 +4600,10 @@ async function getPackageManifest(name, versionOrTag = "latest", registry = npmR
|
|
|
4582
4600
|
//#endregion
|
|
4583
4601
|
//#region ../../node_modules/.pnpm/query-registry@4.3.0_zod@4.3.6/node_modules/query-registry/dist/get-abbreviated-packument.js
|
|
4584
4602
|
var AbbreviatedPackument = object({
|
|
4585
|
-
name: string(),
|
|
4586
|
-
modified: string(),
|
|
4603
|
+
name: string$1(),
|
|
4604
|
+
modified: string$1(),
|
|
4587
4605
|
"dist-tags": DistTags,
|
|
4588
|
-
versions: record(string(), object({
|
|
4606
|
+
versions: record(string$1(), object({
|
|
4589
4607
|
...PackageManifest.pick({
|
|
4590
4608
|
name: true,
|
|
4591
4609
|
version: true,
|
|
@@ -6919,7 +6937,7 @@ var getComponentApi = [
|
|
|
6919
6937
|
new ResourceTemplate("components://sit-onyx/{version}/{component}", { list: void 0 }),
|
|
6920
6938
|
{
|
|
6921
6939
|
title: "Get Component API",
|
|
6922
|
-
description: "
|
|
6940
|
+
description: "Gets the component API for a specific component and version of onyx",
|
|
6923
6941
|
mimeType: "text/markdown"
|
|
6924
6942
|
},
|
|
6925
6943
|
async (uri, { version: _version, component: _component }) => {
|
|
@@ -7015,33 +7033,87 @@ var listComponents = [
|
|
|
7015
7033
|
}
|
|
7016
7034
|
];
|
|
7017
7035
|
//#endregion
|
|
7036
|
+
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/mini/schemas.js
|
|
7037
|
+
var ZodMiniType = /* @__PURE__ */ $constructor("ZodMiniType", (inst, def) => {
|
|
7038
|
+
if (!inst._zod) throw new Error("Uninitialized schema in ZodMiniType.");
|
|
7039
|
+
$ZodType.init(inst, def);
|
|
7040
|
+
inst.def = def;
|
|
7041
|
+
inst.type = def.type;
|
|
7042
|
+
inst.parse = (data, params) => parse$1(inst, data, params, { callee: inst.parse });
|
|
7043
|
+
inst.safeParse = (data, params) => safeParse$1(inst, data, params);
|
|
7044
|
+
inst.parseAsync = async (data, params) => parseAsync$1(inst, data, params, { callee: inst.parseAsync });
|
|
7045
|
+
inst.safeParseAsync = async (data, params) => safeParseAsync$1(inst, data, params);
|
|
7046
|
+
inst.check = (...checks) => {
|
|
7047
|
+
return inst.clone({
|
|
7048
|
+
...def,
|
|
7049
|
+
checks: [...def.checks ?? [], ...checks.map((ch) => typeof ch === "function" ? { _zod: {
|
|
7050
|
+
check: ch,
|
|
7051
|
+
def: { check: "custom" },
|
|
7052
|
+
onattach: []
|
|
7053
|
+
} } : ch)]
|
|
7054
|
+
}, { parent: true });
|
|
7055
|
+
};
|
|
7056
|
+
inst.with = inst.check;
|
|
7057
|
+
inst.clone = (_def, params) => clone(inst, _def, params);
|
|
7058
|
+
inst.brand = () => inst;
|
|
7059
|
+
inst.register = ((reg, meta) => {
|
|
7060
|
+
reg.add(inst, meta);
|
|
7061
|
+
return inst;
|
|
7062
|
+
});
|
|
7063
|
+
inst.apply = (fn) => fn(inst);
|
|
7064
|
+
});
|
|
7065
|
+
var ZodMiniString = /* @__PURE__ */ $constructor("ZodMiniString", (inst, def) => {
|
|
7066
|
+
$ZodString.init(inst, def);
|
|
7067
|
+
ZodMiniType.init(inst, def);
|
|
7068
|
+
});
|
|
7069
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
7070
|
+
function string(params) {
|
|
7071
|
+
return /* @__PURE__ */ _string(ZodMiniString, params);
|
|
7072
|
+
}
|
|
7073
|
+
//#endregion
|
|
7074
|
+
//#region src/util/mcp-server.ts
|
|
7075
|
+
var resourceToTool = (resource) => {
|
|
7076
|
+
const [name, template, { title, description }, cb] = resource;
|
|
7077
|
+
const hasInputSchema = !!template.uriTemplate.variableNames.length;
|
|
7078
|
+
return [
|
|
7079
|
+
name,
|
|
7080
|
+
{
|
|
7081
|
+
title,
|
|
7082
|
+
description,
|
|
7083
|
+
inputSchema: hasInputSchema ? Object.fromEntries(template.uriTemplate.variableNames.map((v) => [v, /* @__PURE__ */ string()])) : void 0,
|
|
7084
|
+
annotations: {
|
|
7085
|
+
readOnlyHint: true,
|
|
7086
|
+
destructiveHint: false,
|
|
7087
|
+
idempotentHint: true
|
|
7088
|
+
}
|
|
7089
|
+
},
|
|
7090
|
+
(async (...args) => {
|
|
7091
|
+
const [vars, extra] = hasInputSchema ? args : [{}, args.at(0)];
|
|
7092
|
+
const { contents } = await cb(new URL(template.uriTemplate.expand(vars)), vars, extra);
|
|
7093
|
+
return { content: contents.map((resource) => ({
|
|
7094
|
+
type: "resource",
|
|
7095
|
+
resource
|
|
7096
|
+
})) };
|
|
7097
|
+
})
|
|
7098
|
+
];
|
|
7099
|
+
};
|
|
7100
|
+
//#endregion
|
|
7018
7101
|
//#region src/server/server.ts
|
|
7019
7102
|
var { name, version, description } = package_default;
|
|
7020
|
-
|
|
7021
|
-
|
|
7022
|
-
|
|
7023
|
-
|
|
7024
|
-
|
|
7025
|
-
|
|
7026
|
-
|
|
7027
|
-
|
|
7028
|
-
|
|
7029
|
-
|
|
7030
|
-
|
|
7031
|
-
|
|
7032
|
-
|
|
7033
|
-
|
|
7034
|
-
* MCP server running as a http server.
|
|
7035
|
-
* `HOST` and `PORT` environment variable can be used to change the server settings.
|
|
7036
|
-
*/
|
|
7037
|
-
var run = async () => {
|
|
7038
|
-
const transport = new StreamableHTTPServerTransport({ sessionIdGenerator: () => randomUUID() });
|
|
7039
|
-
await server.connect(transport);
|
|
7040
|
-
const httpServer = createServer(transport.handleRequest);
|
|
7041
|
-
const PORT = Number.parseInt(process.env["PORT"] ?? "3000");
|
|
7042
|
-
const HOST = process.env["HOST"] ?? "0.0.0.0";
|
|
7043
|
-
httpServer.listen(PORT, HOST);
|
|
7044
|
-
log(`MCP http server listening on ${HOST}:${PORT}.`);
|
|
7103
|
+
var resources = [listComponents, getComponentApi];
|
|
7104
|
+
var createServer = ({ resourcesAsTools }) => {
|
|
7105
|
+
/**
|
|
7106
|
+
* Internal McpServer, which provides the MCP resources.
|
|
7107
|
+
*/
|
|
7108
|
+
const server = new McpServer({
|
|
7109
|
+
name,
|
|
7110
|
+
version,
|
|
7111
|
+
description,
|
|
7112
|
+
websiteUrl: "https://onyx.schwarz"
|
|
7113
|
+
});
|
|
7114
|
+
resources.forEach((resource) => server.registerResource(...resource));
|
|
7115
|
+
if (resourcesAsTools) resources.map((r) => resourceToTool(r)).forEach((t) => server.registerTool(...t));
|
|
7116
|
+
return server;
|
|
7045
7117
|
};
|
|
7046
7118
|
//#endregion
|
|
7047
7119
|
//#region src/server/stdio.ts
|
|
@@ -7049,7 +7121,7 @@ var run = async () => {
|
|
|
7049
7121
|
* MCP server running via stdio.
|
|
7050
7122
|
* All logging has to use stderr, otherwise the logging to stdio will break the transport.
|
|
7051
7123
|
*/
|
|
7052
|
-
var run$1 = async () => {
|
|
7124
|
+
var run$1 = async (server) => {
|
|
7053
7125
|
const transport = new StdioServerTransport();
|
|
7054
7126
|
await server.connect(transport);
|
|
7055
7127
|
error("MCP Server running on stdio.");
|
|
@@ -7061,7 +7133,7 @@ var SUPPORTED_TRANSPORTS = {
|
|
|
7061
7133
|
http: run
|
|
7062
7134
|
};
|
|
7063
7135
|
if (import.meta.main) {
|
|
7064
|
-
const { values: { transport, version, help } } = parseArgs({
|
|
7136
|
+
const { values: { transport, version, help, resourcesAsTools } } = parseArgs({
|
|
7065
7137
|
args: process.argv.slice(2),
|
|
7066
7138
|
options: {
|
|
7067
7139
|
transport: {
|
|
@@ -7069,6 +7141,11 @@ if (import.meta.main) {
|
|
|
7069
7141
|
short: "t",
|
|
7070
7142
|
default: "stdio"
|
|
7071
7143
|
},
|
|
7144
|
+
resourcesAsTools: {
|
|
7145
|
+
type: "boolean",
|
|
7146
|
+
short: "r",
|
|
7147
|
+
default: false
|
|
7148
|
+
},
|
|
7072
7149
|
help: {
|
|
7073
7150
|
type: "boolean",
|
|
7074
7151
|
short: "h",
|
|
@@ -7091,17 +7168,20 @@ Usage:
|
|
|
7091
7168
|
onyx-mcp [options]
|
|
7092
7169
|
|
|
7093
7170
|
Options:
|
|
7094
|
-
-t, --transport <stdio|http> Which kind of MCP server should be started (default: stdio)
|
|
7095
|
-
-
|
|
7096
|
-
|
|
7171
|
+
-t, --transport <stdio|http> Which kind of MCP server should be started (default: stdio).
|
|
7172
|
+
-r, --resourcesAsTools Some LLM Coding Assistants (e.g. Gemini) are not able to to use MCP resources (yet).
|
|
7173
|
+
This setting makes resources also available as tools to support these Coding Assistants.
|
|
7174
|
+
-h, --help Show this help text and quit.
|
|
7175
|
+
-v, --version Show version number and quit.`);
|
|
7097
7176
|
process.exit(0);
|
|
7098
7177
|
} else if (version) {
|
|
7099
7178
|
log(package_default.version);
|
|
7100
7179
|
process.exit(0);
|
|
7101
7180
|
} else {
|
|
7102
7181
|
if (!Object.keys(SUPPORTED_TRANSPORTS).includes(transport)) throw new Error(`Unsupported transport: ${transport}`);
|
|
7103
|
-
|
|
7182
|
+
const server = createServer({ resourcesAsTools });
|
|
7183
|
+
await SUPPORTED_TRANSPORTS[transport](server);
|
|
7104
7184
|
}
|
|
7105
7185
|
}
|
|
7106
7186
|
//#endregion
|
|
7107
|
-
export { run as http,
|
|
7187
|
+
export { createServer, run as http, run$1 as stdio };
|
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-20260409155058",
|
|
4
4
|
"description": "MCP (Model Context Protocol) Server that provide onyx specific tools and resources.",
|
|
5
5
|
"homepage": "https://onyx.schwarz",
|
|
6
6
|
"bugs": {
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"vite": "8.0.5",
|
|
35
35
|
"vite-plugin-dts": "^4.5.4",
|
|
36
36
|
"vue-component-meta": "^3.2.6",
|
|
37
|
+
"zod": "^4.3.6",
|
|
37
38
|
"@sit-onyx/shared": "^0.1.0"
|
|
38
39
|
},
|
|
39
40
|
"engines": {
|
|
@@ -42,7 +43,7 @@
|
|
|
42
43
|
"scripts": {
|
|
43
44
|
"dev": "pnpm run \"/build-dev|inspect-mcp/\"",
|
|
44
45
|
"build-dev": "vite build --ssr -w",
|
|
45
|
-
"inspect-mcp": "pnpm dlx @modelcontextprotocol/inspector
|
|
46
|
+
"inspect-mcp": "pnpm dlx @modelcontextprotocol/inspector --config inspector.json",
|
|
46
47
|
"build": "vite build --ssr"
|
|
47
48
|
}
|
|
48
49
|
}
|