by suekou
MCP Server for the Notion API, enabling LLM to interact with Notion workspaces and optimizing token usage through Markdown conversion.
mcp-notion-server is an MCP (Multi-Cloud Platform) Server designed to facilitate interaction between Large Language Models (LLMs) and the Notion API. It allows LLMs to manage and access Notion workspaces. A key feature is its ability to convert Notion content to Markdown, significantly reducing the context size for LLMs and optimizing token usage for more efficient interactions.
To use mcp-notion-server, you need to set up a Notion Integration, retrieve a secret key, and add the integration to your Notion workspace. Then, configure Claude Desktop (or a similar LLM environment) by adding the mcp-notion-server to its mcpServers
configuration, providing your Notion API token as an environment variable. You can also enable experimental Markdown conversion by setting NOTION_MARKDOWN_CONVERSION
to "true".
Q: What is the purpose of Markdown conversion? A: Markdown conversion reduces the context size when communicating with LLMs, optimizing token usage and making interactions more efficient. It is particularly useful for viewing content.
Q: Can I edit Notion page content after Markdown conversion? A: While Markdown conversion is great for viewing, it may cause issues when trying to edit page content as the original structure can be lost in conversion. For editing, it's recommended to use the JSON format.
Q: What should I do if I encounter permission errors?
A: Ensure your Notion integration has the required permissions, verify that the integration is invited to the relevant pages or databases, and confirm that the token and configuration are correctly set in your claude_desktop_config.json
.
Q: How can I control which tools are enabled?
A: You can specify a comma-separated list of tools to enable using the --enabledTools
command-line argument. If not specified, all tools are enabled.
Q: What is the license for mcp-notion-server? A: The mcp-notion-server is licensed under the MIT License, allowing for free use, modification, and distribution.
MCP Server for the Notion API, enabling LLM to interact with Notion workspaces. Additionally, it employs Markdown conversion to reduce context size when communicating with LLMs, optimizing token usage and making interactions more efficient.
Here is a detailed explanation of the steps mentioned above in the following articles:
Create a Notion Integration:
Retrieve the Secret Key:
Add the Integration to Your Workspace:
Configure Claude Desktop:
Add the following to your claude_desktop_config.json
:
{
"mcpServers": {
"notion": {
"command": "npx",
"args": ["-y", "@suekou/mcp-notion-server"],
"env": {
"NOTION_API_TOKEN": "your-integration-token"
}
}
}
}
or
{
"mcpServers": {
"notion": {
"command": "node",
"args": ["your-built-file-path"],
"env": {
"NOTION_API_TOKEN": "your-integration-token"
}
}
}
}
NOTION_API_TOKEN
(required): Your Notion API integration token.NOTION_MARKDOWN_CONVERSION
: Set to "true" to enable experimental Markdown conversion. This can significantly reduce token consumption when viewing content, but may cause issues when trying to edit page content.--enabledTools
: Comma-separated list of tools to enable (e.g. "notion_retrieve_page,notion_query_database"). When specified, only the listed tools will be available. If not specified, all tools are enabled.Read-only tools example (copy-paste friendly):
node build/index.js --enabledTools=notion_retrieve_block,notion_retrieve_block_children,notion_retrieve_page,notion_query_database,notion_retrieve_database,notion_search,notion_list_all_users,notion_retrieve_user,notion_retrieve_bot_user,notion_retrieve_comments
By default, all responses are returned in JSON format. You can enable experimental Markdown conversion to reduce token consumption:
{
"mcpServers": {
"notion": {
"command": "npx",
"args": ["-y", "@suekou/mcp-notion-server"],
"env": {
"NOTION_API_TOKEN": "your-integration-token",
"NOTION_MARKDOWN_CONVERSION": "true"
}
}
}
}
or
{
"mcpServers": {
"notion": {
"command": "node",
"args": ["your-built-file-path"],
"env": {
"NOTION_API_TOKEN": "your-integration-token",
"NOTION_MARKDOWN_CONVERSION": "true"
}
}
}
}
When NOTION_MARKDOWN_CONVERSION
is set to "true"
, responses will be converted to Markdown format (when format
parameter is set to "markdown"
), making them more human-readable and significantly reducing token consumption. However, since this feature is experimental, it may cause issues when trying to edit page content as the original structure is lost in conversion.
You can control the format on a per-request basis by setting the format
parameter to either "json"
or "markdown"
in your tool calls:
"markdown"
for better readability when only viewing content"json"
when you need to modify the returned contentIf you encounter permission errors:
claude_desktop_config.json
.The project is organized in a modular way to improve maintainability and readability:
./
├── src/
│ ├── index.ts # Entry point and command-line handling
│ ├── client/
│ │ └── index.ts # NotionClientWrapper class for API interactions
│ ├── server/
│ │ └── index.ts # MCP server setup and request handling
│ ├── types/
│ │ ├── index.ts # Type exports
│ │ ├── args.ts # Tool argument interfaces
│ │ ├── common.ts # Common schema definitions
│ │ ├── responses.ts # API response type definitions
│ │ └── schemas.ts # Tool schema definitions
│ ├── utils/
│ │ └── index.ts # Utility functions
│ └── markdown/
│ └── index.ts # Markdown conversion utilities
All tools support the following optional parameter:
format
(string, "json" or "markdown", default: "markdown"): Controls the response format. Use "markdown" for human-readable output, "json" for programmatic access to the original data structure. Note: Markdown conversion only works when the NOTION_MARKDOWN_CONVERSION
environment variable is set to "true".notion_append_block_children
block_id
(string): The ID of the parent block.children
(array): Array of block objects to append.notion_retrieve_block
block_id
(string): The ID of the block to retrieve.notion_retrieve_block_children
block_id
(string): The ID of the parent block.start_cursor
(string): Cursor for the next page of results.page_size
(number, default: 100, max: 100): Number of blocks to retrieve.notion_delete_block
block_id
(string): The ID of the block to delete.notion_retrieve_page
page_id
(string): The ID of the page to retrieve.notion_update_page_properties
page_id
(string): The ID of the page to update.properties
(object): Properties to update.notion_create_database
parent
(object): Parent object of the database.properties
(object): Property schema of the database.title
(array): Title of the database as a rich text array.notion_query_database
database_id
(string): The ID of the database to query.filter
(object): Filter conditions.sorts
(array): Sorting conditions.start_cursor
(string): Cursor for the next page of results.page_size
(number, default: 100, max: 100): Number of results to retrieve.notion_retrieve_database
database_id
(string): The ID of the database to retrieve.notion_update_database
database_id
(string): The ID of the database to update.title
(array): New title for the database.description
(array): New description for the database.properties
(object): Updated property schema.notion_create_database_item
database_id
(string): The ID of the database to add the item to.properties
(object): The properties of the new item. These should match the database schema.notion_search
query
(string): Text to search for in page or database titles.filter
(object): Criteria to limit results to either only pages or only databases.sort
(object): Criteria to sort the resultsstart_cursor
(string): Pagination start cursor.page_size
(number, default: 100, max: 100): Number of results to retrieve.notion_list_all_users
notion_retrieve_user
notion_retrieve_bot_user
notion_create_comment
parent
object with a page_id
or a discussion_id
, but not both.rich_text
(array): Array of rich text objects representing the comment content.parent
(object): Must include page_id
if used.discussion_id
(string): An existing discussion thread ID.notion_retrieve_comments
block_id
(string): The ID of the block or page whose comments you want to retrieve.start_cursor
(string): Pagination start cursor.page_size
(number, max: 100): Number of comments to retrieve.This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.
Reviews feature coming soon
Stay tuned for community discussions and feedback