@smithery/sdk 0.0.4
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/LICENSE +674 -0
- package/README.md +126 -0
- package/dist/examples/shell.d.ts +1 -0
- package/dist/examples/shell.js +78 -0
- package/dist/examples/simple.d.ts +1 -0
- package/dist/examples/simple.js +60 -0
- package/dist/index.d.ts +147 -0
- package/dist/index.js +75 -0
- package/dist/integrations/llm/anthropic.d.ts +11 -0
- package/dist/integrations/llm/anthropic.js +49 -0
- package/dist/integrations/llm/openai.d.ts +12 -0
- package/dist/integrations/llm/openai.js +46 -0
- package/dist/types.d.ts +193 -0
- package/dist/types.js +41 -0
- package/package.json +39 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
export declare const MCPConfigSchema: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodType<Server<{
|
|
4
|
+
method: string;
|
|
5
|
+
params?: z.objectOutputType<{
|
|
6
|
+
_meta: z.ZodOptional<z.ZodObject<{
|
|
7
|
+
progressToken: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
8
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
9
|
+
progressToken: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
10
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
11
|
+
progressToken: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
12
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
13
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
14
|
+
}, {
|
|
15
|
+
method: string;
|
|
16
|
+
params?: z.objectOutputType<{
|
|
17
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
18
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
19
|
+
}, z.objectOutputType<{
|
|
20
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
21
|
+
}, z.ZodTypeAny, "passthrough">>, z.ZodTypeDef, Server<{
|
|
22
|
+
method: string;
|
|
23
|
+
params?: z.objectOutputType<{
|
|
24
|
+
_meta: z.ZodOptional<z.ZodObject<{
|
|
25
|
+
progressToken: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
26
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
27
|
+
progressToken: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
28
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
29
|
+
progressToken: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
30
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
31
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
32
|
+
}, {
|
|
33
|
+
method: string;
|
|
34
|
+
params?: z.objectOutputType<{
|
|
35
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
36
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
37
|
+
}, z.objectOutputType<{
|
|
38
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
39
|
+
}, z.ZodTypeAny, "passthrough">>>, z.ZodObject<{
|
|
40
|
+
server: z.ZodType<Server<{
|
|
41
|
+
method: string;
|
|
42
|
+
params?: z.objectOutputType<{
|
|
43
|
+
_meta: z.ZodOptional<z.ZodObject<{
|
|
44
|
+
progressToken: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
45
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
46
|
+
progressToken: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
47
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
48
|
+
progressToken: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
49
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
50
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
51
|
+
}, {
|
|
52
|
+
method: string;
|
|
53
|
+
params?: z.objectOutputType<{
|
|
54
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
55
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
56
|
+
}, z.objectOutputType<{
|
|
57
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
58
|
+
}, z.ZodTypeAny, "passthrough">>, z.ZodTypeDef, Server<{
|
|
59
|
+
method: string;
|
|
60
|
+
params?: z.objectOutputType<{
|
|
61
|
+
_meta: z.ZodOptional<z.ZodObject<{
|
|
62
|
+
progressToken: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
63
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
64
|
+
progressToken: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
65
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
66
|
+
progressToken: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
67
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
68
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
69
|
+
}, {
|
|
70
|
+
method: string;
|
|
71
|
+
params?: z.objectOutputType<{
|
|
72
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
73
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
74
|
+
}, z.objectOutputType<{
|
|
75
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
76
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
77
|
+
}, "strip", z.ZodTypeAny, {
|
|
78
|
+
server: Server<{
|
|
79
|
+
method: string;
|
|
80
|
+
params?: z.objectOutputType<{
|
|
81
|
+
_meta: z.ZodOptional<z.ZodObject<{
|
|
82
|
+
progressToken: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
83
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
84
|
+
progressToken: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
85
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
86
|
+
progressToken: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
87
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
88
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
89
|
+
}, {
|
|
90
|
+
method: string;
|
|
91
|
+
params?: z.objectOutputType<{
|
|
92
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
93
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
94
|
+
}, z.objectOutputType<{
|
|
95
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
96
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
97
|
+
}, {
|
|
98
|
+
server: Server<{
|
|
99
|
+
method: string;
|
|
100
|
+
params?: z.objectOutputType<{
|
|
101
|
+
_meta: z.ZodOptional<z.ZodObject<{
|
|
102
|
+
progressToken: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
103
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
104
|
+
progressToken: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
105
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
106
|
+
progressToken: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
107
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
108
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
109
|
+
}, {
|
|
110
|
+
method: string;
|
|
111
|
+
params?: z.objectOutputType<{
|
|
112
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
113
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
114
|
+
}, z.objectOutputType<{
|
|
115
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
116
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
117
|
+
}>, z.ZodObject<{
|
|
118
|
+
url: z.ZodString;
|
|
119
|
+
}, "strip", z.ZodTypeAny, {
|
|
120
|
+
url: string;
|
|
121
|
+
}, {
|
|
122
|
+
url: string;
|
|
123
|
+
}>, z.ZodObject<{
|
|
124
|
+
stdio: z.ZodObject<{
|
|
125
|
+
command: z.ZodString;
|
|
126
|
+
args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
127
|
+
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
128
|
+
}, "strip", z.ZodTypeAny, {
|
|
129
|
+
command: string;
|
|
130
|
+
args?: string[] | undefined;
|
|
131
|
+
env?: Record<string, string> | undefined;
|
|
132
|
+
}, {
|
|
133
|
+
command: string;
|
|
134
|
+
args?: string[] | undefined;
|
|
135
|
+
env?: Record<string, string> | undefined;
|
|
136
|
+
}>;
|
|
137
|
+
}, "strip", z.ZodTypeAny, {
|
|
138
|
+
stdio: {
|
|
139
|
+
command: string;
|
|
140
|
+
args?: string[] | undefined;
|
|
141
|
+
env?: Record<string, string> | undefined;
|
|
142
|
+
};
|
|
143
|
+
}, {
|
|
144
|
+
stdio: {
|
|
145
|
+
command: string;
|
|
146
|
+
args?: string[] | undefined;
|
|
147
|
+
env?: Record<string, string> | undefined;
|
|
148
|
+
};
|
|
149
|
+
}>]>>;
|
|
150
|
+
export type MCPConfig = z.infer<typeof MCPConfigSchema>;
|
|
151
|
+
export declare function isServerConfig(config: any): config is Server;
|
|
152
|
+
export declare function isURIConfig(config: MCPConfig[string]): config is {
|
|
153
|
+
url: string;
|
|
154
|
+
};
|
|
155
|
+
export declare function isStdioConfig(config: MCPConfig[string]): config is {
|
|
156
|
+
stdio: {
|
|
157
|
+
command: string;
|
|
158
|
+
args?: string[];
|
|
159
|
+
env?: Record<string, string>;
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
export declare function isWrappedServerConfig(config: any): config is {
|
|
163
|
+
server: Server;
|
|
164
|
+
};
|
|
165
|
+
export declare const ToolSchema: z.ZodObject<{
|
|
166
|
+
name: z.ZodString;
|
|
167
|
+
description: z.ZodOptional<z.ZodString>;
|
|
168
|
+
inputSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
169
|
+
}, "strip", z.ZodTypeAny, {
|
|
170
|
+
name: string;
|
|
171
|
+
inputSchema: Record<string, unknown>;
|
|
172
|
+
description?: string | undefined;
|
|
173
|
+
}, {
|
|
174
|
+
name: string;
|
|
175
|
+
inputSchema: Record<string, unknown>;
|
|
176
|
+
description?: string | undefined;
|
|
177
|
+
}>;
|
|
178
|
+
export declare const ToolsSchema: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodObject<{
|
|
179
|
+
name: z.ZodString;
|
|
180
|
+
description: z.ZodOptional<z.ZodString>;
|
|
181
|
+
inputSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
182
|
+
}, "strip", z.ZodTypeAny, {
|
|
183
|
+
name: string;
|
|
184
|
+
inputSchema: Record<string, unknown>;
|
|
185
|
+
description?: string | undefined;
|
|
186
|
+
}, {
|
|
187
|
+
name: string;
|
|
188
|
+
inputSchema: Record<string, unknown>;
|
|
189
|
+
description?: string | undefined;
|
|
190
|
+
}>, "many">>;
|
|
191
|
+
export interface Tool extends z.infer<typeof ToolSchema> {
|
|
192
|
+
}
|
|
193
|
+
export type Tools = z.infer<typeof ToolsSchema>;
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
export const MCPConfigSchema = z.record(z.string(), z.union([
|
|
4
|
+
z.instanceof(Server),
|
|
5
|
+
z.object({ server: z.instanceof(Server) }),
|
|
6
|
+
z.object({ url: z.string() }),
|
|
7
|
+
z.object({
|
|
8
|
+
stdio: z.object({
|
|
9
|
+
command: z
|
|
10
|
+
.string()
|
|
11
|
+
.describe("The executable to run to start the server."),
|
|
12
|
+
args: z
|
|
13
|
+
.array(z.string())
|
|
14
|
+
.optional()
|
|
15
|
+
.describe("Command line arguments to pass to the executable."),
|
|
16
|
+
env: z
|
|
17
|
+
.record(z.string(), z.string())
|
|
18
|
+
.optional()
|
|
19
|
+
.describe("The environment to use when spawning the process. If not specified, the result of getDefaultEnvironment() will be used."),
|
|
20
|
+
}),
|
|
21
|
+
}),
|
|
22
|
+
]));
|
|
23
|
+
// Type guards
|
|
24
|
+
export function isServerConfig(config) {
|
|
25
|
+
return config instanceof Server;
|
|
26
|
+
}
|
|
27
|
+
export function isURIConfig(config) {
|
|
28
|
+
return "url" in config && typeof config.url === "string";
|
|
29
|
+
}
|
|
30
|
+
export function isStdioConfig(config) {
|
|
31
|
+
return "stdio" in config;
|
|
32
|
+
}
|
|
33
|
+
export function isWrappedServerConfig(config) {
|
|
34
|
+
return "server" in config && config.server instanceof Server;
|
|
35
|
+
}
|
|
36
|
+
export const ToolSchema = z.object({
|
|
37
|
+
name: z.string(),
|
|
38
|
+
description: z.string().optional(),
|
|
39
|
+
inputSchema: z.record(z.unknown()),
|
|
40
|
+
});
|
|
41
|
+
export const ToolsSchema = z.record(z.array(ToolSchema));
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@smithery/sdk",
|
|
3
|
+
"version": "0.0.4",
|
|
4
|
+
"description": "Connect language models to Model Context Protocols",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./dist/index.js",
|
|
10
|
+
"./*": "./dist/*"
|
|
11
|
+
},
|
|
12
|
+
"files": ["dist"],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "tsc",
|
|
15
|
+
"watch": "tsc --watch",
|
|
16
|
+
"lint": "npx @biomejs/biome lint --write",
|
|
17
|
+
"format": "npx @biomejs/biome format --write"
|
|
18
|
+
},
|
|
19
|
+
"license": "GPL-3.0-only",
|
|
20
|
+
"workspaces": ["mcps/*"],
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@anthropic-ai/sdk": "^0.32.1",
|
|
23
|
+
"@modelcontextprotocol/sdk": "^1.0.3",
|
|
24
|
+
"openai": "^4.0.0",
|
|
25
|
+
"uuid": "^11.0.3"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@types/eventsource": "^1.1.15",
|
|
29
|
+
"@types/node": "^20.0.0",
|
|
30
|
+
"@types/uuid": "^9.0.7",
|
|
31
|
+
"@smithery/mcp-e2b": "*",
|
|
32
|
+
"@smithery/mcp-exa": "*",
|
|
33
|
+
"@smithery/mcp-shell": "*",
|
|
34
|
+
"dotenv": "^16.4.7",
|
|
35
|
+
"eventsource": "^2.0.2",
|
|
36
|
+
"tsx": "^4.19.2",
|
|
37
|
+
"typescript": "^5.0.0"
|
|
38
|
+
}
|
|
39
|
+
}
|