@kintone/mcp-server 1.0.0 → 1.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 (39) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +25 -13
  3. package/dist/{client.js → client/index.js} +4 -9
  4. package/dist/client/types/client.js +1 -0
  5. package/dist/config/command-line.js +2 -1
  6. package/dist/config/index.js +30 -62
  7. package/dist/config/parser.js +72 -0
  8. package/dist/config/schema.js +4 -0
  9. package/dist/config/types/config.js +1 -0
  10. package/dist/index.js +16 -6
  11. package/dist/lib/filesystem.js +47 -0
  12. package/dist/schema/app/form-layout.js +101 -0
  13. package/dist/schema/app/index.js +1 -0
  14. package/dist/schema/record/index.js +2 -0
  15. package/dist/schema/record/records.js +1 -1
  16. package/dist/server/index.js +17 -0
  17. package/dist/server/tool-filters.js +14 -0
  18. package/dist/server/types/server.js +1 -0
  19. package/dist/tools/factory.js +10 -0
  20. package/dist/tools/index.js +9 -0
  21. package/dist/tools/kintone/app/get-app-deploy-status.js +42 -0
  22. package/dist/tools/kintone/app/get-app.js +7 -8
  23. package/dist/tools/kintone/app/get-apps.js +7 -8
  24. package/dist/tools/kintone/app/get-form-fields.js +12 -8
  25. package/dist/tools/kintone/app/get-form-layout.js +43 -0
  26. package/dist/tools/kintone/app/get-general-settings.js +119 -0
  27. package/dist/tools/kintone/app/get-process-management.js +12 -8
  28. package/dist/tools/kintone/file/download-file.js +49 -0
  29. package/dist/tools/kintone/record/add-records.js +8 -9
  30. package/dist/tools/kintone/record/delete-records.js +7 -8
  31. package/dist/tools/kintone/record/get-records.js +8 -9
  32. package/dist/tools/kintone/record/update-records.js +8 -9
  33. package/dist/tools/kintone/record/update-statuses.js +7 -8
  34. package/dist/tools/types/tool.js +1 -0
  35. package/dist/version.js +1 -1
  36. package/package.json +6 -5
  37. package/dist/server.js +0 -20
  38. package/dist/tool-filters.js +0 -14
  39. package/dist/tools/utils.js +0 -8
@@ -0,0 +1,42 @@
1
+ import { z } from "zod";
2
+ import { createTool } from "../../factory.js";
3
+ const inputSchema = {
4
+ apps: z
5
+ .array(z.union([z.string(), z.number()]))
6
+ .min(1, "At least one app ID is required")
7
+ .max(300, "Maximum 300 app IDs allowed")
8
+ .describe("Array of app IDs to check deploy status (maximum 300)"),
9
+ };
10
+ const deployStatusEnum = z.enum(["PROCESSING", "SUCCESS", "FAIL", "CANCEL"], {
11
+ description: "Deployment status: PROCESSING (in progress), SUCCESS (completed), FAIL (failed), CANCEL (canceled)",
12
+ });
13
+ const outputSchema = {
14
+ apps: z
15
+ .array(z.object({
16
+ app: z.string().describe("The app ID"),
17
+ status: deployStatusEnum.describe("The deployment status"),
18
+ }))
19
+ .describe("Array of app deploy statuses"),
20
+ };
21
+ const toolName = "kintone-get-app-deploy-status";
22
+ const toolConfig = {
23
+ title: "Get App Deploy Status",
24
+ description: "Get app deploy status from kintone",
25
+ inputSchema,
26
+ outputSchema,
27
+ };
28
+ const callback = async ({ apps }, { client }) => {
29
+ const result = await client.app.getDeployStatus({
30
+ apps,
31
+ });
32
+ return {
33
+ structuredContent: result,
34
+ content: [
35
+ {
36
+ type: "text",
37
+ text: JSON.stringify(result, null, 2),
38
+ },
39
+ ],
40
+ };
41
+ };
42
+ export const getAppDeployStatus = createTool(toolName, toolConfig, callback);
@@ -1,7 +1,5 @@
1
1
  import { z } from "zod";
