notion-mcp-server 0.0.2 → 1.0.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/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
 
10
10
  **Notion MCP Server** is a Model Context Protocol (MCP) server implementation that enables AI assistants to interact with Notion's API. This production-ready server provides a complete set of tools and endpoints for reading, creating, and modifying Notion content through natural language interactions.
11
11
 
12
- > 🚧 **Active Development**: Database support is now available! If you find this project useful, please consider giving it a star - it helps me know that this work is valuable to the community and motivates further development.
12
+ > 🚧 **Active Development**: Database support is now available! Comments and user management tools have been added. If you find this project useful, please consider giving it a star - it helps me know that this work is valuable to the community and motivates further development.
13
13
 
14
14
  <a href="https://glama.ai/mcp/servers/zrh07hteaa">
15
15
  <img width="380" height="200" src="https://glama.ai/mcp/servers/zrh07hteaa/badge" />
@@ -56,6 +56,10 @@
56
56
  - "Add bullet points to my meeting notes page"
57
57
  - "Create a new database for tracking projects"
58
58
  - "Add new entries to my task database"
59
+ - "Add a comment to my project page"
60
+ - "Show me all comments on this document"
61
+ - "List all users in my workspace"
62
+ - "Get information about a specific user"
59
63
 
60
64
  ### Cursor Integration
61
65
 
@@ -124,6 +128,8 @@ env NOTION_TOKEN=YOUR_KEY NOTION_PAGE_ID=YOUR_PAGE_ID npx -y notion-mcp-server
124
128
  - **🔄 Batch Operations** - Perform multiple operations in a single request
125
129
  - **🗑️ Archive & Restore** - Archive and restore Notion pages
126
130
  - **🔎 Search Functionality** - Search Notion pages and databases by title
131
+ - **💬 Comments Management** - Get, create, and reply to comments on pages and discussions
132
+ - **👥 User Management** - Retrieve workspace users and user information
127
133
 
128
134
  ## 📚 Documentation
129
135
 
@@ -190,6 +196,28 @@ Delete multiple blocks in a single operation
190
196
  ##### `batch_mixed_operations`
191
197
  Perform a mix of append, update, and delete operations in a single request
192
198
 
199
+ #### Comment Operations
200
+
201
+ ##### `get_comments`
202
+ Retrieve comments from a page or block with pagination support
203
+
204
+ ##### `add_page_comment`
205
+ Add a new comment to a Notion page
206
+
207
+ ##### `add_discussion_comment`
208
+ Add a comment to an existing discussion thread
209
+
210
+ #### User Operations
211
+
212
+ ##### `get_list_users`
213
+ Retrieve a paginated list of all users in the workspace
214
+
215
+ ##### `get_user`
216
+ Get detailed information about a specific user by ID
217
+
218
+ ##### `get_bot_user`
219
+ Retrieve the current bot user associated with the API token
220
+
193
221
  ### Available Resources
194
222
 
195
223
  The server currently does not expose any resources, focusing instead on tool-based operations.
@@ -1,5 +1,5 @@
1
1
  // Configuration
2
2
  export const CONFIG = {
3
3
  serverName: "notion-mcp-server",
4
- serverVersion: "0.0.2",
4
+ serverVersion: "1.0.0",
5
5
  };
