@pantheon.ai/mcp 0.0.8 → 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.
Files changed (3) hide show
  1. package/README.md +249 -0
  2. package/dist/cli.js +86 -47
  3. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,249 @@
1
+ Pantheon MCP
2
+
3
+ Overview
4
+ - MCP server for Pantheon API access (projects, branches, explorations).
5
+ - Transports: stdio and Streamable HTTP.
6
+ - API base URL: `https://pantheon-ai.tidb.ai/`.
7
+
8
+ Pantheon (concepts inferred from source code in /Users/gaolinjie/PycharmProjects/baas)
9
+ - Project (Forest): A project maps to a Pantheon "forest". All tool `project` or `projectId`
10
+ parameters identify a forest ID.
11
+ - Snap: A snapshot of a container execution in a forest. Snaps form a lineage via `SourceSnapID`
12
+ (parent), and include filesystem state, command, envs, labels, and status.
13
+ - Branch: A branch is a workspace lineage of snaps in Pantheon. Branch tools operate on a branch
14
+ identifier that represents a line of execution (a sequence of related snaps).
15
+ - Exploration: A higher-level grouping of snaps created by running a prompt sequence from a
16
+ source snap (branch root) and then appending an analysis step. Explorations label each snap with
17
+ an `exploration` name and `snap_type` so they can be grouped and previewed.
18
+ - Snap types (labels):
19
+ - `root`: project initialization snap (starting point).
20
+ - `execution`: a normal prompt execution step.
21
+ - `artifacts`: the final analysis step that summarizes work and quality.
22
+ - Relationship summary:
23
+ - A project (forest) contains many snaps.
24
+ - A branch is a lineage through snaps (parent/child via `SourceSnapID`).
25
+ - An exploration is a named set of snaps along a branch, ending in an artifacts snap.
26
+
27
+ Authentication
28
+ - Stdio: `npx @pantheon.ai/mcp stdio <Api-Key>` (API key required).
29
+ - HTTP: `PORT=9986 npx @pantheon.ai/mcp http [Optional Api-Key]`.
30
+ - If no API key is provided, clients must send an `Authorization` header.
31
+ - The server injects `Authorization: Bearer <Api-Key>` when a key is provided.
32
+
33
+ HTTP Server
34
+ - Default port: `9986` (override with `PORT`).
35
+ - Endpoint: `POST /mcp`.
36
+ - Allowed hosts: `pantheon-ai.tidb.ai`, `localhost`.
37
+
38
+ Tool Conventions
39
+ - Inputs are split into `params` and `body`.
40
+ - On success, tools return `content` (text) and most return `structuredContent`.
41
+ - On errors, tools return `content` with an error message string.
42
+ - Branch tools operate on branches; exploration tools create and group snaps via labels.
43
+
44
+ Tools
45
+
46
+ listProjects
47
+ - Description: List Pantheon projects.
48
+ - Params:
49
+ - `page` (int, min 1)
50
+ - `size` (int, min 1, max 100)
51
+ - Body: none
52
+ - Output: paged `project`
53
+
54
+ createProject
55
+ - Description: Create a Pantheon project.
56
+ - Params: none
57
+ - Body:
58
+ - `first_prompt` (string, required)
59
+ - `project_type` (`general` | `github`, required)
60
+ - `github_repo_id` (number, optional)
61
+ - `github_installation_id` (number, optional)
62
+ - `env_id` (string, optional)
63
+ - Output: `project`
64
+
65
+ listProjectBranches
66
+ - Description: List branches for a project.
67
+ - Params:
68
+ - `projectId` (string, required)
69
+ - `page` (int, min 1)
70
+ - `size` (int, min 1, max 100)
71
+ - Body: none
72
+ - Output: paged `branch`
73
+
74
+ getProject
75
+ - Description: Get a project by id.
76
+ - Params:
77
+ - `projectId` (string, required)
78
+ - Body: none
79
+ - Output: `project`
80
+
81
+ getProjectBranch
82
+ - Description: Get branch metadata.
83
+ - Params:
84
+ - `projectId` (string, required)
85
+ - `branchId` (string, required)
86
+ - Body: none
87
+ - Output: `branch`
88
+
89
+ listProjectChildrenBranches
90
+ - Description: List child branches of a branch.
91
+ - Params:
92
+ - `projectId` (string, required)
93
+ - `branchId` (string, required)
94
+ - Body: none
95
+ - Output: `branch[]`
96
+
97
+ executeProjectBranchLLM
98
+ - Description: Execute an LLM run on a branch.
99
+ - Params:
100
+ - `projectId` (string, required)
101
+ - `branchId` (string, required)
102
+ - Body:
103
+ - `prompt` (string, required)
104
+ - `agent` (string, optional)
105
+ - `tool_use_id` (string, optional; leave blank if unknown)
106
+ - `baseline_branch_id` (string, optional)
107
+ - Output: branch execution result
108
+
109
+ getProjectBranchOutput
110
+ - Description: Fetch a branch execution output.
111
+ - Params:
112
+ - `projectId` (string, required)
113
+ - `branchId` (string, required)
114
+ - `fullOutput` (boolean, optional, default false)
115
+ - Body: none
116
+ - Output: API response (untyped)
117
+
118
+ createProjectExploration
119
+ - Description: Create an exploration (fan-out) from a parent branch.
120
+ - Params:
121
+ - `projectId` (string, required)
122
+ - Body:
123
+ - `parent_branch_id` (string, required)
124
+ - `shared_prompt_sequence` (string[], min 1, max 4)
125
+ - `num_branches` (int, min 1, max 50, optional, default 3)
126
+ - `agent` (string, optional)
127
+ - Output: exploration
128
+
129
+ listProjectExplorations
130
+ - Description: List explorations for a project.
131
+ - Params:
132
+ - `projectId` (string, required)
133
+ - Body: none
134
+ - Output: exploration[]
135
+
136
+ getProjectExplorationResult
137
+ - Description: Get exploration result details.
138
+ - Params:
139
+ - `projectId` (string, required)
140
+ - `explorationId` (string, required)
141
+ - Body: none
142
+ - Output: exploration result
143
+
144
+ readProjectBranchFS
145
+ - Description: Read a file or directory from a branch file system.
146
+ - Params:
147
+ - `projectId` (string, required)
148
+ - `branchId` (string, required)
149
+ - `path*` (string, required; root path `/` is branch workdir)
150
+ - Body: none
151
+ - Output:
152
+ - Directory: text table of entries with name/size/mode/modified.
153
+ - File: text payload with file metadata and content.
154
+
155
+ Pantheon MCP Tools (baas: pantheon-infra/pantheon-mcp-server)
156
+ The Pantheon MCP server in /Users/gaolinjie/PycharmProjects/baas exposes a different set of tools.
157
+ Descriptions below are based on its Go implementation and reflect actual runtime behavior.
158
+
159
+ parallel_explore
160
+ - Description: Run the same prompt sequence in multiple parallel explorations from a source snap.
161
+ Each exploration adds an automatic final analysis step (artifacts). If `max_results` is greater
162
+ than `parallels_num`, an asynchronous auto-exploration pass is scheduled to generate more results.
163
+ - Params:
164
+ - `source_snap` (string, required)
165
+ - If an artifacts snap is provided, it is redirected to its parent execution snap.
166
+ - `project` (string, required)
167
+ - Project/forest ID that contains `source_snap`.
168
+ - `shared_prompt_sequence` (string or string[], required)
169
+ - 1 to 4 prompts. A final analysis prompt is always appended automatically.
170
+ - `parallels_num` (int, optional, default 3; range 1-50)
171
+ - `max_results` (int, optional; range 1-50)
172
+ - Default is 1 in code, but it is automatically raised to at least `parallels_num`.
173
+ - Output:
174
+ - Text summary of explorations, per-step results, and execution metadata.
175
+ - Notes:
176
+ - Exploration names are auto-generated with unique suffixes.
177
+ - In HTTP mode, this tool supports streaming progress notifications.
178
+
179
+ project_init_exploration
180
+ - Description: Initialize a project by creating (or reusing) a root snap.
181
+ - Params:
182
+ - `project` (string, required)
183
+ - Behavior:
184
+ - Ensures seed snap `claude-sandbox-3-2-1` exists (Docker image `ianzhai/claude-sandbox:3.2`).
185
+ - Creates root snap named `root` if missing.
186
+ - Labels root with `project`, `exploration=root`, `snap_type=root`.
187
+ - Output:
188
+ - JSON containing `status`, `project`, `start_snap_id`, `message`, and `next_steps`.
189
+
190
+ preview_exploration
191
+ - Description: Summarize a single exploration and return the latest snap ID and output.
192
+ - Params:
193
+ - `exploration_name` (string, required)
194
+ - `project` (string, required)
195
+ - `show_progress` (boolean, optional, default false)
196
+ - Behavior:
197
+ - Groups snaps by labels and envs; detects status from snap state and artifacts analysis.
198
+ - If exploring or running, waits briefly before returning.
199
+ - Output:
200
+ - When `show_progress=false`: latest snap info + unified metadata.
201
+ - When `show_progress=true`: full per-step progress list.
202
+
203
+ list_projects
204
+ - Description: List all non-system projects (forests).
205
+ - Params: none
206
+ - Behavior:
207
+ - Filters out forests starting with `__`.
208
+ - Output:
209
+ - `projects` list with metadata.
210
+
211
+ list_explorations
212
+ - Description: List explorations within a project.
213
+ - Params:
214
+ - `project` (string, required)
215
+ - Behavior:
216
+ - Groups snaps by exploration label.
217
+ - Filters internal explorations named `unlabeled` and `root`.
218
+ - Computes latest snap, snap output, and status metadata.
219
+ - Output:
220
+ - `explorations` map keyed by exploration name plus a formatted tree view.
221
+
222
+ read_snap_file
223
+ - Description: Read a file or list a directory from a snap filesystem.
224
+ - Params:
225
+ - `snap_id` (string, required)
226
+ - `project` (string, required)
227
+ - `path` (string, optional, default "")
228
+ - Empty string lists home directory.
229
+ - `/home/claude/...` is normalized to the snap mount root.
230
+ - Output:
231
+ - Directory: JSON with `success` and `data` list of file metadata.
232
+ - File: raw file content string.
233
+
234
+ kv_set
235
+ - Description: Store a key/value pair with TTL.
236
+ - Params:
237
+ - `key` (string, required)
238
+ - `value` (string, required)
239
+ - `ttl_seconds` (int, optional, default 3600, min 1)
240
+ - Output:
241
+ - Text confirmation on success.
242
+
243
+ kv_get
244
+ - Description: Retrieve a value by key.
245
+ - Params:
246
+ - `key` (string, required)
247
+ - Output:
248
+ - JSON with `key` and `value` when found.
249
+ - Error tool result when missing or expired.
package/dist/cli.js CHANGED
@@ -203,6 +203,18 @@ const branchSnapsSchema = z.object({
203
203
  steps: z.array(snapDetailsSchema),
204
204
  steps_total: z.number()
205
205
  });