2
- import { createTool } from "../../utils.js";
3
- import { getKintoneClient } from "../../../client.js";
4
- import { parseKintoneClientConfig } from "../../../config/index.js";
2
+ import { createTool } from "../../factory.js";
5
3
  const inputSchema = {
6
4
  appId: z
7
5
  .string()
@@ -37,14 +35,14 @@ const outputSchema = {
37
35
  })
38
36
  .describe("The modifier information"),
39
37
  };
40
- export const getApp = createTool("kintone-get-app", {
38
+ const toolName = "kintone-get-app";
39
+ const toolConfig = {
41
40
  title: "Get App",
42
41
  description: "Get app settings from kintone",
43
42
  inputSchema,
44
43
  outputSchema,
45
- }, async ({ appId }) => {
46
- const config = parseKintoneClientConfig();
47
- const client = getKintoneClient(config);
44
+ };
45
+ const callback = async ({ appId }, { client }) => {
48
46
  const app = await client.app.getApp({ id: appId });
49
47
  const result = {
50
48
  appId: app.appId,
@@ -67,4 +65,5 @@ export const getApp = createTool("kintone-get-app", {
67
65
  },
68
66
  ],
69
67
  };
70
- });
68
+ };
69
+ export const getApp = createTool(toolName, toolConfig, callback);
@@ -1,7 +1,5 @@
1
1
  import { z } from "zod";