@@ -0,0 +1,34 @@
1
+ import { z } from "zod";
2
+ import { RICH_TEXT_ITEM_REQUEST_SCHEMA } from "./rich-text.js";
3
+ // Schema for getting comments
4
+ export const GET_COMMENTS_SCHEMA = {
5
+ block_id: z
6
+ .string()
7
+ .describe("The ID of the block or page to get comments from"),
8
+ start_cursor: z
9
+ .string()
10
+ .optional()
11
+ .describe("The cursor to start from for pagination"),
12
+ page_size: z
13
+ .number()
14
+ .optional()
15
+ .describe("Number of comments to return per page"),
16
+ };
17
+ // Schema for adding a comment to a page
18
+ export const ADD_PAGE_COMMENT_SCHEMA = {
19
+ parent: z.object({
20
+ page_id: z.string().describe("The ID of the page to add the comment to"),
21
+ }),
22
+ rich_text: z
23
+ .array(RICH_TEXT_ITEM_REQUEST_SCHEMA)
24
+ .describe("Rich text content for the comment"),
25
+ };
26
+ // Schema for adding a comment to a discussion
27
+ export const ADD_DISCUSSION_COMMENT_SCHEMA = {
28
+ discussion_id: z
29
+ .string()
30
+ .describe("The ID of the discussion to add the comment to"),
31
+ rich_text: z
32
+ .array(RICH_TEXT_ITEM_REQUEST_SCHEMA)
33
+ .describe("Rich text content for the comment"),
34
+ };
@@ -0,0 +1,13 @@
1
+ import { z } from "zod";
2
+ // Schema for listing users with pagination
3
+ export const LIST_USERS_SCHEMA = {
4
+ start_cursor: z.string().optional().describe("Pagination cursor"),
5
+ page_size: z
6
+ .number()
7
+ .optional()
8
+ .describe("Number of users to return per page"),
9
+ };
10
+ // Schema for getting a single user
11
+ export const GET_USER_SCHEMA = {
12
+ user_id: z.string().describe("The ID of the user to retrieve"),
13
+ };
@@ -0,0 +1,62 @@
1
+ import { notion } from "../services/notion.js";
2
+ import { handleNotionError } from "../utils/error.js";
3
+ export const registerGetCommentsTool = async (params) => {
4
+ try {
5
+ const response = await notion.comments.list(params);
6
+ return {
7
+ content: [
8
+ {
9
+ type: "text",
10
+ text: `Comments retrieved successfully: ${response.results.length}`,
11
+ },
12
+ {
13
+ type: "text",
14
+ text: JSON.stringify(response, null, 2),
15
+ },
16
+ ],
17
+ };
18
+ }
19
+ catch (error) {
20
+ return handleNotionError(error);
21
+ }
22
+ };
23
+ export const registerAddPageCommentTool = async (params) => {
24
+ try {
25
+ const response = await notion.comments.create(params);
26
+ return {
27
+ content: [
28
+ {
29
+ type: "text",
30
+ text: `Comment created successfully: ${response.id}`,
31
+ },
32
+ {
33
+ type: "text",
34
+ text: JSON.stringify(response, null, 2),
35
+ },
36
+ ],
37
+ };
38
+ }
39
+ catch (error) {
40
+ return handleNotionError(error);
41
+ }
42
+ };
43
+ export const registerAddDiscussionCommentTool = async (params) => {
44
+ try {
45
+ const response = await notion.comments.create(params);
46
+ return {
47
+ content: [
48
+ {
49
+ type: "text",
50
+ text: `Comment created successfully: ${response.id}`,
51
+ },
52
+ {
53
+ type: "text",
54
+ text: JSON.stringify(response, null, 2),
55
+ },
56
+ ],
57
+ };
58
+ }
59
+ catch (error) {
60
+ return handleNotionError(error);
61
+ }
62
+ };
@@ -18,6 +18,12 @@ import { createDatabase } from "./createDatabase.js";
18
18
  import { queryDatabase } from "./queryDatabase.js";
19
19
  import { updateDatabase } from "./updateDatabase.js";
20
20
  import { updatePageProperties } from "./updatePageProperties.js";
