@west10tech/notion-mcp 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.
Files changed (42) hide show
  1. package/README.md +120 -0
  2. package/dist/clients/notion-client.d.ts +53 -0
  3. package/dist/clients/notion-client.d.ts.map +1 -0
  4. package/dist/clients/notion-client.js +2950 -0
  5. package/dist/clients/notion-client.js.map +1 -0
  6. package/dist/config.d.ts +21 -0
  7. package/dist/config.d.ts.map +1 -0
  8. package/dist/config.js +58 -0
  9. package/dist/config.js.map +1 -0
  10. package/dist/index.d.ts +3 -0
  11. package/dist/index.d.ts.map +1 -0
  12. package/dist/index.js +163 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/services/log-batcher.d.ts +44 -0
  15. package/dist/services/log-batcher.d.ts.map +1 -0
  16. package/dist/services/log-batcher.js +81 -0
  17. package/dist/services/log-batcher.js.map +1 -0
  18. package/dist/services/log-shipper.d.ts +104 -0
  19. package/dist/services/log-shipper.d.ts.map +1 -0
  20. package/dist/services/log-shipper.js +384 -0
  21. package/dist/services/log-shipper.js.map +1 -0
  22. package/dist/services/logger.d.ts +92 -0
  23. package/dist/services/logger.d.ts.map +1 -0
  24. package/dist/services/logger.js +224 -0
  25. package/dist/services/logger.js.map +1 -0
  26. package/dist/services/progress-reporter.d.ts +64 -0
  27. package/dist/services/progress-reporter.d.ts.map +1 -0
  28. package/dist/services/progress-reporter.js +192 -0
  29. package/dist/services/progress-reporter.js.map +1 -0
  30. package/dist/services/request-tracker.d.ts +55 -0
  31. package/dist/services/request-tracker.d.ts.map +1 -0
  32. package/dist/services/request-tracker.js +184 -0
  33. package/dist/services/request-tracker.js.map +1 -0
  34. package/dist/tools/notion-tools.d.ts +21 -0
  35. package/dist/tools/notion-tools.d.ts.map +1 -0
  36. package/dist/tools/notion-tools.js +1146 -0
  37. package/dist/tools/notion-tools.js.map +1 -0
  38. package/dist/types.d.ts +25 -0
  39. package/dist/types.d.ts.map +1 -0
  40. package/dist/types.js +2 -0
  41. package/dist/types.js.map +1 -0
  42. package/package.json +57 -0
