@ascendkit/cli 0.1.11 → 0.2.6

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.
@@ -66,7 +66,8 @@ export function registerPlatformTools(server, client) {
66
66
  projectId: z.string().describe("Project ID (prj_ prefixed)"),
67
67
  name: z
68
68
  .string()
69
- .describe('Environment name, e.g. "Development", "Production"'),
69
+ .optional()
70
+ .describe("Environment name. If omitted, derived from project name + tier."),
70
71
  description: z
71
72
  .string()
72
73
  .optional()
@@ -100,6 +101,43 @@ export function registerPlatformTools(server, client) {
100
101
  };
101
102
  }
102
103
  });
104
+ server.tool("platform_update_environment", "Update an environment's name or description.", {
105
+ projectId: z.string().describe("Project ID (prj_ prefixed)"),
106
+ environmentId: z.string().describe("Environment ID (env_ prefixed)"),
107
+ name: z.string().optional().describe("New environment name"),
108
+ description: z.string().optional().describe("New environment description"),
109
+ }, async (params) => {
110
+ if (!params.name && !params.description) {
111
+ return {
112
+ content: [{ type: "text", text: "At least one of name or description is required." }],
113
+ isError: true,
114
+ };
115
+ }
116
+ try {
117
+ const data = await platform.mcpUpdateEnvironment(client, params);
118
+ return {
119
+ content: [{ type: "text", text: JSON.stringify(data, null, 2) }],
120
+ };
121
+ }
122
+ catch (err) {
123
+ let message = err instanceof Error ? err.message : String(err);
124
+ const jsonMatch = message.match(/\{.*\}/s);
125
+ if (jsonMatch) {
126
+ try {
127
+ const parsed = JSON.parse(jsonMatch[0]);
128
+ if (parsed.error)
129
+ message = parsed.error;
130
+ else if (parsed.detail)
131
+ message = parsed.detail;
132
+ }
133
+ catch { /* use raw message */ }
134
+ }
135
+ return {
136
+ content: [{ type: "text", text: message }],
137
+ isError: true,
138
+ };
139
+ }
140
+ });
103
141
  server.tool("platform_promote_environment", "Promote an environment's configuration to a higher tier (dev → beta → prod).", {
104
142
  environmentId: z.string().describe("Environment ID to promote"),
105
143
  targetTier: z
@@ -134,4 +172,34 @@ export function registerPlatformTools(server, client) {
134
172
  };
135
173
  }
136
174
  });
175
+ server.tool("platform_update_environment_variables", "Set environment variables for a project environment. Pass the full variables dict — it replaces all existing variables.", {
176
+ projectId: z.string().describe("Project ID (prj_ prefixed)"),
177
+ envId: z.string().describe("Environment ID (env_ prefixed)"),
178
+ variables: z.record(z.string()).describe("Key-value map of environment variables"),
179
+ }, async (params) => {
180
+ try {
181
+ const data = await platform.mcpUpdateEnvironmentVariables(client, params);
182
+ return {
183
+ content: [{ type: "text", text: JSON.stringify(data, null, 2) }],
184
+ };
185
+ }
186
+ catch (err) {
187
+ let message = err instanceof Error ? err.message : String(err);
188
+ const jsonMatch = message.match(/\{.*\}/s);
189
+ if (jsonMatch) {
190
+ try {
191
+ const parsed = JSON.parse(jsonMatch[0]);
192
+ if (parsed.error)
193
+ message = parsed.error;
194
+ else if (parsed.detail)
195
+ message = parsed.detail;
196
+ }
197
+ catch { /* use raw message */ }
198
+ }
199
+ return {
200
+ content: [{ type: "text", text: message }],
201
+ isError: true,
202
+ };
203
+ }
204
+ });
137
205
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ascendkit/cli",
3
- "version": "0.1.11",
3
+ "version": "0.2.6",
4
4
  "description": "AscendKit CLI and MCP server",
5
5
  "author": "ascendkit.dev",
6
6
  "license": "MIT",
package/dist/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
package/dist/index.js DELETED
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env node
2
- import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
- import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
- import { AscendKitClient } from "./api/client.js";
5
- import { registerAuthTools } from "./tools/auth.js";
6
- import { registerContentTools } from "./tools/content.js";
7
- import { registerSurveyTools } from "./tools/surveys.js";
8
- const args = process.argv.slice(2);
9
- const publicKey = args[0];
10
- const apiUrl = args[1] ?? process.env.ASCENDKIT_API_URL ?? "http://localhost:8000";
11
- if (!publicKey) {
12
- console.error("Usage: ascendkit-mcp <public-key> [api-url]");
13
- console.error(" public-key Your project's public key (pk_live_...)");
14
- console.error(" api-url AscendKit API URL (default: http://localhost:8000)");
15
- process.exit(1);
16
- }
17
- const client = new AscendKitClient({ apiUrl, publicKey });
18
- const server = new McpServer({
19
- name: "ascendkit",
20
- version: "0.1.0",
21
- });
22
- registerAuthTools(server, client);
23
- registerContentTools(server, client);
24
- registerSurveyTools(server, client);
25
- async function main() {
26
- const transport = new StdioServerTransport();
27
- await server.connect(transport);
28
- }
29
- main().catch(console.error);