206
+ const branchExecutionResultSchema = z.object({
207
+ execution_id: z.string(),
208
+ status: z.string(),
209
+ status_text: z.string(),
210
+ branch_id: z.string(),
211
+ snap_id: z.string(),
212
+ background_task_id: z.string().nullable(),
213
+ started_at: zodJsonDate,
214
+ last_polled_at: zodJsonDate,
215
+ ended_at: zodJsonDate.nullable(),
216
+ exit_code: z.number().nullable()
217
+ });
206
218
 
207
219
  //#endregion
208
220
  //#region packages/sdk/src/schemas/common.ts
@@ -250,18 +262,7 @@ const explorationResultSchema = z.object({
250
262
  branch_name: z.string(),
251
263
  branch_display_name: z.string(),
252
264
  latest_snap_id: z.string(),
253
- execution_results: z.object({
254
- execution_id: z.string(),
255
- status: z.string(),
256
- status_text: z.string(),
257
- branch_id: z.string(),
258
- snap_id: z.string(),
259
- background_task_id: z.string().nullable(),
260
- started_at: zodJsonDate,
261
- last_polled_at: zodJsonDate,
262
- ended_at: zodJsonDate.nullable(),
263
- exit_code: z.number().nullable()
264
- }).array()
265
+ execution_results: branchExecutionResultSchema.array()
265
266
  }).array()
