@kintone/mcp-server 1.3.15 → 1.4.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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.4.0](https://github.com/kintone/mcp-server/compare/1.3.15...1.4.0) (2026-05-27)
4
+
5
+
6
+ ### Features
7
+
8
+ * add search tool ([#440](https://github.com/kintone/mcp-server/issues/440)) ([011538e](https://github.com/kintone/mcp-server/commit/011538e98c8f74ea04fcdb0cd44df61a32332370))
9
+
3
10
  ## [1.3.15](https://github.com/kintone/mcp-server/compare/1.3.14...1.3.15) (2026-05-24)
4
11
 
5
12
 
@@ -0,0 +1,2 @@
1
+ export { searchInputSchema } from "./input.js";
2
+ export { searchOutputSchema } from "./output.js";
@@ -0,0 +1,113 @@
1
+ import { z } from "zod";
2
+ const searchQuerySchema = z.object({
3
+ operator: z
4
+ .enum(["AND", "OR", "NOT"])
5
+ .describe("Search operator (AND: all keywords match, OR: any keyword matches, NOT: keywords do not match)"),
6
+ keywords: z
7
+ .array(z.string())
8
+ .min(1)
9
+ .describe("Keywords to search for (at least 1 required)"),
10
+ });
11
+ const searchScopeSchema = z.discriminatedUnion("scope", [
12
+ z.object({
13
+ scope: z.literal("SPACE"),
14
+ ids: z
15
+ .array(z.union([z.number(), z.string()]))
16
+ .optional()
17
+ .nullable()
18
+ .describe("Space IDs to search in"),
19
+ }),
20
+ z.object({
21
+ scope: z.literal("APP"),
22
+ ids: z
23
+ .array(z.union([z.number(), z.string()]))
24
+ .optional()
25
+ .nullable()
26
+ .describe("App IDs to search in"),
27
+ }),
28
+ z.object({
29
+ scope: z.literal("PEOPLE"),
30
+ codes: z
31
+ .array(z.string())
32
+ .optional()
33
+ .nullable()
34
+ .describe("People codes to search in"),
35
+ }),
36
+ z.object({
37
+ scope: z.literal("MESSAGE"),
38
+ codes: z
39
+ .array(z.string())
40
+ .optional()
41
+ .nullable()
42
+ .describe("Message codes to search in"),
43
+ }),
44
+ ]);
45
+ const searchSortSchema = z.union([
46
+ z.object({
47
+ by: z.literal("RELEVANCE").optional().describe("Sort by relevance"),
48
+ order: z.literal("DESC").optional().describe("Order (only DESC)"),
49
+ }),
50
+ z.object({
51
+ by: z.literal("CREATED_AT").describe("Sort by created date"),
52
+ order: z
53
+ .enum(["ASC", "DESC"])
54
+ .optional()
55
+ .describe("Sort order (ASC or DESC)"),
56
+ }),
57
+ ]);
58
+ const searchHitTypeSchema = z.enum([
59
+ "RECORD",
60
+ "RECORD_COMMENT",
61
+ "SPACE",
62
+ "THREAD",
63
+ "THREAD_COMMENT",
64
+ "PEOPLE_COMMENT",
65
+ "MESSAGE_COMMENT",
66
+ "ATTACHMENT",
67
+ ]);
68
+ export const searchInputSchema = {
69
+ query: z
70
+ .tuple([searchQuerySchema])
71
+ .rest(searchQuerySchema)
72
+ .describe("Search queries (at least 1 required)"),
73
+ types: z
74
+ .array(searchHitTypeSchema)
75
+ .optional()
76
+ .nullable()
77
+ .describe("Filter by hit types"),
78
+ scopes: z
79
+ .array(searchScopeSchema)
80
+ .optional()
81
+ .nullable()
82
+ .describe("Scopes to search in"),
83
+ excludeScopes: z
84
+ .array(searchScopeSchema)
85
+ .optional()
86
+ .nullable()
87
+ .describe("Scopes to exclude from search"),
88
+ createdAfter: z
89
+ .string()
90
+ .optional()
91
+ .describe("Filter results created after this date (ISO 8601 format)"),
92
+ createdBefore: z
93
+ .string()
94
+ .optional()
95
+ .describe("Filter results created before this date (ISO 8601 format)"),
96
+ creators: z
97
+ .array(z.string())
98
+ .optional()
99
+ .nullable()
100
+ .describe("Filter by creator codes"),
101
+ sort: searchSortSchema.optional().describe("Sort configuration"),
102
+ limit: z
103
+ .number()
104
+ .min(1)
105
+ .max(20)
106
+ .default(20)
107
+ .describe("Maximum number of results to return"),
108
+ pageToken: z
109
+ .string()
110
+ .optional()
111
+ .nullable()
112
+ .describe("Token for pagination. If undefined, null, or empty string, returns the first page. For subsequent pages, specify the nextPageToken from the previous response."),
113
+ };
@@ -0,0 +1,162 @@
1
+ import { z } from "zod";
2
+ const searchUserSchema = z.object({
3
+ code: z.string(),
4
+ name: z.string(),
5
+ });
6
+ const idSchema = z.union([z.number(), z.string()]);
7
+ const searchHitRecordSchema = z.object({
8
+ appId: idSchema,
9
+ appName: z.string(),
10
+ recordId: idSchema,
11
+ recordTitle: z.string(),
12
+ createdAt: z.string(),
13
+ creator: searchUserSchema,
14
+ matchedFields: z.array(z.object({ code: z.string(), label: z.string() })),
15
+ spaceId: idSchema.optional(),
16
+ spaceName: z.string().optional(),
17
+ });
18
+ const searchHitRecordCommentSchema = z.object({
19
+ appId: idSchema,
20
+ appName: z.string(),
21
+ recordId: idSchema,
22
+ recordTitle: z.string(),
23
+ commentId: idSchema,
24
+ createdAt: z.string(),
25
+ creator: searchUserSchema,
26
+ spaceId: idSchema.optional(),
27
+ spaceName: z.string().optional(),
28
+ });
29
+ const searchHitSpaceSchema = z.object({
30
+ spaceId: idSchema,
31
+ spaceName: z.string(),
32
+ createdAt: z.string(),
33
+ creator: searchUserSchema,
34
+ });
35
+ const searchHitThreadSchema = z.object({
36
+ spaceId: idSchema,
37
+ spaceName: z.string(),
38
+ threadId: idSchema,
39
+ threadName: z.string(),
40
+ createdAt: z.string(),
41
+ creator: searchUserSchema,
42
+ });
43
+ const searchHitThreadCommentSchema = z.object({
44
+ commentId: idSchema,
45
+ replyId: idSchema.optional(),
46
+ spaceId: idSchema,
47
+ spaceName: z.string(),
48
+ threadId: idSchema,
49
+ threadName: z.string(),
50
+ createdAt: z.string(),
51
+ creator: searchUserSchema,
52
+ });
53
+ const searchHitPeopleCommentSchema = z.object({
54
+ commentId: idSchema,
55
+ replyId: idSchema.optional(),
56
+ owner: searchUserSchema,
57
+ createdAt: z.string(),
58
+ creator: searchUserSchema,
59
+ });
60
+ const searchHitMessageCommentSchema = z.object({
61
+ commentId: idSchema,
62
+ recipient: searchUserSchema,
63
+ createdAt: z.string(),
64
+ creator: searchUserSchema,
65
+ });
66
+ const attachmentBaseSchema = z.object({
67
+ fileKey: z.string(),
68
+ name: z.string(),
69
+ createdAt: z.string(),
70
+ creator: searchUserSchema,
71
+ });
72
+ const hitBase = { url: z.string(), snippets: z.array(z.string()) };
73
+ const searchHitSchema = z.union([
74
+ z.object({
75
+ ...hitBase,
76
+ type: z.literal("RECORD"),
77
+ record: searchHitRecordSchema,
78
+ }),
79
+ z.object({
80
+ ...hitBase,
81
+ type: z.literal("RECORD_COMMENT"),
82
+ recordComment: searchHitRecordCommentSchema,
83
+ }),
84
+ z.object({
85
+ ...hitBase,
86
+ type: z.literal("SPACE"),
87
+ space: searchHitSpaceSchema,
88
+ }),
89
+ z.object({
90
+ ...hitBase,
91
+ type: z.literal("THREAD"),
92
+ thread: searchHitThreadSchema,
93
+ }),
94
+ z.object({
95
+ ...hitBase,
96
+ type: z.literal("THREAD_COMMENT"),
97
+ threadComment: searchHitThreadCommentSchema,
98
+ }),
99
+ z.object({
100
+ ...hitBase,
101
+ type: z.literal("PEOPLE_COMMENT"),
102
+ peopleComment: searchHitPeopleCommentSchema,
103
+ }),
104
+ z.object({
105
+ ...hitBase,
106
+ type: z.literal("MESSAGE_COMMENT"),
107
+ messageComment: searchHitMessageCommentSchema,
108
+ }),
109
+ z.object({
110
+ ...hitBase,
111
+ type: z.literal("ATTACHMENT"),
112
+ attachment: attachmentBaseSchema.extend({
113
+ attachedTo: z.literal("RECORD"),
114
+ }),
115
+ record: searchHitRecordSchema,
116
+ }),
117
+ z.object({
118
+ ...hitBase,
119
+ type: z.literal("ATTACHMENT"),
120
+ attachment: attachmentBaseSchema.extend({ attachedTo: z.literal("SPACE") }),
121
+ space: searchHitSpaceSchema,
122
+ }),
123
+ z.object({
124
+ ...hitBase,
125
+ type: z.literal("ATTACHMENT"),
126
+ attachment: attachmentBaseSchema.extend({
127
+ attachedTo: z.literal("THREAD"),
128
+ }),
129
+ thread: searchHitThreadSchema,
130
+ }),
131
+ z.object({
132
+ ...hitBase,
133
+ type: z.literal("ATTACHMENT"),
134
+ attachment: attachmentBaseSchema.extend({
135
+ attachedTo: z.literal("THREAD_COMMENT"),
136
+ }),
137
+ threadComment: searchHitThreadCommentSchema,
138
+ }),
139
+ z.object({
140
+ ...hitBase,
141
+ type: z.literal("ATTACHMENT"),
142
+ attachment: attachmentBaseSchema.extend({
143
+ attachedTo: z.literal("PEOPLE_COMMENT"),
144
+ }),
145
+ peopleComment: searchHitPeopleCommentSchema,
146
+ }),
147
+ z.object({
148
+ ...hitBase,
149
+ type: z.literal("ATTACHMENT"),
150
+ attachment: attachmentBaseSchema.extend({
151
+ attachedTo: z.literal("MESSAGE_COMMENT"),
152
+ }),
153
+ messageComment: searchHitMessageCommentSchema,
154
+ }),
155
+ ]);
156
+ export const searchOutputSchema = {
157
+ hits: z.array(searchHitSchema).describe("Array of search hits"),
158
+ nextPageToken: z
159
+ .string()
160
+ .nullable()
161
+ .describe("Token for fetching the next page of results"),
162
+ };
@@ -1,7 +1,7 @@
1
1
  const filterRules = [
2
2
  {
3
3
  condition: (condition) => condition.isApiTokenAuth,
4
- excludeTools: ["kintone-get-apps", "kintone-add-app"],
4
+ excludeTools: ["kintone-get-apps", "kintone-add-app", "kintone-search"],
5
5
  },
6
6
  ];
7
7
  export function shouldEnableTool(toolName, condition) {
@@ -18,6 +18,7 @@ import { addApp } from "./kintone/app/add-app.js";
18
18
  import { deployApp } from "./kintone/app/deploy-app.js";
19
19
  import { updateGeneralSettings } from "./kintone/app/update-general-settings.js";
20
20
  import { downloadFile } from "./kintone/file/download-file.js";
21
+ import { search } from "./kintone/search/search.js";
21
22
  export { createToolCallback } from "./factory.js";
22
23
  export const tools = [
23
24
  getApp,
@@ -40,4 +41,5 @@ export const tools = [
40
41
  deployApp,
41
42
  updateGeneralSettings,
42
43
  downloadFile,
44
+ search,
43
45
  ];
@@ -0,0 +1,32 @@
1
+ import { createTool } from "../../factory.js";
2
+ import { searchInputSchema, searchOutputSchema, } from "../../../schema/search/index.js";
3
+ const toolName = "kintone-search";
4
+ const toolConfig = {
5
+ title: "Search",
6
+ description: "Search across kintone for records, spaces, threads, comments, and attachments. " +
7
+ "Performs a cross-domain full-text search. " +
8
+ "Requires password or session authentication (not API token).",
9
+ inputSchema: searchInputSchema,
10
+ outputSchema: searchOutputSchema,
11
+ };
12
+ const callback = async (input, { client }) => {
13
+ const { query, ...rest } = input;
14
+ const response = await client.search({
15
+ ...rest,
16
+ query,
17
+ });
18
+ const result = {
19
+ hits: response.hits,
20
+ nextPageToken: response.nextPageToken,
21
+ };
22
+ return {
23
+ structuredContent: result,
24
+ content: [
25
+ {
26
+ type: "text",
27
+ text: JSON.stringify(result, null, 2),
28
+ },
29
+ ],
30
+ };
31
+ };
32
+ export const search = createTool(toolName, toolConfig, callback);
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.3.15"; // x-release-please-version
2
+ export const version = "1.4.0"; // x-release-please-version
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kintone/mcp-server",
3
- "version": "1.3.15",
3
+ "version": "1.4.0",
4
4
  "description": "The official MCP Server for kintone",
5
5
  "keywords": [
6
6
  "kintone",
@@ -30,7 +30,7 @@
30
30
  "dist"
31
31
  ],
32
32
  "dependencies": {
33
- "@kintone/rest-api-client": "6.1.7",
33
+ "@kintone/rest-api-client": "6.2.0",
34
34
  "@modelcontextprotocol/sdk": "1.26.0",
35
35
  "file-type": "22.0.1",
36
36
  "https-proxy-agent": "7.0.6",