21
+ import { registerAddDiscussionCommentTool, registerAddPageCommentTool, registerGetCommentsTool, } from "./comments.js";
22
+ import { ADD_DISCUSSION_COMMENT_SCHEMA, ADD_PAGE_COMMENT_SCHEMA, GET_COMMENTS_SCHEMA, } from "../schema/comments.js";
23
+ import { registerGetListUsersTool } from "./users.js";
24
+ import { LIST_USERS_SCHEMA } from "../schema/users.js";
25
+ import { registerGetBotUserTool, registerGetUserTool } from "./users.js";
26
+ import { GET_USER_SCHEMA } from "../schema/users.js";
21
27
  export const registerAllTools = () => {
22
28
  server.tool("create_page", "Create a new page in Notion", CREATE_PAGE_SCHEMA, registerCreatePageTool);
23
29
  server.tool("archive_page", "Archive (trash) a Notion page", ARCHIVE_PAGE_SCHEMA, archivePage);
@@ -38,4 +44,10 @@ export const registerAllTools = () => {
38
44
  server.tool("batch_update_blocks", "Update multiple blocks in a single operation", BATCH_UPDATE_BLOCKS_SCHEMA, batchUpdateBlocks);
39
45
  server.tool("batch_delete_blocks", "Delete multiple blocks in a single operation", BATCH_DELETE_BLOCKS_SCHEMA, batchDeleteBlocks);
40
46
  server.tool("batch_mixed_operations", "Perform a mix of append, update, and delete operations in a single request", BATCH_MIXED_OPERATIONS_SCHEMA, batchMixedOperations);
47
+ server.tool("get_comments", "Get comments for a page or discussion", GET_COMMENTS_SCHEMA, registerGetCommentsTool);
48
+ server.tool("add_page_comment", "Add a comment to a page", ADD_PAGE_COMMENT_SCHEMA, registerAddPageCommentTool);
49
+ server.tool("add_discussion_comment", "Add a comment to a discussion", ADD_DISCUSSION_COMMENT_SCHEMA, registerAddDiscussionCommentTool);
50
+ server.tool("get_list_users", "Get a list of users in Notion", LIST_USERS_SCHEMA, registerGetListUsersTool);
51
+ server.tool("get_user", "Get a user in Notion", GET_USER_SCHEMA, registerGetUserTool);
52
+ server.tool("get_bot_user", "Get the bot user in Notion", {}, registerGetBotUserTool);
41
53
  };
@@ -4,10 +4,6 @@ export async function searchPages(params) {
4
4
  try {
5
5
  const response = await notion.search({
6
6
  query: params.query || "",
7
- filter: {
8
- value: "page",
9
- property: "object",
10
- },
11
7
  sort: params.sort,
12
8
  start_cursor: params.start_cursor,
13
9
  page_size: params.page_size || 10,
@@ -0,0 +1,62 @@
1
+ import { notion } from "../services/notion.js";
2
+ import { handleNotionError } from "../utils/error.js";
3
+ export const registerGetListUsersTool = async (params) => {
4
+ try {
5
+ const response = await notion.users.list(params);
6
+ return {
7
+ content: [
8
+ {
9
+ type: "text",
10
+ text: `Users retrieved successfully: ${response.results.length}`,
11
+ },
12
+ {
13
+ type: "text",
14
+ text: JSON.stringify(response, null, 2),
15
+ },
16
+ ],
17
+ };
18
+ }
19
+ catch (error) {
20
+ return handleNotionError(error);
21
+ }
22
+ };
23
+ export const registerGetUserTool = async (params) => {
24
+ try {
25
+ const response = await notion.users.retrieve(params);
26
+ return {
27
+ content: [
28
+ {
29
+ type: "text",
30
+ text: `User retrieved successfully: ${response.id}`,
31
+ },
32
+ {
33
+ type: "text",
34
+ text: JSON.stringify(response, null, 2),
35
+ },
36
+ ],
37
+ };
38
+ }
39
+ catch (error) {
40
+ return handleNotionError(error);
41
+ }
42
+ };
43
+ export const registerGetBotUserTool = async () => {
44
+ try {
45
+ const response = await notion.users.me({});
46
+ return {
47
+ content: [
48
+ {
49
+ type: "text",
50
+ text: `Bot user retrieved successfully: ${response.id}`,
51
+ },
52
+ {
53
+ type: "text",
54
+ text: JSON.stringify(response, null, 2),
55
+ },
56
+ ],
57
+ };
58
+ }
59
+ catch (error) {
60
+ return handleNotionError(error);
61
+ }
62
+ };
@@ -0,0 +1,6 @@
1
+ import { z } from "zod";
2
+ import { GET_COMMENTS_SCHEMA, ADD_PAGE_COMMENT_SCHEMA, ADD_DISCUSSION_COMMENT_SCHEMA, } from "../schema/comments.js";
3
+ // Types inferred from the schemas
4
+ export const getCommentsSchema = z.object(GET_COMMENTS_SCHEMA);
5
+ export const addPageCommentSchema = z.object(ADD_PAGE_COMMENT_SCHEMA);
6
+ export const addDiscussionCommentSchema = z.object(ADD_DISCUSSION_COMMENT_SCHEMA);
@@ -0,0 +1,5 @@
1
+ import { z } from "zod";
2
+ import { LIST_USERS_SCHEMA, GET_USER_SCHEMA } from "../schema/users.js";
3
+ // Types inferred from schemas
4
+ const listUsersSchema = z.object(LIST_USERS_SCHEMA);
5
+ const getUserSchema = z.object(GET_USER_SCHEMA);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "notion-mcp-server",
3
- "version": "0.0.2",
3
+ "version": "1.0.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "notion-mcp-server": "build/index.js"