266
267
  });
267
268
 
@@ -739,8 +740,11 @@ const postProjectMessage = defineApi(post`/api/v1/projects/${"projectId"}`, type
739
740
  const continueProject = defineApi(post`/api/v1/projects/${"projectId"}/continue`, typeOf(), "raw");
740
741
  const stopProject = defineApi(post`/api/v1/projects/${"projectId"}/stop`, typeOf(), "raw");
741
742
  const getProjectBranch = defineApi(get`/api/v1/projects/${"projectId"}/branches/${"branchId"}`, null, branchSchema);
743
+ const createProjectBranch = defineApi(post`/api/v1/projects/${"projectId"}/branches`, typeOf(), branchSchema);
742
744
  const getProjectBranchOutput = defineApi(get`/api/v1/projects/${"projectId"}/branches/${"branchId"}/output?full_output=${"fullOutput?"}`, null, z.string());
743
745
  const listProjectBranches = defineApi(get`/api/v1/projects/${"projectId"}/branches?page=${"page"}&size=${"size"}`, null, paged(branchSchema));
746
+ const listProjectChildrenBranches = defineApi(get`/api/v1/projects/${"projectId"}/branches/${"branchId"}/children`, null, branchSchema.array());
747
+ const executeProjectBranchLLM = defineApi(post`/api/v1/projects/${"projectId"}/branches/${"branchId"}/llm_exec`, typeOf(), branchExecutionResultSchema);
744
748
  const listProjectBranchSnaps = defineApi(get`/api/v1/projects/${"projectId"}/branches/${"branchId"}/snaps`, null, branchSnapsSchema);
745
749
  const listProjectBackgroundTasks = defineApi(get`/api/v1/projects/${"projectId"}/background_tasks?statuses=${"statuses?"}`, null, z.array(projectBackgroundTaskSchema));
746
750
  const createProjectExploration = defineApi(post`/api/v1/projects/${"projectId"}/explorations`, typeOf(), explorationSchema);
@@ -854,7 +858,7 @@ function getServerErrorMessage(error) {
854
858
 
855
859
  //#endregion
856
860
  //#region package.json
857
- var version = "0.0.8";
861
+ var version = "0.1.0";
858
862
 
859
863
  //#endregion
860
864
  //#region src/mcp/mcp.ts
@@ -870,10 +874,11 @@ async function mcpServer({ authorizationHeader }) {
870
874
  throw 401;
871
875
  }
872
876
  const mcpServer = new McpServer({
873
- name: "Pantheon MCP",
877
+ name: "pantheon-mcp",
878
+ title: "Pantheon MCP",
874
879
  version,
875
880
  websiteUrl: "https://pantheon-ai.tidb.ai/"
876
- }, { instructions: "Use tools to accept pantheon data." });
881
+ }, { instructions: "Pantheon concepts: a project maps to a forest; snaps are execution snapshots linked by SourceSnapID; a branch is a lineage of snaps; an exploration is a named, prompt-driven sequence of snaps that ends with an artifacts analysis snap. Use tools to list projects/branches/explorations, execute prompts on branches, and read branch files." });
877
882
  function registerApiTool(name, api, { paramsSchema, bodySchema, ...options }, toolCallback) {
878
883
  const inputSchemaShape = {};
879
884
  if (paramsSchema) inputSchemaShape.params = paramsSchema;
@@ -900,86 +905,120 @@ async function mcpServer({ authorizationHeader }) {
900
905
  }));
