@universal-mcp-toolkit/server-vercel 0.1.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/.well-known/mcp-server.json +36 -0
- package/LICENSE +21 -0
- package/dist/index.d.ts +77 -0
- package/dist/index.js +401 -0
- package/package.json +53 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/json",
|
|
3
|
+
"name": "vercel",
|
|
4
|
+
"title": "Vercel MCP Server",
|
|
5
|
+
"description": "Project, deployment, and account tools for Vercel.",
|
|
6
|
+
"version": "0.1.0",
|
|
7
|
+
"packageName": "@universal-mcp-toolkit/server-vercel",
|
|
8
|
+
"homepage": "https://github.com/universal-mcp-toolkit/universal-mcp-toolkit",
|
|
9
|
+
"transports": [
|
|
10
|
+
"stdio",
|
|
11
|
+
"sse"
|
|
12
|
+
],
|
|
13
|
+
"authentication": {
|
|
14
|
+
"mode": "environment-variables",
|
|
15
|
+
"required": [
|
|
16
|
+
"VERCEL_TOKEN",
|
|
17
|
+
"VERCEL_TEAM_ID"
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
"capabilities": {
|
|
21
|
+
"tools": true,
|
|
22
|
+
"resources": true,
|
|
23
|
+
"prompts": true
|
|
24
|
+
},
|
|
25
|
+
"tools": [
|
|
26
|
+
"list_projects",
|
|
27
|
+
"list_deployments",
|
|
28
|
+
"get_deployment"
|
|
29
|
+
],
|
|
30
|
+
"resources": [
|
|
31
|
+
"account"
|
|
32
|
+
],
|
|
33
|
+
"prompts": [
|
|
34
|
+
"deployment-audit"
|
|
35
|
+
]
|
|
36
|
+
}
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 universal-mcp-toolkit
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import * as _universal_mcp_toolkit_core from '@universal-mcp-toolkit/core';
|
|
2
|
+
import { ToolkitServer, ToolkitServerMetadata } from '@universal-mcp-toolkit/core';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
|
|
5
|
+
declare const metadata: ToolkitServerMetadata;
|
|
6
|
+
declare const serverCard: _universal_mcp_toolkit_core.ToolkitServerCard;
|
|
7
|
+
declare const projectSummarySchema: z.ZodObject<{
|
|
8
|
+
id: z.ZodString;
|
|
9
|
+
name: z.ZodString;
|
|
10
|
+
framework: z.ZodNullable<z.ZodString>;
|
|
11
|
+
latestProductionUrl: z.ZodNullable<z.ZodString>;
|
|
12
|
+
createdAt: z.ZodNullable<z.ZodString>;
|
|
13
|
+
updatedAt: z.ZodNullable<z.ZodString>;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
declare const deploymentSummarySchema: z.ZodObject<{
|
|
16
|
+
id: z.ZodString;
|
|
17
|
+
projectName: z.ZodString;
|
|
18
|
+
url: z.ZodString;
|
|
19
|
+
state: z.ZodString;
|
|
20
|
+
target: z.ZodNullable<z.ZodString>;
|
|
21
|
+
createdAt: z.ZodNullable<z.ZodString>;
|
|
22
|
+
readyState: z.ZodNullable<z.ZodString>;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
declare const deploymentDetailSchema: z.ZodObject<{
|
|
25
|
+
id: z.ZodString;
|
|
26
|
+
projectName: z.ZodString;
|
|
27
|
+
url: z.ZodString;
|
|
28
|
+
state: z.ZodString;
|
|
29
|
+
target: z.ZodNullable<z.ZodString>;
|
|
30
|
+
createdAt: z.ZodNullable<z.ZodString>;
|
|
31
|
+
readyState: z.ZodNullable<z.ZodString>;
|
|
32
|
+
alias: z.ZodArray<z.ZodString>;
|
|
33
|
+
inspectorUrl: z.ZodNullable<z.ZodString>;
|
|
34
|
+
creator: z.ZodObject<{
|
|
35
|
+
id: z.ZodNullable<z.ZodString>;
|
|
36
|
+
username: z.ZodNullable<z.ZodString>;
|
|
37
|
+
email: z.ZodNullable<z.ZodString>;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
meta: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
40
|
+
}, z.core.$strip>;
|
|
41
|
+
declare const accountSummarySchema: z.ZodObject<{
|
|
42
|
+
id: z.ZodString;
|
|
43
|
+
username: z.ZodNullable<z.ZodString>;
|
|
44
|
+
email: z.ZodNullable<z.ZodString>;
|
|
45
|
+
name: z.ZodNullable<z.ZodString>;
|
|
46
|
+
defaultTeamId: z.ZodNullable<z.ZodString>;
|
|
47
|
+
}, z.core.$strip>;
|
|
48
|
+
type VercelProjectSummary = z.infer<typeof projectSummarySchema>;
|
|
49
|
+
type VercelDeploymentSummary = z.infer<typeof deploymentSummarySchema>;
|
|
50
|
+
type VercelDeploymentDetail = z.infer<typeof deploymentDetailSchema>;
|
|
51
|
+
type VercelAccountSummary = z.infer<typeof accountSummarySchema>;
|
|
52
|
+
interface VercelClient {
|
|
53
|
+
listProjects(input: {
|
|
54
|
+
limit: number;
|
|
55
|
+
search?: string;
|
|
56
|
+
}): Promise<ReadonlyArray<VercelProjectSummary>>;
|
|
57
|
+
listDeployments(input: {
|
|
58
|
+
limit: number;
|
|
59
|
+
projectId?: string;
|
|
60
|
+
target?: string;
|
|
61
|
+
}): Promise<ReadonlyArray<VercelDeploymentSummary>>;
|
|
62
|
+
getDeployment(deploymentId: string): Promise<VercelDeploymentDetail>;
|
|
63
|
+
getAccountSummary(): Promise<VercelAccountSummary>;
|
|
64
|
+
}
|
|
65
|
+
interface CreateVercelServerOptions {
|
|
66
|
+
client?: VercelClient;
|
|
67
|
+
env?: NodeJS.ProcessEnv;
|
|
68
|
+
fetch?: typeof fetch;
|
|
69
|
+
}
|
|
70
|
+
declare class VercelServer extends ToolkitServer {
|
|
71
|
+
private readonly client;
|
|
72
|
+
constructor(client: VercelClient);
|
|
73
|
+
}
|
|
74
|
+
declare function createServer(options?: CreateVercelServerOptions): Promise<VercelServer>;
|
|
75
|
+
declare function main(argv?: readonly string[]): Promise<void>;
|
|
76
|
+
|
|
77
|
+
export { type CreateVercelServerOptions, type VercelAccountSummary, type VercelClient, type VercelDeploymentDetail, type VercelDeploymentSummary, type VercelProjectSummary, VercelServer, createServer, main, metadata, serverCard };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import {
|
|
3
|
+
createServerCard,
|
|
4
|
+
defineTool,
|
|
5
|
+
ExternalServiceError,
|
|
6
|
+
loadEnv,
|
|
7
|
+
parseRuntimeOptions,
|
|
8
|
+
runToolkitServer,
|
|
9
|
+
ToolkitServer
|
|
10
|
+
} from "@universal-mcp-toolkit/core";
|
|
11
|
+
import { resolve } from "path";
|
|
12
|
+
import { fileURLToPath } from "url";
|
|
13
|
+
import { z } from "zod";
|
|
14
|
+
var toolNames = ["list_projects", "list_deployments", "get_deployment"];
|
|
15
|
+
var resourceNames = ["account"];
|
|
16
|
+
var promptNames = ["deployment-audit"];
|
|
17
|
+
var metadata = {
|
|
18
|
+
id: "vercel",
|
|
19
|
+
title: "Vercel MCP Server",
|
|
20
|
+
description: "Project, deployment, and account tools for Vercel.",
|
|
21
|
+
version: "0.1.0",
|
|
22
|
+
packageName: "@universal-mcp-toolkit/server-vercel",
|
|
23
|
+
homepage: "https://github.com/universal-mcp-toolkit/universal-mcp-toolkit",
|
|
24
|
+
repositoryUrl: "https://github.com/universal-mcp-toolkit/universal-mcp-toolkit",
|
|
25
|
+
documentationUrl: "https://github.com/universal-mcp-toolkit/universal-mcp-toolkit/tree/main/servers/vercel",
|
|
26
|
+
envVarNames: ["VERCEL_TOKEN", "VERCEL_TEAM_ID"],
|
|
27
|
+
transports: ["stdio", "sse"],
|
|
28
|
+
toolNames,
|
|
29
|
+
resourceNames,
|
|
30
|
+
promptNames
|
|
31
|
+
};
|
|
32
|
+
var serverCard = createServerCard(metadata);
|
|
33
|
+
var envShape = {
|
|
34
|
+
VERCEL_TOKEN: z.string().min(1),
|
|
35
|
+
VERCEL_TEAM_ID: z.string().min(1).optional(),
|
|
36
|
+
VERCEL_API_BASE_URL: z.string().url().optional()
|
|
37
|
+
};
|
|
38
|
+
var projectSummarySchema = z.object({
|
|
39
|
+
id: z.string(),
|
|
40
|
+
name: z.string(),
|
|
41
|
+
framework: z.string().nullable(),
|
|
42
|
+
latestProductionUrl: z.string().nullable(),
|
|
43
|
+
createdAt: z.string().nullable(),
|
|
44
|
+
updatedAt: z.string().nullable()
|
|
45
|
+
});
|
|
46
|
+
var deploymentSummarySchema = z.object({
|
|
47
|
+
id: z.string(),
|
|
48
|
+
projectName: z.string(),
|
|
49
|
+
url: z.string(),
|
|
50
|
+
state: z.string(),
|
|
51
|
+
target: z.string().nullable(),
|
|
52
|
+
createdAt: z.string().nullable(),
|
|
53
|
+
readyState: z.string().nullable()
|
|
54
|
+
});
|
|
55
|
+
var deploymentDetailSchema = deploymentSummarySchema.extend({
|
|
56
|
+
alias: z.array(z.string()),
|
|
57
|
+
inspectorUrl: z.string().nullable(),
|
|
58
|
+
creator: z.object({
|
|
59
|
+
id: z.string().nullable(),
|
|
60
|
+
username: z.string().nullable(),
|
|
61
|
+
email: z.string().nullable()
|
|
62
|
+
}),
|
|
63
|
+
meta: z.record(z.string(), z.string()).default({})
|
|
64
|
+
});
|
|
65
|
+
var accountSummarySchema = z.object({
|
|
66
|
+
id: z.string(),
|
|
67
|
+
username: z.string().nullable(),
|
|
68
|
+
email: z.string().nullable(),
|
|
69
|
+
name: z.string().nullable(),
|
|
70
|
+
defaultTeamId: z.string().nullable()
|
|
71
|
+
});
|
|
72
|
+
var listProjectsResponseSchema = z.object({
|
|
73
|
+
projects: z.array(
|
|
74
|
+
z.object({
|
|
75
|
+
id: z.string(),
|
|
76
|
+
name: z.string(),
|
|
77
|
+
framework: z.string().nullable().optional(),
|
|
78
|
+
latestProductionUrl: z.string().nullable().optional(),
|
|
79
|
+
createdAt: z.number().optional(),
|
|
80
|
+
updatedAt: z.number().optional()
|
|
81
|
+
})
|
|
82
|
+
)
|
|
83
|
+
});
|
|
84
|
+
var listDeploymentsResponseSchema = z.object({
|
|
85
|
+
deployments: z.array(
|
|
86
|
+
z.object({
|
|
87
|
+
uid: z.string(),
|
|
88
|
+
name: z.string(),
|
|
89
|
+
url: z.string(),
|
|
90
|
+
state: z.string(),
|
|
91
|
+
target: z.string().nullable().optional(),
|
|
92
|
+
created: z.number().optional(),
|
|
93
|
+
readyState: z.string().nullable().optional()
|
|
94
|
+
})
|
|
95
|
+
)
|
|
96
|
+
});
|
|
97
|
+
var deploymentResponseSchema = z.object({
|
|
98
|
+
uid: z.string(),
|
|
99
|
+
name: z.string(),
|
|
100
|
+
url: z.string(),
|
|
101
|
+
state: z.string(),
|
|
102
|
+
target: z.string().nullable().optional(),
|
|
103
|
+
created: z.number().optional(),
|
|
104
|
+
readyState: z.string().nullable().optional(),
|
|
105
|
+
alias: z.array(z.string()).optional(),
|
|
106
|
+
inspectorUrl: z.string().nullable().optional(),
|
|
107
|
+
creator: z.object({
|
|
108
|
+
uid: z.string().optional(),
|
|
109
|
+
username: z.string().nullable().optional(),
|
|
110
|
+
email: z.string().nullable().optional()
|
|
111
|
+
}).optional(),
|
|
112
|
+
meta: z.record(z.string(), z.string()).optional()
|
|
113
|
+
});
|
|
114
|
+
var accountResponseSchema = z.object({
|
|
115
|
+
id: z.string(),
|
|
116
|
+
username: z.string().nullable().optional(),
|
|
117
|
+
email: z.string().nullable().optional(),
|
|
118
|
+
name: z.string().nullable().optional(),
|
|
119
|
+
defaultTeamId: z.string().nullable().optional()
|
|
120
|
+
});
|
|
121
|
+
function resolveEnv(source = process.env) {
|
|
122
|
+
return loadEnv(envShape, source);
|
|
123
|
+
}
|
|
124
|
+
function buildQuery(params) {
|
|
125
|
+
const searchParams = new URLSearchParams();
|
|
126
|
+
for (const [key, value] of Object.entries(params)) {
|
|
127
|
+
if (value !== void 0) {
|
|
128
|
+
searchParams.set(key, String(value));
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
const query = searchParams.toString();
|
|
132
|
+
return query.length > 0 ? `?${query}` : "";
|
|
133
|
+
}
|
|
134
|
+
function toIsoTimestamp(value) {
|
|
135
|
+
return typeof value === "number" ? new Date(value).toISOString() : null;
|
|
136
|
+
}
|
|
137
|
+
function toNullableString(value) {
|
|
138
|
+
return typeof value === "string" && value.length > 0 ? value : null;
|
|
139
|
+
}
|
|
140
|
+
var FetchVercelClient = class {
|
|
141
|
+
token;
|
|
142
|
+
teamId;
|
|
143
|
+
baseUrl;
|
|
144
|
+
fetchImpl;
|
|
145
|
+
constructor(options) {
|
|
146
|
+
this.token = options.token;
|
|
147
|
+
this.teamId = options.teamId;
|
|
148
|
+
this.baseUrl = (options.baseUrl ?? "https://api.vercel.com").replace(/\/+$/, "");
|
|
149
|
+
this.fetchImpl = options.fetch;
|
|
150
|
+
}
|
|
151
|
+
async listProjects(input) {
|
|
152
|
+
const payload = await this.requestJson(
|
|
153
|
+
`/v9/projects${buildQuery({ limit: input.limit, search: input.search })}`,
|
|
154
|
+
listProjectsResponseSchema
|
|
155
|
+
);
|
|
156
|
+
return payload.projects.map((project) => ({
|
|
157
|
+
id: project.id,
|
|
158
|
+
name: project.name,
|
|
159
|
+
framework: toNullableString(project.framework),
|
|
160
|
+
latestProductionUrl: toNullableString(project.latestProductionUrl),
|
|
161
|
+
createdAt: toIsoTimestamp(project.createdAt),
|
|
162
|
+
updatedAt: toIsoTimestamp(project.updatedAt)
|
|
163
|
+
}));
|
|
164
|
+
}
|
|
165
|
+
async listDeployments(input) {
|
|
166
|
+
const payload = await this.requestJson(
|
|
167
|
+
`/v6/deployments${buildQuery({ limit: input.limit, projectId: input.projectId, target: input.target })}`,
|
|
168
|
+
listDeploymentsResponseSchema
|
|
169
|
+
);
|
|
170
|
+
return payload.deployments.map((deployment) => ({
|
|
171
|
+
id: deployment.uid,
|
|
172
|
+
projectName: deployment.name,
|
|
173
|
+
url: deployment.url,
|
|
174
|
+
state: deployment.state,
|
|
175
|
+
target: toNullableString(deployment.target),
|
|
176
|
+
createdAt: toIsoTimestamp(deployment.created),
|
|
177
|
+
readyState: toNullableString(deployment.readyState)
|
|
178
|
+
}));
|
|
179
|
+
}
|
|
180
|
+
async getDeployment(deploymentId) {
|
|
181
|
+
const payload = await this.requestJson(`/v13/deployments/${encodeURIComponent(deploymentId)}`, deploymentResponseSchema);
|
|
182
|
+
return {
|
|
183
|
+
id: payload.uid,
|
|
184
|
+
projectName: payload.name,
|
|
185
|
+
url: payload.url,
|
|
186
|
+
state: payload.state,
|
|
187
|
+
target: toNullableString(payload.target),
|
|
188
|
+
createdAt: toIsoTimestamp(payload.created),
|
|
189
|
+
readyState: toNullableString(payload.readyState),
|
|
190
|
+
alias: payload.alias ?? [],
|
|
191
|
+
inspectorUrl: toNullableString(payload.inspectorUrl),
|
|
192
|
+
creator: {
|
|
193
|
+
id: payload.creator?.uid ?? null,
|
|
194
|
+
username: toNullableString(payload.creator?.username),
|
|
195
|
+
email: toNullableString(payload.creator?.email)
|
|
196
|
+
},
|
|
197
|
+
meta: payload.meta ?? {}
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
async getAccountSummary() {
|
|
201
|
+
const payload = await this.requestJson("/v2/user", accountResponseSchema);
|
|
202
|
+
return {
|
|
203
|
+
id: payload.id,
|
|
204
|
+
username: toNullableString(payload.username),
|
|
205
|
+
email: toNullableString(payload.email),
|
|
206
|
+
name: toNullableString(payload.name),
|
|
207
|
+
defaultTeamId: toNullableString(payload.defaultTeamId)
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
async requestJson(path, schema) {
|
|
211
|
+
const url = new URL(path, this.baseUrl);
|
|
212
|
+
if (this.teamId) {
|
|
213
|
+
url.searchParams.set("teamId", this.teamId);
|
|
214
|
+
}
|
|
215
|
+
const response = await this.fetchImpl(url, {
|
|
216
|
+
method: "GET",
|
|
217
|
+
headers: {
|
|
218
|
+
authorization: `Bearer ${this.token}`,
|
|
219
|
+
accept: "application/json"
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
if (!response.ok) {
|
|
223
|
+
const body = await response.text();
|
|
224
|
+
throw new ExternalServiceError(`Vercel request failed with status ${response.status}.`, {
|
|
225
|
+
statusCode: response.status,
|
|
226
|
+
details: body
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
const payload = await response.json();
|
|
230
|
+
const parsed = schema.safeParse(payload);
|
|
231
|
+
if (!parsed.success) {
|
|
232
|
+
throw new ExternalServiceError("Vercel returned an unexpected response shape.", {
|
|
233
|
+
details: parsed.error.flatten()
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
return parsed.data;
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
var VercelServer = class extends ToolkitServer {
|
|
240
|
+
client;
|
|
241
|
+
constructor(client) {
|
|
242
|
+
super(metadata);
|
|
243
|
+
this.client = client;
|
|
244
|
+
this.registerTool(
|
|
245
|
+
defineTool({
|
|
246
|
+
name: "list_projects",
|
|
247
|
+
title: "List Vercel projects",
|
|
248
|
+
description: "List Vercel projects that the current token can access.",
|
|
249
|
+
inputSchema: {
|
|
250
|
+
limit: z.number().int().min(1).max(50).default(20),
|
|
251
|
+
search: z.string().trim().min(1).optional()
|
|
252
|
+
},
|
|
253
|
+
outputSchema: {
|
|
254
|
+
projects: z.array(projectSummarySchema),
|
|
255
|
+
returned: z.number().int()
|
|
256
|
+
},
|
|
257
|
+
handler: async ({ limit, search }, context) => {
|
|
258
|
+
await context.log("info", "Listing Vercel projects");
|
|
259
|
+
const request = { limit };
|
|
260
|
+
if (search !== void 0) {
|
|
261
|
+
request.search = search;
|
|
262
|
+
}
|
|
263
|
+
const projects = await this.client.listProjects(request);
|
|
264
|
+
return {
|
|
265
|
+
projects: [...projects],
|
|
266
|
+
returned: projects.length
|
|
267
|
+
};
|
|
268
|
+
},
|
|
269
|
+
renderText: ({ projects, returned }) => {
|
|
270
|
+
if (returned === 0) {
|
|
271
|
+
return "No Vercel projects found.";
|
|
272
|
+
}
|
|
273
|
+
return projects.map((project) => `${project.name} (${project.id})`).join("\n");
|
|
274
|
+
}
|
|
275
|
+
})
|
|
276
|
+
);
|
|
277
|
+
this.registerTool(
|
|
278
|
+
defineTool({
|
|
279
|
+
name: "list_deployments",
|
|
280
|
+
title: "List deployments",
|
|
281
|
+
description: "List recent Vercel deployments, optionally scoped to a project.",
|
|
282
|
+
inputSchema: {
|
|
283
|
+
limit: z.number().int().min(1).max(50).default(10),
|
|
284
|
+
projectId: z.string().trim().min(1).optional(),
|
|
285
|
+
target: z.enum(["production", "preview"]).optional()
|
|
286
|
+
},
|
|
287
|
+
outputSchema: {
|
|
288
|
+
deployments: z.array(deploymentSummarySchema),
|
|
289
|
+
returned: z.number().int()
|
|
290
|
+
},
|
|
291
|
+
handler: async ({ limit, projectId, target }, context) => {
|
|
292
|
+
await context.log("info", "Listing Vercel deployments");
|
|
293
|
+
const request = { limit };
|
|
294
|
+
if (projectId !== void 0) {
|
|
295
|
+
request.projectId = projectId;
|
|
296
|
+
}
|
|
297
|
+
if (target !== void 0) {
|
|
298
|
+
request.target = target;
|
|
299
|
+
}
|
|
300
|
+
const deployments = await this.client.listDeployments(request);
|
|
301
|
+
return {
|
|
302
|
+
deployments: [...deployments],
|
|
303
|
+
returned: deployments.length
|
|
304
|
+
};
|
|
305
|
+
},
|
|
306
|
+
renderText: ({ deployments, returned }) => {
|
|
307
|
+
if (returned === 0) {
|
|
308
|
+
return "No deployments found.";
|
|
309
|
+
}
|
|
310
|
+
return deployments.map((deployment) => `${deployment.projectName}: ${deployment.state} (${deployment.id})`).join("\n");
|
|
311
|
+
}
|
|
312
|
+
})
|
|
313
|
+
);
|
|
314
|
+
this.registerTool(
|
|
315
|
+
defineTool({
|
|
316
|
+
name: "get_deployment",
|
|
317
|
+
title: "Get deployment",
|
|
318
|
+
description: "Fetch details for a specific Vercel deployment.",
|
|
319
|
+
inputSchema: {
|
|
320
|
+
deploymentId: z.string().trim().min(1)
|
|
321
|
+
},
|
|
322
|
+
outputSchema: {
|
|
323
|
+
deployment: deploymentDetailSchema
|
|
324
|
+
},
|
|
325
|
+
handler: async ({ deploymentId }, context) => {
|
|
326
|
+
await context.log("info", `Fetching deployment ${deploymentId}`);
|
|
327
|
+
return {
|
|
328
|
+
deployment: await this.client.getDeployment(deploymentId)
|
|
329
|
+
};
|
|
330
|
+
},
|
|
331
|
+
renderText: ({ deployment }) => `${deployment.projectName} deployment ${deployment.id} is ${deployment.state}`
|
|
332
|
+
})
|
|
333
|
+
);
|
|
334
|
+
this.registerStaticResource(
|
|
335
|
+
"account",
|
|
336
|
+
"vercel://account",
|
|
337
|
+
{
|
|
338
|
+
title: "Vercel account",
|
|
339
|
+
description: "Authenticated Vercel account summary.",
|
|
340
|
+
mimeType: "application/json"
|
|
341
|
+
},
|
|
342
|
+
async (uri) => this.createJsonResource(uri.toString(), await this.client.getAccountSummary())
|
|
343
|
+
);
|
|
344
|
+
this.registerPrompt(
|
|
345
|
+
"deployment-audit",
|
|
346
|
+
{
|
|
347
|
+
title: "Deployment audit",
|
|
348
|
+
description: "Draft an audit plan for a Vercel deployment or project.",
|
|
349
|
+
argsSchema: {
|
|
350
|
+
target: z.string().trim().min(1),
|
|
351
|
+
deploymentId: z.string().trim().min(1).optional(),
|
|
352
|
+
focus: z.string().trim().min(1).optional()
|
|
353
|
+
}
|
|
354
|
+
},
|
|
355
|
+
async ({ target, deploymentId, focus }) => this.createTextPrompt(
|
|
356
|
+
[
|
|
357
|
+
`Audit the Vercel target "${target}"${deploymentId ? ` using deployment ${deploymentId}` : ""}.`,
|
|
358
|
+
"Check deployment state, aliases, runtime configuration, rollback readiness, and production impact.",
|
|
359
|
+
focus ? `Pay extra attention to: ${focus}.` : "Highlight the highest-risk operational gaps first."
|
|
360
|
+
].join(" ")
|
|
361
|
+
)
|
|
362
|
+
);
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
async function createServer(options = {}) {
|
|
366
|
+
if (options.client) {
|
|
367
|
+
return new VercelServer(options.client);
|
|
368
|
+
}
|
|
369
|
+
const env = resolveEnv(options.env);
|
|
370
|
+
const client = new FetchVercelClient({
|
|
371
|
+
token: env.VERCEL_TOKEN,
|
|
372
|
+
fetch: options.fetch ?? globalThis.fetch,
|
|
373
|
+
...env.VERCEL_TEAM_ID ? { teamId: env.VERCEL_TEAM_ID } : {},
|
|
374
|
+
...env.VERCEL_API_BASE_URL ? { baseUrl: env.VERCEL_API_BASE_URL } : {}
|
|
375
|
+
});
|
|
376
|
+
return new VercelServer(client);
|
|
377
|
+
}
|
|
378
|
+
function isMainModule(metaUrl) {
|
|
379
|
+
const entry = process.argv[1];
|
|
380
|
+
return typeof entry === "string" && fileURLToPath(metaUrl) === resolve(entry);
|
|
381
|
+
}
|
|
382
|
+
async function main(argv = process.argv.slice(2)) {
|
|
383
|
+
const runtimeOptions = parseRuntimeOptions(argv);
|
|
384
|
+
await runToolkitServer(
|
|
385
|
+
{
|
|
386
|
+
createServer: () => createServer(),
|
|
387
|
+
serverCard
|
|
388
|
+
},
|
|
389
|
+
runtimeOptions
|
|
390
|
+
);
|
|
391
|
+
}
|
|
392
|
+
if (isMainModule(import.meta.url)) {
|
|
393
|
+
await main();
|
|
394
|
+
}
|
|
395
|
+
export {
|
|
396
|
+
VercelServer,
|
|
397
|
+
createServer,
|
|
398
|
+
main,
|
|
399
|
+
metadata,
|
|
400
|
+
serverCard
|
|
401
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@universal-mcp-toolkit/server-vercel",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Project, deployment, and environment tools for Vercel.",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"bin": {
|
|
8
|
+
"server-vercel": "./dist/index.js",
|
|
9
|
+
"umt-vercel": "./dist/index.js"
|
|
10
|
+
},
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/Markgatcha/universal-mcp-toolkit.git"
|
|
14
|
+
},
|
|
15
|
+
"homepage": "https://github.com/Markgatcha/universal-mcp-toolkit#readme",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"import": "./dist/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./package.json": "./package.json"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist",
|
|
25
|
+
".well-known"
|
|
26
|
+
],
|
|
27
|
+
"keywords": [
|
|
28
|
+
"mcp",
|
|
29
|
+
"model-context-protocol",
|
|
30
|
+
"ai",
|
|
31
|
+
"developer-tools",
|
|
32
|
+
"typescript",
|
|
33
|
+
"vercel",
|
|
34
|
+
"deployments",
|
|
35
|
+
"hosting",
|
|
36
|
+
"frontend"
|
|
37
|
+
],
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@universal-mcp-toolkit/core": "0.1.0",
|
|
40
|
+
"zod": "^4.3.6"
|
|
41
|
+
},
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"access": "public"
|
|
44
|
+
},
|
|
45
|
+
"scripts": {
|
|
46
|
+
"build": "tsup src/index.ts --format esm --dts --clean",
|
|
47
|
+
"dev": "tsx watch src/index.ts",
|
|
48
|
+
"lint": "tsc --noEmit",
|
|
49
|
+
"typecheck": "tsc --noEmit",
|
|
50
|
+
"test": "vitest run --passWithNoTests",
|
|
51
|
+
"clean": "rimraf dist"
|
|
52
|
+
}
|
|
53
|
+
}
|