@pantheon.ai/mcp 0.0.6 → 0.0.8

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 (2) hide show
  1. package/dist/cli.js +45 -8
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -854,7 +854,7 @@ function getServerErrorMessage(error) {
854
854
 
855
855
  //#endregion
856
856
  //#region package.json
857
- var version = "0.0.5";
857
+ var version = "0.0.8";
858
858
 
859
859
  //#endregion
860
860
  //#region src/mcp/mcp.ts
@@ -874,13 +874,14 @@ async function mcpServer({ authorizationHeader }) {
874
874
  version,
875
875
  websiteUrl: "https://pantheon-ai.tidb.ai/"
876
876
  }, { instructions: "Use tools to accept pantheon data." });
877
- function registerApiTool(name, api, { paramsSchema, bodySchema, ...options }) {
878
- const inputSchemaShape = { params: paramsSchema };
877
+ function registerApiTool(name, api, { paramsSchema, bodySchema, ...options }, toolCallback) {
878
+ const inputSchemaShape = {};
879
+ if (paramsSchema) inputSchemaShape.params = paramsSchema;
879
880
  if (bodySchema) inputSchemaShape.body = bodySchema;
880
881
  mcpServer.registerTool(name, {
881
882
  ...options,
882
883
  inputSchema: z.object(inputSchemaShape)
883
- }, async ({ params, body }) => {
884
+ }, toolCallback ?? (async ({ params, body }) => {
884
885
  try {
885
886
  const result = await executor.execute(api, params, body);
886
887
  return {
@@ -896,7 +897,7 @@ async function mcpServer({ authorizationHeader }) {
896
897
  text: getErrorMessage(e)
897
898
  }] };
898
899
  }
899
- });
900
+ }));
900
901
  }
901
902
  registerApiTool("listProjects", listProjects, {
902
903
  title: "List pantheon projects",
@@ -906,7 +907,7 @@ async function mcpServer({ authorizationHeader }) {
906
907
  });
907
908
  registerApiTool("createProject", createProject, {
908
909
  title: "Create pantheon project",
909
- paramsSchema: z.null(),
910
+ paramsSchema: null,
910
911
  bodySchema: z.object({
911
912
  first_prompt: z.string(),
912
913
  project_type: z.enum(["general", "github"]),
@@ -944,8 +945,7 @@ async function mcpServer({ authorizationHeader }) {
944
945
  branchId: z.string(),
945
946
  fullOutput: z.boolean().optional().default(false)
946
947
  }),
947
- bodySchema: null,
948
- outputSchema: z.string()
948
+ bodySchema: null
949
949
  });
950
950
  registerApiTool("createProjectExploration", createProjectExploration, {
951
951
  title: "Create pantheon project exploration",
@@ -973,6 +973,43 @@ async function mcpServer({ authorizationHeader }) {
973
973
  bodySchema: null,
974
974
  outputSchema: explorationResultSchema
975
975
  });
976
+ registerApiTool("readProjectBranchFS", getProjectBranchFs, {
977
+ title: "Read project branch file system",
978
+ description: "Reads a file or directory content from a project branch.",
979
+ 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*".`)
983
+ }),
984
+ bodySchema: null
985
+ }, async ({ params, body }) => {
986
+ try {
987
+ const result = await executor.execute(getProjectBranchFs, params, body ?? null);
988
+ if (Array.isArray(result)) {
989
+ const header = `${String(params["path*"])} is a directory.
990
+ Name\tSize\tMode\tModified`;
991
+ const files = result.map((f) => {
992
+ if (f.is_dir) return `${f.name}/\t${f.size}\t${f.mode}\t${f.mod_time}`;
993
+ else return `${f.name}\t${f.size}\t${f.mode}\t${f.mod_time}`;
994
+ });
995
+ return { content: [{
996
+ type: "text",
997
+ text: header + "\n" + files.join("\n")
998
+ }] };
999
+ } else {
1000
+ const content = await result.text();
1001
+ return { content: [{
1002
+ type: "text",
1003
+ text: `File: ${result.name}\nType: ${result.type}\n\n--- File Content Boundary ---\n${content}`
1004
+ }] };
1005
+ }
1006
+ } catch (e) {
1007
+ return { content: [{
1008
+ type: "text",
1009
+ text: getErrorMessage(e)
1010
+ }] };
1011
+ }
1012
+ });
976
1013
  return mcpServer;
977
1014
  }
978
1015
  const pageParams = z.object({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pantheon.ai/mcp",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "bin": "dist/cli.js",