901
906
  }
902
907
  registerApiTool("listProjects", listProjects, {
903
- title: "List pantheon projects",
908
+ title: "List Pantheon projects",
909
+ description: "List projects (forests) with pagination. Projects are the top-level container for snaps and branches.",
904
910
  paramsSchema: pageParams,
905
911
  bodySchema: null,
906
912
  outputSchema: paged(projectSchema)
907
913
  });
908
914
  registerApiTool("createProject", createProject, {
909
- title: "Create pantheon project",
915
+ title: "Create Pantheon project",
916
+ description: "Create a new project (general or GitHub-backed). A project is a forest that will contain branches and snaps.",
910
917
  paramsSchema: null,
911
918
  bodySchema: z.object({
912
- first_prompt: z.string(),
913
- project_type: z.enum(["general", "github"]),
914
- github_repo_id: z.number().optional(),
915
- github_installation_id: z.number().optional(),
916
- env_id: z.string().optional()
919
+ first_prompt: z.string().describe("Initial prompt to bootstrap the project."),
920
+ project_type: z.enum(["general", "github"]).describe("Project type: general or GitHub-backed."),
921
+ github_repo_id: z.number().optional().describe("GitHub repository ID (required for GitHub projects)."),
922
+ github_installation_id: z.number().optional().describe("GitHub app installation ID (required for GitHub projects)."),
923
+ env_id: z.string().optional().describe("Optional environment ID for project execution context.")
917
924
  }),
918
925
  outputSchema: projectSchema
919
926
  });
