nvidia-nim-mcp 1.0.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/.env.example +23 -0
- package/LICENSE +21 -0
- package/README.md +448 -0
- package/dist/client.d.ts +119 -0
- package/dist/client.js +178 -0
- package/dist/config.d.ts +24 -0
- package/dist/config.js +50 -0
- package/dist/handlers.d.ts +26 -0
- package/dist/handlers.js +255 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +107 -0
- package/dist/logger.d.ts +9 -0
- package/dist/logger.js +49 -0
- package/dist/models.d.ts +14 -0
- package/dist/models.js +202 -0
- package/dist/tools.d.ts +624 -0
- package/dist/tools.js +240 -0
- package/package.json +94 -0
- package/scripts/add-shebang.js +29 -0
- package/scripts/postinstall.js +37 -0
- package/scripts/verify-installation.js +56 -0
package/dist/logger.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import winston from "winston";
|
|
2
|
+
const { combine, timestamp, errors, json, colorize, simple } = winston.format;
|
|
3
|
+
// Initialize logger with default configuration
|
|
4
|
+
export let logger = winston.createLogger({
|
|
5
|
+
level: "info",
|
|
6
|
+
format: combine(timestamp({ format: "YYYY-MM-DD HH:mm:ss.SSS" }), errors({ stack: true }), combine(colorize({ all: true }), simple())),
|
|
7
|
+
defaultMeta: {
|
|
8
|
+
service: "nvidia-nim-mcp",
|
|
9
|
+
version: "1.0.0",
|
|
10
|
+
},
|
|
11
|
+
transports: [
|
|
12
|
+
new winston.transports.Console({
|
|
13
|
+
stderrLevels: ["error", "warn"],
|
|
14
|
+
}),
|
|
15
|
+
],
|
|
16
|
+
});
|
|
17
|
+
export function initLogger(options) {
|
|
18
|
+
const { logLevel, isProduction, mcpServerVersion } = options;
|
|
19
|
+
logger = winston.createLogger({
|
|
20
|
+
level: logLevel,
|
|
21
|
+
format: combine(timestamp({ format: "YYYY-MM-DD HH:mm:ss.SSS" }), errors({ stack: true }), isProduction
|
|
22
|
+
? json()
|
|
23
|
+
: combine(colorize({ all: true }), simple())),
|
|
24
|
+
defaultMeta: {
|
|
25
|
+
service: "nvidia-nim-mcp",
|
|
26
|
+
version: mcpServerVersion,
|
|
27
|
+
},
|
|
28
|
+
transports: [
|
|
29
|
+
new winston.transports.Console({
|
|
30
|
+
stderrLevels: ["error", "warn"],
|
|
31
|
+
}),
|
|
32
|
+
],
|
|
33
|
+
});
|
|
34
|
+
// Log to file in production
|
|
35
|
+
if (isProduction) {
|
|
36
|
+
logger.add(new winston.transports.File({
|
|
37
|
+
filename: "logs/error.log",
|
|
38
|
+
level: "error",
|
|
39
|
+
maxsize: 10 * 1024 * 1024, // 10MB
|
|
40
|
+
maxFiles: 5,
|
|
41
|
+
}));
|
|
42
|
+
logger.add(new winston.transports.File({
|
|
43
|
+
filename: "logs/combined.log",
|
|
44
|
+
maxsize: 10 * 1024 * 1024, // 10MB
|
|
45
|
+
maxFiles: 10,
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
return logger;
|
|
49
|
+
}
|
package/dist/models.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface NIMModel {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
category: ModelCategory;
|
|
6
|
+
contextLength: number;
|
|
7
|
+
supportsStreaming: boolean;
|
|
8
|
+
supportsFunctionCalling: boolean;
|
|
9
|
+
supportsVision?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export type ModelCategory = "language" | "embedding" | "reranking" | "vision" | "code" | "multimodal";
|
|
12
|
+
export declare const NIM_MODELS: Record<string, NIMModel>;
|
|
13
|
+
export declare function getModelsByCategory(category: ModelCategory): NIMModel[];
|
|
14
|
+
export declare function getModel(modelId: string): NIMModel | undefined;
|
package/dist/models.js
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
export const NIM_MODELS = {
|
|
2
|
+
// === LLMs ===
|
|
3
|
+
"meta/llama-3.1-405b-instruct": {
|
|
4
|
+
id: "meta/llama-3.1-405b-instruct",
|
|
5
|
+
name: "Llama 3.1 405B Instruct",
|
|
6
|
+
description: "Meta's largest Llama 3.1 model, best for complex reasoning",
|
|
7
|
+
category: "language",
|
|
8
|
+
contextLength: 128000,
|
|
9
|
+
supportsStreaming: true,
|
|
10
|
+
supportsFunctionCalling: true,
|
|
11
|
+
},
|
|
12
|
+
"meta/llama-3.1-70b-instruct": {
|
|
13
|
+
id: "meta/llama-3.1-70b-instruct",
|
|
14
|
+
name: "Llama 3.1 70B Instruct",
|
|
15
|
+
description: "Balanced performance and efficiency",
|
|
16
|
+
category: "language",
|
|
17
|
+
contextLength: 128000,
|
|
18
|
+
supportsStreaming: true,
|
|
19
|
+
supportsFunctionCalling: true,
|
|
20
|
+
},
|
|
21
|
+
"meta/llama-3.1-8b-instruct": {
|
|
22
|
+
id: "meta/llama-3.1-8b-instruct",
|
|
23
|
+
name: "Llama 3.1 8B Instruct",
|
|
24
|
+
description: "Fast and efficient for simpler tasks",
|
|
25
|
+
category: "language",
|
|
26
|
+
contextLength: 128000,
|
|
27
|
+
supportsStreaming: true,
|
|
28
|
+
supportsFunctionCalling: true,
|
|
29
|
+
},
|
|
30
|
+
"meta/llama-3.2-90b-vision-instruct": {
|
|
31
|
+
id: "meta/llama-3.2-90b-vision-instruct",
|
|
32
|
+
name: "Llama 3.2 90B Vision Instruct",
|
|
33
|
+
description: "Multimodal model with vision capabilities",
|
|
34
|
+
category: "vision",
|
|
35
|
+
contextLength: 128000,
|
|
36
|
+
supportsStreaming: true,
|
|
37
|
+
supportsFunctionCalling: false,
|
|
38
|
+
supportsVision: true,
|
|
39
|
+
},
|
|
40
|
+
"meta/llama-3.2-11b-vision-instruct": {
|
|
41
|
+
id: "meta/llama-3.2-11b-vision-instruct",
|
|
42
|
+
name: "Llama 3.2 11B Vision Instruct",
|
|
43
|
+
description: "Efficient multimodal model",
|
|
44
|
+
category: "vision",
|
|
45
|
+
contextLength: 128000,
|
|
46
|
+
supportsStreaming: true,
|
|
47
|
+
supportsFunctionCalling: false,
|
|
48
|
+
supportsVision: true,
|
|
49
|
+
},
|
|
50
|
+
"mistralai/mistral-large-2-instruct": {
|
|
51
|
+
id: "mistralai/mistral-large-2-instruct",
|
|
52
|
+
name: "Mistral Large 2",
|
|
53
|
+
description: "Mistral's flagship model with excellent reasoning",
|
|
54
|
+
category: "language",
|
|
55
|
+
contextLength: 131072,
|
|
56
|
+
supportsStreaming: true,
|
|
57
|
+
supportsFunctionCalling: true,
|
|
58
|
+
},
|
|
59
|
+
"mistralai/mixtral-8x22b-instruct-v0.1": {
|
|
60
|
+
id: "mistralai/mixtral-8x22b-instruct-v0.1",
|
|
61
|
+
name: "Mixtral 8x22B Instruct",
|
|
62
|
+
description: "MoE model with excellent performance",
|
|
63
|
+
category: "language",
|
|
64
|
+
contextLength: 65536,
|
|
65
|
+
supportsStreaming: true,
|
|
66
|
+
supportsFunctionCalling: true,
|
|
67
|
+
},
|
|
68
|
+
"mistralai/mixtral-8x7b-instruct-v0.1": {
|
|
69
|
+
id: "mistralai/mixtral-8x7b-instruct-v0.1",
|
|
70
|
+
name: "Mixtral 8x7B Instruct",
|
|
71
|
+
description: "Efficient MoE model",
|
|
72
|
+
category: "language",
|
|
73
|
+
contextLength: 32768,
|
|
74
|
+
supportsStreaming: true,
|
|
75
|
+
supportsFunctionCalling: false,
|
|
76
|
+
},
|
|
77
|
+
"microsoft/phi-3.5-mini-instruct": {
|
|
78
|
+
id: "microsoft/phi-3.5-mini-instruct",
|
|
79
|
+
name: "Phi-3.5 Mini Instruct",
|
|
80
|
+
description: "Microsoft's efficient small model",
|
|
81
|
+
category: "language",
|
|
82
|
+
contextLength: 128000,
|
|
83
|
+
supportsStreaming: true,
|
|
84
|
+
supportsFunctionCalling: false,
|
|
85
|
+
},
|
|
86
|
+
"microsoft/phi-3-medium-128k-instruct": {
|
|
87
|
+
id: "microsoft/phi-3-medium-128k-instruct",
|
|
88
|
+
name: "Phi-3 Medium 128K Instruct",
|
|
89
|
+
description: "Microsoft's medium model with long context",
|
|
90
|
+
category: "language",
|
|
91
|
+
contextLength: 128000,
|
|
92
|
+
supportsStreaming: true,
|
|
93
|
+
supportsFunctionCalling: false,
|
|
94
|
+
},
|
|
95
|
+
"google/gemma-2-27b-it": {
|
|
96
|
+
id: "google/gemma-2-27b-it",
|
|
97
|
+
name: "Gemma 2 27B IT",
|
|
98
|
+
description: "Google's Gemma 2 model",
|
|
99
|
+
category: "language",
|
|
100
|
+
contextLength: 8192,
|
|
101
|
+
supportsStreaming: true,
|
|
102
|
+
supportsFunctionCalling: false,
|
|
103
|
+
},
|
|
104
|
+
"google/gemma-2-9b-it": {
|
|
105
|
+
id: "google/gemma-2-9b-it",
|
|
106
|
+
name: "Gemma 2 9B IT",
|
|
107
|
+
description: "Google's efficient Gemma 2 model",
|
|
108
|
+
category: "language",
|
|
109
|
+
contextLength: 8192,
|
|
110
|
+
supportsStreaming: true,
|
|
111
|
+
supportsFunctionCalling: false,
|
|
112
|
+
},
|
|
113
|
+
"qwen/qwen2.5-72b-instruct": {
|
|
114
|
+
id: "qwen/qwen2.5-72b-instruct",
|
|
115
|
+
name: "Qwen 2.5 72B Instruct",
|
|
116
|
+
description: "Alibaba's Qwen 2.5 large model",
|
|
117
|
+
category: "language",
|
|
118
|
+
contextLength: 131072,
|
|
119
|
+
supportsStreaming: true,
|
|
120
|
+
supportsFunctionCalling: true,
|
|
121
|
+
},
|
|
122
|
+
"qwen/qwen2.5-coder-32b-instruct": {
|
|
123
|
+
id: "qwen/qwen2.5-coder-32b-instruct",
|
|
124
|
+
name: "Qwen 2.5 Coder 32B",
|
|
125
|
+
description: "Specialized coding model",
|
|
126
|
+
category: "code",
|
|
127
|
+
contextLength: 131072,
|
|
128
|
+
supportsStreaming: true,
|
|
129
|
+
supportsFunctionCalling: false,
|
|
130
|
+
},
|
|
131
|
+
"nvidia/llama-3.1-nemotron-70b-instruct": {
|
|
132
|
+
id: "nvidia/llama-3.1-nemotron-70b-instruct",
|
|
133
|
+
name: "Nemotron 70B Instruct",
|
|
134
|
+
description: "NVIDIA's fine-tuned Llama with RLHF",
|
|
135
|
+
category: "language",
|
|
136
|
+
contextLength: 131072,
|
|
137
|
+
supportsStreaming: true,
|
|
138
|
+
supportsFunctionCalling: false,
|
|
139
|
+
},
|
|
140
|
+
"z-ai/glm-4-9b-chat": {
|
|
141
|
+
id: "z-ai/glm-4-9b-chat",
|
|
142
|
+
name: "GLM-4 9B Chat",
|
|
143
|
+
description: "Zhipu AI's GLM-4 model, strong multilingual and reasoning capabilities",
|
|
144
|
+
category: "language",
|
|
145
|
+
contextLength: 128000,
|
|
146
|
+
supportsStreaming: true,
|
|
147
|
+
supportsFunctionCalling: false,
|
|
148
|
+
},
|
|
149
|
+
"z-ai/glm5": {
|
|
150
|
+
id: "z-ai/glm5",
|
|
151
|
+
name: "GLM-5",
|
|
152
|
+
description: "Zhipu AI's GLM-5 model specialized in software development and architecture - excels at code generation, debugging, refactoring, and system design",
|
|
153
|
+
category: "code",
|
|
154
|
+
contextLength: 128000,
|
|
155
|
+
supportsStreaming: true,
|
|
156
|
+
supportsFunctionCalling: true,
|
|
157
|
+
},
|
|
158
|
+
// === Embeddings ===
|
|
159
|
+
"nvidia/nv-embedqa-e5-v5": {
|
|
160
|
+
id: "nvidia/nv-embedqa-e5-v5",
|
|
161
|
+
name: "NV-EmbedQA E5 v5",
|
|
162
|
+
description: "NVIDIA embedding model optimized for Q&A retrieval",
|
|
163
|
+
category: "embedding",
|
|
164
|
+
contextLength: 512,
|
|
165
|
+
supportsStreaming: false,
|
|
166
|
+
supportsFunctionCalling: false,
|
|
167
|
+
},
|
|
168
|
+
"nvidia/nv-embed-v1": {
|
|
169
|
+
id: "nvidia/nv-embed-v1",
|
|
170
|
+
name: "NV-Embed v1",
|
|
171
|
+
description: "NVIDIA general purpose embedding model",
|
|
172
|
+
category: "embedding",
|
|
173
|
+
contextLength: 4096,
|
|
174
|
+
supportsStreaming: false,
|
|
175
|
+
supportsFunctionCalling: false,
|
|
176
|
+
},
|
|
177
|
+
"baai/bge-m3": {
|
|
178
|
+
id: "baai/bge-m3",
|
|
179
|
+
name: "BGE-M3",
|
|
180
|
+
description: "Multilingual embedding model",
|
|
181
|
+
category: "embedding",
|
|
182
|
+
contextLength: 8192,
|
|
183
|
+
supportsStreaming: false,
|
|
184
|
+
supportsFunctionCalling: false,
|
|
185
|
+
},
|
|
186
|
+
// === Reranking ===
|
|
187
|
+
"nvidia/nv-rerankqa-mistral-4b-v3": {
|
|
188
|
+
id: "nvidia/nv-rerankqa-mistral-4b-v3",
|
|
189
|
+
name: "NV-RerankQA Mistral 4B v3",
|
|
190
|
+
description: "NVIDIA reranking model for RAG pipelines",
|
|
191
|
+
category: "reranking",
|
|
192
|
+
contextLength: 4096,
|
|
193
|
+
supportsStreaming: false,
|
|
194
|
+
supportsFunctionCalling: false,
|
|
195
|
+
},
|
|
196
|
+
};
|
|
197
|
+
export function getModelsByCategory(category) {
|
|
198
|
+
return Object.values(NIM_MODELS).filter((m) => m.category === category);
|
|
199
|
+
}
|
|
200
|
+
export function getModel(modelId) {
|
|
201
|
+
return NIM_MODELS[modelId];
|
|
202
|
+
}
|