2
- import { createTool } from "../../utils.js";
3
- import { getKintoneClient } from "../../../client.js";
4
- import { parseKintoneClientConfig } from "../../../config/index.js";
2
+ import { createTool } from "../../factory.js";
5
3
  const inputSchema = {
6
4
  ids: z
7
5
  .array(z.string())
@@ -70,14 +68,14 @@ const appSchema = z.object({
70
68
  const outputSchema = {
71
69
  apps: z.array(appSchema).describe("Array of app information"),
72
70
  };
73
- export const getApps = createTool("kintone-get-apps", {
71
+ const toolName = "kintone-get-apps";
72
+ const toolConfig = {
74
73
  title: "Get Apps",
75
74
  description: "Get multiple app settings from kintone",
76
75
  inputSchema,
77
76
  outputSchema,
78
- }, async ({ ids, codes, name, spaceIds, offset, limit }) => {
79
- const config = parseKintoneClientConfig();
80
- const client = getKintoneClient(config);
77
+ };
78
+ const callback = async ({ ids, codes, name, spaceIds, offset, limit }, { client }) => {
81
79
  const response = await client.app.getApps({
82
80
  ids,
83
81
  codes,
@@ -109,4 +107,5 @@ export const getApps = createTool("kintone-get-apps", {
109
107
  },
110
108
  ],
111
109
  };
112
- });
110
+ };
111
+ export const getApps = createTool(toolName, toolConfig, callback);
@@ -1,7 +1,5 @@
1
1
  import { z } from "zod";
2
- import { createTool } from "../../utils.js";
3
- import { getKintoneClient } from "../../../client.js";
4
- import { parseKintoneClientConfig } from "../../../config/index.js";
2
+ import { createTool } from "../../factory.js";
5
3
  const inputSchema = {
6
4
  app: z
7
5
  .string()
@@ -10,6 +8,10 @@ const inputSchema = {
10
8
  .enum(["ja", "en", "zh", "default", "user"])
11
9
  .optional()
12
10
  .describe("The language for field names"),
11
+ preview: z
12
+ .boolean()
13
+ .optional()
14
+ .describe("Whether to get form fields from pre-live environment"),
13
15
  };
14
16
  const fieldPropertySchema = z.object({
15
17
  type: z.string().describe("The field type"),
@@ -113,17 +115,18 @@ const outputSchema = {
113
115
  .describe("Object containing field configurations"),
114
116
  revision: z.string().describe("App configuration revision number"),
115
117
  };
116
- export const getFormFields = createTool("kintone-get-form-fields", {
118
+ const toolName = "kintone-get-form-fields";
119
+ const toolConfig = {
117
120
  title: "Get Form Fields",
118
121
  description: "Get form field settings from a kintone app",
119
122
  inputSchema,
120
123
  outputSchema,
121
- }, async ({ app, lang }) => {
122
- const config = parseKintoneClientConfig();
123
- const client = getKintoneClient(config);
124
+ };
125
+ const callback = async ({ app, lang, preview }, { client }) => {
124
126
  const response = await client.app.getFormFields({
125
127
  app,
126
128
  lang,
129
+ preview,
127
130
  });
128
131
  const result = {
129
132
  properties: response.properties,
@@ -138,4 +141,5 @@ export const getFormFields = createTool("kintone-get-form-fields", {
138
141
  },
139
142
  ],
140
143
  };
141
- });
144
+ };
145
+ export const getFormFields = createTool(toolName, toolConfig, callback);
@@ -0,0 +1,43 @@
1
+ import { z } from "zod";
2
+ import { createTool } from "../../factory.js";
3
+ import { layoutElementSchema } from "../../../schema/app/index.js";
4
+ const inputSchema = {
5
+ app: z
6
+ .string()
7
+ .describe("The ID of the app to retrieve form layout from (numeric value as string)"),
8
+ preview: z
9
+ .boolean()
10
+ .optional()
11
+ .describe("Whether to retrieve from preview environment (requires app administration permission for preview, record view/add permission for production)"),
12
+ };
13
+ const outputSchema = {
14
+ layout: z
15
+ .array(layoutElementSchema)
16
+ .describe("Array of layout elements (rows, subtables, groups)"),
17
+ revision: z.string().describe("App configuration revision number"),
18
+ };
19
+ const callback = async ({ app, preview }, { client }) => {
20
+ const response = await client.app.getFormLayout({
21
+ app,
22
+ preview,
23
+ });
24
+ const result = {
25
+ layout: response.layout,
26
+ revision: response.revision,
27
+ };
28
+ return {
29
+ structuredContent: result,
30
+ content: [
31
+ {
32
+ type: "text",
33
+ text: JSON.stringify(result, null, 2),
34
+ },
35
+ ],
36
+ };
37
+ };
38
+ export const getFormLayout = createTool("kintone-get-form-layout", {
39
+ title: "Get Form Layout",
40
+ description: "Get form layout from a kintone app",
41
+ inputSchema,
42
+ outputSchema,
43
+ }, callback);
@@ -0,0 +1,119 @@
1
+ import { z } from "zod";
2
+ import { createTool } from "../../factory.js";
3
+ const inputSchema = {
4
+ app: z
5
+ .string()
6
+ .describe("The ID of the app to retrieve (numeric value as string)"),
7
+ lang: z
8
+ .enum(["ja", "en", "zh", "default", "user"])
9
+ .optional()
10
+ .describe("The language for retrieving the app name and description"),
11
+ preview: z
12
+ .boolean()
13
+ .optional()
14
+ .describe("Whether to retrieve from preview environment (requires app administration permission for preview, record view/add permission for production)"),
15
+ };
16
+ const outputSchema = {
17
+ name: z.string().describe("The app name"),
18
+ description: z.string().describe("The app description"),
19
+ icon: z
20
+ .object({
21
+ type: z.enum(["FILE", "PRESET"]).describe("The icon type"),
22
+ key: z.string().optional().describe("The icon key"),
23
+ file: z
24
+ .object({
25
+ contentType: z.string().describe("The content type of the file"),
26
+ fileKey: z.string().describe("The file key"),
27
+ name: z.string().describe("The file name"),
28
+ size: z.string().describe("The file size"),
29
+ })
30
+ .optional()
31
+ .describe("File information (only when type is FILE)"),
32
+ })
33
+ .describe("The app icon settings"),
34
+ theme: z
35
+ .enum([
36
+ "WHITE",
37
+ "CLIPBOARD",
38
+ "BINDER",
39
+ "PENCIL",
40
+ "CLIPS",
41
+ "RED",
42
+ "BLUE",
43
+ "GREEN",
44
+ "YELLOW",
45
+ "BLACK",
46
+ ])
47
+ .describe("The app theme"),
48
+ titleField: z
49
+ .object({
50
+ selectionMode: z
51
+ .enum(["AUTO", "MANUAL"])
52
+ .describe("Title field selection mode"),
53
+ code: z.string().optional().describe("Field code for manual selection"),
54
+ })
55
+ .describe("Record title field configuration"),
56
+ enableThumbnails: z.boolean().describe("Whether thumbnails are enabled"),
57
+ enableBulkDeletion: z
58
+ .boolean()
59
+ .describe("Whether bulk record deletion is enabled"),
60
+ enableComments: z.boolean().describe("Whether comments are enabled"),
61
+ enableDuplicateRecord: z
62
+ .boolean()
63
+ .describe("Whether record duplication is enabled"),
64
+ enableInlineRecordEditing: z
65
+ .boolean()
66
+ .describe("Whether inline record editing is enabled"),
67
+ numberPrecision: z
68
+ .object({
69
+ digits: z.string().describe("The number of digits (1 to 30)"),
70
+ decimalPlaces: z
71
+ .string()
72
+ .describe("The number of decimal places (0 to 10)"),
73
+ roundingMode: z
74
+ .enum(["HALF_EVEN", "UP", "DOWN"])
75
+ .describe("The rounding mode"),
76
+ })
77
+ .describe("The numeric calculation settings"),
78
+ firstMonthOfFiscalYear: z
79
+ .string()
80
+ .describe("The first month of the fiscal year (1-12)"),
81
+ revision: z.string().describe("The revision number"),
82
+ };
83
+ const toolName = "kintone-get-general-settings";
84
+ const toolConfig = {
85
+ title: "Get General Settings",
86
+ description: "Get general settings of a kintone app",
87
+ inputSchema,
88
+ outputSchema,
89
+ };
90
+ const callback = async ({ app, lang, preview }, { client }) => {
91
+ const settings = await client.app.getAppSettings({ app, lang, preview });
92
+ console.log(settings);
93
+ const result = {
94
+ name: settings.name,
95
+ description: settings.description,
96
+ icon: settings.icon,
97
+ theme: settings.theme,
98
+ titleField: settings.titleField,
99
+ enableThumbnails: settings.enableThumbnails,
100
+ enableBulkDeletion: settings.enableBulkDeletion,
101
+ enableComments: settings.enableComments,
102
+ enableDuplicateRecord: settings.enableDuplicateRecord,
103
+ // @ts-ignore - enableInlineRecordEditing is not yet in the Kintone SDK types but exists in API response
104
+ enableInlineRecordEditing: settings.enableInlineRecordEditing,
105
+ numberPrecision: settings.numberPrecision,
106
+ firstMonthOfFiscalYear: settings.firstMonthOfFiscalYear,
107
+ revision: settings.revision,
108
+ };
109
+ return {
110
+ structuredContent: result,
111
+ content: [
112
+ {
113
+ type: "text",
114
+ text: JSON.stringify(result, null, 2),
115
+ },
116
+ ],
117
+ };
118
+ };
119
+ export const getGeneralSettings = createTool(toolName, toolConfig, callback);
@@ -1,7 +1,5 @@
1
1
  import { z } from "zod";
2
- import { createTool } from "../../utils.js";
3
- import { getKintoneClient } from "../../../client.js";
4
- import { parseKintoneClientConfig } from "../../../config/index.js";
2
+ import { createTool } from "../../factory.js";
5
3
  const inputSchema = {
6
4
  app: z
7
5
  .string()
@@ -10,6 +8,10 @@ const inputSchema = {
10
8
  .enum(["ja", "en", "zh", "default", "user"])
11
9
  .optional()
12
10
  .describe("The language for field names"),
11
+ preview: z
12
+ .boolean()
13
+ .optional()
14
+ .describe("Whether to get process management settings from pre-live environment"),
13
15
  };
14
16
  const entitySchema = z.object({
15
17
  type: z.enum([
@@ -64,17 +66,18 @@ const outputSchema = {
64
66
  .describe("Array containing action configurations"),
65
67
  revision: z.string().describe("App settings revision number"),
66
68
  };
67
- export const getProcessManagement = createTool("kintone-get-process-management", {
69
+ const toolName = "kintone-get-process-management";
70
+ const toolConfig = {
68
71
  title: "Get Process Management",
69
72
  description: "Get process management settings from a kintone app",
70
73
  inputSchema,
71
74
  outputSchema,
72
- }, async ({ app, lang }) => {
73
- const config = parseKintoneClientConfig();
74
- const client = getKintoneClient(config);
75
+ };
76
+ const callback = async ({ app, lang, preview }, { client }) => {
75
77
  const response = await client.app.getProcessManagement({
76
78
  app,
77
79
  lang,
80
+ preview,
78
81
  });
79
82
  return {
80
83
  structuredContent: response,
@@ -85,4 +88,5 @@ export const getProcessManagement = createTool("kintone-get-process-management",
85
88
  },
86
89
  ],
87
90
  };
88
- });
91
+ };
92
+ export const getProcessManagement = createTool(toolName, toolConfig, callback);
@@ -0,0 +1,49 @@
1
+ import { z } from "zod";
2
+ import { ensureDirectoryExists, generateFileName, generateFilePath, getFileTypeFromArrayBuffer, writeFileSyncWithoutOverwrite, } from "../../../lib/filesystem.js";
3
+ import { createTool } from "../../factory.js";
4
+ const inputSchema = {
5
+ fileKey: z
6
+ .string()
7
+ .describe("The unique file key to download (obtained from record retrieval or file upload)"),
8
+ fileName: z
9
+ .string()
10
+ .describe("The filename (without extension) to use when downloading to local storage. The extension will be automatically detected and added based on the file's MIME type"),
11
+ };
12
+ const outputSchema = {
13
+ filePath: z.string().describe("Absolute path to the downloaded file"),
14
+ mimeType: z.string().describe("MIME type of the downloaded file"),
15
+ fileSize: z.number().describe("File size in bytes"),
16
+ };
17
+ const toolName = "kintone-download-file";
18
+ const toolConfig = {
19
+ title: "Download File from Kintone",
20
+ description: "Download a file from kintone using its fileKey and save it to the configured download directory. Returns the absolute path to the saved file. Requires KINTONE_ATTACHMENTS_DIR environment variable to be set, app record viewing permission, and permission to view the field containing the file.",
21
+ inputSchema,
22
+ outputSchema,
23
+ };
24
+ const callback = async ({ fileKey, fileName }, { client, attachmentsDir }) => {
25
+ // Check if download directory is configured
26
+ if (!attachmentsDir) {
27
+ throw new Error("KINTONE_ATTACHMENTS_DIR environment variable must be set to use file download feature");
28
+ }
29
+ const buffer = await client.file.downloadFile({ fileKey });
30
+ ensureDirectoryExists(attachmentsDir);
31
+ const fileTypeResult = await getFileTypeFromArrayBuffer(buffer);
32
+ const filePath = generateFilePath(attachmentsDir, generateFileName(fileName, fileTypeResult?.ext));
33
+ writeFileSyncWithoutOverwrite(filePath, buffer);
34
+ const result = {
35
+ filePath,
36
+ mimeType: fileTypeResult?.mime || "application/octet-stream",
37
+ fileSize: buffer.byteLength,
38
+ };
39
+ return {
40
+ structuredContent: result,
41
+ content: [
42
+ {
43
+ type: "text",
44
+ text: JSON.stringify(result, null, 2),
45
+ },
46
+ ],
47
+ };
48
+ };
49
+ export const downloadFile = createTool(toolName, toolConfig, callback);
@@ -1,8 +1,6 @@
1
1
  import { z } from "zod";
2
- import { createTool } from "../../utils.js";
3
- import { getKintoneClient } from "../../../client.js";
4
- import { parseKintoneClientConfig } from "../../../config/index.js";
5
- import { recordSchemaForParameterWithoutFile } from "../../../schema/record/record-for-parameter.js";
2
+ import { createTool } from "../../factory.js";
3
+ import { recordSchemaForParameterWithoutFile } from "../../../schema/record/index.js";
6
4
  const inputSchema = {
7
5
  app: z
8
6
  .string()
@@ -19,14 +17,14 @@ const outputSchema = {
19
17
  .array(z.string())
20
18
  .describe("Array of revision numbers of the created records"),
21
19
  };
22
- export const addRecords = createTool("kintone-add-records", {
20
+ const toolName = "kintone-add-records";
21
+ const toolConfig = {
23
22
  title: "Add Records",
24
23
  description: "Add multiple records to a kintone app. Use kintone-get-form-fields tool first to discover available field codes and their required formats. Note: Some fields cannot be registered (LOOKUP copies, STATUS, CATEGORY, CALC, ASSIGNEE, auto-calculated fields).",
25
24
  inputSchema,
26
25
  outputSchema,
27
- }, async ({ app, records }) => {
28
- const config = parseKintoneClientConfig();
29
- const client = getKintoneClient(config);
26
+ };
27
+ const callback = async ({ app, records }, { client }) => {
30
28
  const response = await client.record.addRecords({
31
29
  app,
32
30
  records,
@@ -44,4 +42,5 @@ export const addRecords = createTool("kintone-add-records", {
44
42
  },
45
43
  ],
46
44
  };
47
- });
45
+ };
46
+ export const addRecords = createTool(toolName, toolConfig, callback);
@@ -1,7 +1,5 @@
1
1
  import { z } from "zod";
2
- import { createTool } from "../../utils.js";
3
- import { getKintoneClient } from "../../../client.js";
4
- import { parseKintoneClientConfig } from "../../../config/index.js";
2
+ import { createTool } from "../../factory.js";
5
3
  const inputSchema = {
6
4
  app: z.string().describe("The ID of the app (numeric value as string)"),
7
5
  ids: z
@@ -15,17 +13,18 @@ const inputSchema = {
15
13
  .describe("Array of expected revision numbers for each record (numeric values as strings). If specified, must have the same length as ids array. Deletion will fail if current revisions don't match. Specify -1 or omit to skip revision validation."),
16
14
  };
17
15
  const outputSchema = {};
18
- export const deleteRecords = createTool("kintone-delete-records", {
16
+ const toolName = "kintone-delete-records";
17
+ const toolConfig = {
19
18
  title: "Delete Records",
20
19
  description: "Delete multiple records from a kintone app. Maximum 100 records can be deleted at once.",
21
20
  inputSchema,
22
21
  outputSchema,
23
- }, async ({ app, ids, revisions }) => {
24
- const config = parseKintoneClientConfig();
25
- const client = getKintoneClient(config);
22
+ };
23
+ const callback = async ({ app, ids, revisions }, { client }) => {
26
24
  await client.record.deleteRecords({ app, ids, revisions });
27
25
  return {
28
26
  structuredContent: {},
29
27
  content: [],
30
28
  };
31
- });
29
+ };
30
+ export const deleteRecords = createTool(toolName, toolConfig, callback);
@@ -1,8 +1,6 @@
1
1
  import { z } from "zod";
2
- import { createTool } from "../../utils.js";
3
- import { getKintoneClient } from "../../../client.js";
4
- import { parseKintoneClientConfig } from "../../../config/index.js";
5
- import { recordSchema } from "../../../schema/record/records.js";
2
+ import { createTool } from "../../factory.js";
3
+ import { recordSchema } from "../../../schema/record/index.js";
6
4
  const filtersSchema = z
7
5
  .object({
8
6
  textContains: z
@@ -121,14 +119,14 @@ function buildQueryFromFilters(filters) {
121
119
  });
122
120
  return conditions.length > 0 ? conditions.join(" and ") : undefined;
123
121
  }
124
- export const getRecords = createTool("kintone-get-records", {
122
+ const toolName = "kintone-get-records";
123
+ const toolConfig = {
125
124
  title: "Get Records",
126
125
  description: "Get multiple records from a kintone app with structured filtering. Use kintone-get-form-fields tool first to discover available fields and their types.",
127
126
  inputSchema,
128
127
  outputSchema,
129
- }, async ({ app, filters, fields, orderBy, limit, offset }) => {
130
- const config = parseKintoneClientConfig();
131
- const client = getKintoneClient(config);
128
+ };
129
+ const callback = async ({ app, filters, fields, orderBy, limit, offset }, { client }) => {
132
130
  let query = filters ? buildQueryFromFilters(filters) : undefined;
133
131
  if (orderBy && orderBy.length > 0) {
134
132
  const orderClauses = orderBy
@@ -163,4 +161,5 @@ export const getRecords = createTool("kintone-get-records", {
163
161
  },
164
162
  ],
165
163
  };
166
- });
164
+ };
165
+ export const getRecords = createTool(toolName, toolConfig, callback);
@@ -1,8 +1,6 @@
1
1
  import { z } from "zod";
2
- import { createTool } from "../../utils.js";
3
- import { getKintoneClient } from "../../../client.js";
4
- import { parseKintoneClientConfig } from "../../../config/index.js";
5
- import { recordSchemaForParameter } from "../../../schema/record/record-for-parameter.js";
2
+ import { createTool } from "../../factory.js";
3
+ import { recordSchemaForParameter } from "../../../schema/record/index.js";
6
4
  const updateRecordSchema = z.object({
7
5
  // updateKey指定は対象外
8
6
  id: z.string().describe("Record ID to update (numeric value as string)"),
@@ -30,14 +28,14 @@ const outputSchema = {
30
28
  }))
31
29
  .describe("Array of updated record information"),
32
30
  };
33
- export const updateRecords = createTool("kintone-update-records", {
31
+ const toolName = "kintone-update-records";
32
+ const toolConfig = {
34
33
  title: "Update Records",
35
34
  description: "Update multiple records in a kintone app. Use kintone-get-form-fields tool first to discover available field codes and their required formats. Note: Some fields cannot be updated (LOOKUP copies, STATUS, CATEGORY, CALC, ASSIGNEE, auto-calculated fields).",
36
35
  inputSchema,
37
36
  outputSchema,
38
- }, async ({ app, records }) => {
39
- const config = parseKintoneClientConfig();
40
- const client = getKintoneClient(config);
37
+ };
38
+ const callback = async ({ app, records }, { client }) => {
41
39
  const response = await client.record.updateRecords({
42
40
  app,
43
41
  records,
@@ -55,4 +53,5 @@ export const updateRecords = createTool("kintone-update-records", {
55
53
  },
56
54
  ],
57
55
  };
58
- });
56
+ };
57
+ export const updateRecords = createTool(toolName, toolConfig, callback);
@@ -1,7 +1,5 @@
1
1
  import { z } from "zod";
2
- import { createTool } from "../../utils.js";
3
- import { getKintoneClient } from "../../../client.js";
4
- import { parseKintoneClientConfig } from "../../../config/index.js";
2
+ import { createTool } from "../../factory.js";
5
3
  const statusRecordSchema = z.object({
6
4
  id: z.string().describe("Record ID (numeric value as string)"),
7
5
  action: z
@@ -34,14 +32,14 @@ const outputSchema = {
34
32
  }))
35
33
  .describe("Array of updated record information"),
36
34
  };
37
- export const updateStatuses = createTool("kintone-update-statuses", {
35
+ const toolName = "kintone-update-statuses";
36
+ const toolConfig = {
38
37
  title: "Update Statuses",
39
38
  description: "Update status of multiple records in a kintone app. Requires process management feature to be enabled. Maximum 100 records can be updated at once.",
40
39
  inputSchema,
41
40
  outputSchema,
42
- }, async ({ app, records }) => {
43
- const config = parseKintoneClientConfig();
44
- const client = getKintoneClient(config);
41
+ };
42
+ const callback = async ({ app, records }, { client }) => {
45
43
  const response = await client.record.updateRecordsStatus({
46
44
  app,
47
45
  records,
@@ -58,4 +56,5 @@ export const updateStatuses = createTool("kintone-update-statuses", {
58
56
  },
59
57
  ],
60
58
  };
61
- });
59
+ };
60
+ export const updateStatuses = createTool(toolName, toolConfig, callback);
@@ -0,0 +1 @@
1
+ export {};
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // This file is auto-generated. Do not edit manually.
2
- export const version = "1.0.0"; // x-release-please-version
2
+ export const version = "1.1.0"; // x-release-please-version
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kintone/mcp-server",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "The official MCP Server for kintone",
5
5
  "keywords": [
6
6
  "kintone",
@@ -31,7 +31,8 @@
31
31
  ],
32
32
  "dependencies": {
33
33
  "@kintone/rest-api-client": "^5.7.4",
34
- "@modelcontextprotocol/sdk": "^1.17.4",
34
+ "@modelcontextprotocol/sdk": "^1.17.5",
35
+ "file-type": "^21.0.0",
35
36
  "https-proxy-agent": "^7.0.6",
36
37
  "zod": "^3.25.76"
37
38
  },
@@ -41,10 +42,10 @@
41
42
  "@commitlint/config-conventional": "^19.8.1",
42
43
  "@cybozu/eslint-config": "^24.2.0",
43
44
  "@cybozu/license-manager": "^1.3.1",
44
- "@types/node": "^22.18.0",
45
+ "@types/node": "^22.18.1",
45
46
  "doctoc": "^2.2.1",
46
- "eslint": "^9.34.0",
47
- "eslint-plugin-package-json": "^0.56.0",
47
+ "eslint": "^9.35.0",
48
+ "eslint-plugin-package-json": "^0.56.2",
48
49
  "globals": "^16.3.0",
49
50
  "prettier": "^3.6.2",
50
51
  "tsx": "^4.20.5",
package/dist/server.js DELETED
@@ -1,20 +0,0 @@
1
- import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
- import { tools } from "./tools/index.js";
3
- import { version } from "./version.js";
4
- import { PACKAGE_NAME, parseKintoneClientConfig } from "./config/index.js";
5
- import { shouldEnableTool } from "./tool-filters.js";
6
- export const createServer = () => {
7
- const server = new McpServer({
8
- name: PACKAGE_NAME,
9
- version,
10
- }, {
11
- capabilities: {
12
- tools: {},
13
- },
14
- });
15
- const config = parseKintoneClientConfig();
16
- tools
17
- .filter((tool) => shouldEnableTool(tool.name, config))
18
- .forEach((tool) => server.registerTool(tool.name, tool.config, tool.callback));
19
- return server;
20
- };