920
927
  registerApiTool("listProjectBranches", listProjectBranches, {
921
928
  title: "List project branches",
922
- paramsSchema: pageParams.extend({ projectId: z.string() }),
929
+ description: "List branches for a project with pagination. A branch represents a lineage of snaps.",
930
+ paramsSchema: pageParams.extend({ projectId: z.string().describe("Project (forest) ID.") }),
923
931
  bodySchema: null,
924
932
  outputSchema: paged(branchSchema)
925
933
  });
926
934
  registerApiTool("getProject", getProject, {
927
- title: "Get pantheon project",
928
- paramsSchema: z.object({ projectId: z.string() }),
935
+ title: "Get Pantheon project",
936
+ description: "Get a project by ID.",
937
+ paramsSchema: z.object({ projectId: z.string().describe("Project ID.") }),
929
938
  bodySchema: null,
930
939
  outputSchema: projectSchema
931
940
  });
932
941
  registerApiTool("getProjectBranch", getProjectBranch, {
933
- title: "Get pantheon project branch info",
942
+ title: "Get Pantheon project branch info",
943
+ description: "Get metadata for a specific branch (snap lineage).",
934
944
  paramsSchema: z.object({
935
- projectId: z.string(),
936
- branchId: z.string()
945
+ projectId: z.string().describe("Project (forest) ID."),
946
+ branchId: z.string().describe("Branch ID.")
937
947
  }),
938
948
  bodySchema: null,
939
949
  outputSchema: branchSchema
940
950
  });
951
+ registerApiTool("listProjectChildrenBranches", listProjectChildrenBranches, {
952
+ title: "List project children branches",
953
+ description: "List child branches of a branch. Child branches represent divergent snap lineages.",
954
+ paramsSchema: z.object({
955
+ projectId: z.string().describe("Project (forest) ID."),
956
+ branchId: z.string().describe("Parent branch ID.")
957
+ }),
958
+ bodySchema: null,
959
+ outputSchema: branchSchema.array()
960
+ });
961
+ registerApiTool("executeProjectBranchLLM", executeProjectBranchLLM, {
962
+ title: "Execute LLM on project branch",
963
+ description: "Execute a prompt on a branch. This produces new snaps on the branch lineage.",
964
+ paramsSchema: z.object({
965
+ projectId: z.string().describe("Project (forest) ID."),
966
+ branchId: z.string().describe("Branch ID.")
967
+ }),
968
+ bodySchema: z.object({
969
+ prompt: z.string().describe("Prompt to execute on the branch."),
970
+ agent: z.string().optional().describe("Optional agent identifier."),
971
+ tool_use_id: z.string().optional().describe("Optional tool-use ID; leave blank if unknown."),
972
+ baseline_branch_id: z.string().optional().describe("Optional baseline branch ID for diffing or comparison.")
973
+ }),
974
+ outputSchema: branchExecutionResultSchema
975
+ });
941
976
  registerApiTool("getProjectBranchOutput", getProjectBranchOutput, {
942
- title: "Get pantheon project branch output",
977
+ title: "Get Pantheon project branch output",
978
+ description: "Fetch execution output for a branch (snap lineage).",
943
979
  paramsSchema: z.object({
944
- projectId: z.string(),
945
- branchId: z.string(),
946
- fullOutput: z.boolean().optional().default(false)
980
+ projectId: z.string().describe("Project (forest) ID."),
981
+ branchId: z.string().describe("Branch ID."),
982
+ fullOutput: z.boolean().optional().default(false).describe("If true, return full output payload.")
947
983
  }),
948
984
  bodySchema: null
949
985
  });