package/README.md ADDED
@@ -0,0 +1,120 @@
1
+ # notion-mcp
2
+
3
+ MCP server with full notion capabilities (20 endpoints)
4
+
5
+ This MCP server includes the following integrations:
6
+
7
+ ## Available Tools
8
+
9
+ This MCP server provides 20 tools across 1 integrations:
10
+
11
+ ### Notion Tools
12
+ - **notion_list_databases**: ⚠️ DEPRECATED: This endpoint is deprecated by Notion API. Use the search endpoint with database filter instead.
13
+ - **notion_get_database**: Get database by ID
14
+ - **notion_query_database**: Query database pages
15
+ - **notion_create_database**: Create a new database
16
+ - **notion_update_database**: Update database properties
17
+ - **notion_get_page**: Get page by ID
18
+ - **notion_create_page**: Create a new page. Note: Creating pages directly in workspace root requires special permissions - use database or page parents instead.
19
+ - **notion_update_page**: Update page properties
20
+ - **notion_get_page_property**: Get page property by ID
21
+ - **notion_get_block_children**: Get block children
22
+ - **notion_append_block_children**: Append blocks to a parent block
23
+ - **notion_get_block**: Get block by ID
24
+ - **notion_update_block**: Update block content
25
+ - **notion_delete_block**: Delete a block
26
+ - **notion_list_users**: List all users
27
+ - **notion_get_user**: Get user by ID
28
+ - **notion_get_me**: Get current bot user
29
+ - **notion_search**: Search pages and databases
30
+ - **notion_create_comment**: Create a comment on a page or block
31
+ - **notion_get_comments**: Get comments for a page or block
32
+
33
+ ## Installation
34
+
35
+ ```bash
36
+ npm install notion-mcp-496207f7-b2cc-4edc-aa28-a31b7fb738c2
37
+ ```
38
+
39
+ ## Environment Setup
40
+
41
+ Create a `.env` file with the following variables:
42
+
43
+ ```env
44
+ NOTION_ACCESS_TOKEN=your_notion_access_token_here
45
+ ```
46
+
47
+ ## Usage
48
+
49
+ ### Running the server
50
+
51
+ ```bash
52
+ # Development mode
53
+ npm run dev
54
+
55
+ # Production mode
56
+ npm run build && npm start
57
+ ```
58
+
59
+ ### Using with Claude Desktop
60
+
61
+ Add this to your Claude Desktop configuration:
62
+
63
+ ```json
64
+ {
65
+ "mcpServers": {
66
+ "notion-mcp": {
67
+ "command": "npx",
68
+ "args": ["notion-mcp-496207f7-b2cc-4edc-aa28-a31b7fb738c2"],
69
+ "env": {
70
+ "NOTION_ACCESS_TOKEN": "your_notion_access_token_here"
71
+ }
72
+ }
73
+ }
74
+ }
75
+ ```
76
+
77
+ ## Instructions for Fetching API Keys/Tokens
78
+ - **COMING SOON**
79
+
80
+ ## Advanced Features
81
+
82
+ ### Request Cancellation
83
+
84
+ This MCP server supports request cancellation according to the [MCP cancellation specification](https://modelcontextprotocol.io/specification/2025-06-18/basic/utilities/cancellation). Clients can cancel in-progress requests by sending a `notifications/cancelled` message with the request ID.
85
+
86
+ When a request is cancelled:
87
+ - The server immediately stops processing the request
88
+ - Any ongoing API calls are aborted
89
+ - Resources are cleaned up
90
+ - No response is sent for the cancelled request
91
+
92
+ ### Progress Notifications
93
+
94
+ The server supports progress notifications for long-running operations according to the [MCP progress specification](https://modelcontextprotocol.io/specification/2025-06-18/basic/utilities/progress).
95
+
96
+ To receive progress updates:
97
+ 1. Include a `progressToken` in your request metadata
98
+ 2. The server will send `notifications/progress` messages with:
99
+ - Current progress value
100
+ - Total value (when known)
101
+ - Human-readable status messages
102
+
103
+ Progress is reported for:
104
+ - Multi-step operations
105
+ - Batch processing
106
+ - Long-running API calls
107
+ - File uploads/downloads
108
+
109
+ Example progress notification:
110
+ ```json
111
+ {
112
+ "method": "notifications/progress",
113
+ "params": {
114
+ "progressToken": "operation-123",
115
+ "progress": 45,
116
+ "total": 100,
117
+ "message": "Processing item 45 of 100..."
118
+ }
119
+ }
120
+ ```
@@ -0,0 +1,53 @@
1
+ import { Logger } from '../services/logger.js';
2
+ import { RequestOptions } from '../types.js';
3
+ export interface NotionClientConfig {
4
+ nOTIONACCESSTOKEN?: string;
5
+ timeout?: number;
6
+ rateLimit?: number;
7
+ authToken?: string;
8
+ logger?: Logger;
9
+ }
10
+ export declare class NotionClient {
11
+ private httpClient;
12
+ private config;
13
+ private sessionId;
14
+ private logger;
15
+ constructor(config: NotionClientConfig);
16
+ private setupRateLimit;
17
+ private resolveBaseUrl;
18
+ private getAuthHeaders;
19
+ /**
20
+ * Initialize the client (for OAuth clients that need initialization)
21
+ */
22
+ initialize(): Promise<void>;
23
+ /**
24
+ * Get the session ID for this client instance
25
+ */
26
+ getSessionId(): string;
27
+ /**
28
+ * Make an authenticated request with proper headers and cancellation support
29
+ */
30
+ private makeAuthenticatedRequest;
31
+ private buildPath;
32
+ listDatabases(params: any, options?: RequestOptions): Promise<any>;
33
+ getDatabase(params: any, options?: RequestOptions): Promise<any>;
34
+ queryDatabase(params: any, options?: RequestOptions): Promise<any>;
35
+ createDatabase(params: any, options?: RequestOptions): Promise<any>;
36
+ updateDatabase(params: any, options?: RequestOptions): Promise<any>;
37
+ getPage(params: any, options?: RequestOptions): Promise<any>;
38
+ createPage(params: any, options?: RequestOptions): Promise<any>;
39
+ updatePage(params: any, options?: RequestOptions): Promise<any>;
40
+ getPageProperty(params: any, options?: RequestOptions): Promise<any>;
41
+ getBlockChildren(params: any, options?: RequestOptions): Promise<any>;
42
+ appendBlockChildren(params: any, options?: RequestOptions): Promise<any>;
43
+ getBlock(params: any, options?: RequestOptions): Promise<any>;
44
+ updateBlock(params: any, options?: RequestOptions): Promise<any>;
45
+ deleteBlock(params: any, options?: RequestOptions): Promise<any>;
46
+ listUsers(params: any, options?: RequestOptions): Promise<any>;
47
+ getUser(params: any, options?: RequestOptions): Promise<any>;
48
+ getMe(params: any, options?: RequestOptions): Promise<any>;
49
+ search(params: any, options?: RequestOptions): Promise<any>;
50
+ createComment(params: any, options?: RequestOptions): Promise<any>;
51
+ getComments(params: any, options?: RequestOptions): Promise<any>;
52
+ }
53
+ //# sourceMappingURL=notion-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notion-client.d.ts","sourceRoot":"","sources":["../../src/clients/notion-client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC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