950
986
  registerApiTool("createProjectExploration", createProjectExploration, {
951
- title: "Create pantheon project exploration",
952
- paramsSchema: z.object({ projectId: z.string() }),
987
+ title: "Create Pantheon project exploration",
988
+ description: "Create an exploration (fan-out) from a parent branch. Explorations are named sequences of snaps.",
989
+ paramsSchema: z.object({ projectId: z.string().describe("Project (forest) ID.") }),
953
990
  bodySchema: z.object({
954
- parent_branch_id: z.string(),
955
- shared_prompt_sequence: z.string().array().min(1).max(4),
956
- num_branches: z.number().int().min(1).max(50).optional().default(3),
957
- agent: z.string().optional()
991
+ parent_branch_id: z.string().describe("Parent branch to fan out from."),
992
+ shared_prompt_sequence: z.string().array().min(1).max(4).describe("Prompt sequence (1-4 items) shared by all branches."),
993
+ num_branches: z.number().int().min(1).max(50).optional().default(3).describe("Number of parallel branches to create."),
994
+ agent: z.string().optional().describe("Optional agent identifier.")
958
995
  }),
959
996
  outputSchema: explorationSchema
960
997
  });
961
998
  registerApiTool("listProjectExplorations", listProjectExplorations, {
962
999
  title: "List project explorations",
963
- paramsSchema: z.object({ projectId: z.string() }),
1000
+ description: "List explorations for a project. Explorations group snaps by labels.",
1001
+ paramsSchema: z.object({ projectId: z.string().describe("Project (forest) ID.") }),
964
1002
  bodySchema: null,
965
1003
  outputSchema: explorationSchema.array()
966
1004
  });
967
1005
  registerApiTool("getProjectExplorationResult", getProjectExplorationResult, {
968
1006
  title: "Get project exploration result",
1007
+ description: "Get exploration result details (including artifacts output when available).",
969
1008
  paramsSchema: z.object({
970
- projectId: z.string(),
971
- explorationId: z.string()
1009
+ projectId: z.string().describe("Project (forest) ID."),
1010
+ explorationId: z.string().describe("Exploration ID.")
972
1011
  }),
973
1012
  bodySchema: null,
974
1013
  outputSchema: explorationResultSchema
975
1014
  });
976
1015
  registerApiTool("readProjectBranchFS", getProjectBranchFs, {
977
1016
  title: "Read project branch file system",
978
- description: "Reads a file or directory content from a project branch.",
1017
+ description: "Read a file or directory from a branch filesystem (snap workspace).",
979
1018
  paramsSchema: z.object({
980
- projectId: z.string(),
981
- branchId: z.string(),
982
- "path*": z.string().describe(`root path '/' is branch's work directory. Notice: the param name is "path*".`)
1019
+ projectId: z.string().describe("Project (forest) ID."),
1020
+ branchId: z.string().describe("Branch ID."),
1021
+ "path*": z.string().describe(`Root path '/' is branch's work directory. Note: the param name is "path*".`)
983
1022
  }),
984
1023
  bodySchema: null
985
1024
  }, async ({ params, body }) => {
@@ -1013,8 +1052,8 @@ Name\tSize\tMode\tModified`;
1013
1052
  return mcpServer;
1014
1053
  }
1015
1054
  const pageParams = z.object({
1016
- page: z.number().int().min(1),
1017
- size: z.number().int().min(1).max(100)
1055
+ page: z.number().int().min(1).describe("Page number (1-based)."),
1056
+ size: z.number().int().min(1).max(100).describe("Page size (max 100).")
1018
1057
  });
1019
1058
 
1020
1059
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pantheon.ai/mcp",
3
- "version": "0.0.8",
3
+ "version": "0.1.0",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "bin": "dist/cli.js",