DEV Community

suekou
suekou

Posted on

Operating Notion via Claude Desktop Using MCP!

Introduction

Recently, MCP was announced by Anthropic, and you might be wondering, "What exactly can it do?" In this article, we’ll explore one practical example of using MCP to operate Notion directly from Claude Desktop.

Background

I had previously submitted a pull request to implement a Notion server in the MCP server project, planning to write a detailed guide once it was merged. However, it seems MCP is moving toward a decentralized hosting model for scalability, instead of managing all servers centrally. As my PR may be closed, I decided to write this guide to ensure that others can still use it. (See the discussion here)

the pull request here:

https://github.com/modelcontextprotocol/servers/pull/129

Preparation

Setting Up the MCP Notion Server

I’ve created a repository to make it easier for you to get started. Clone it from the link below:

git clone https://github.com/suekou/mcp-notion-server.git
Enter fullscreen mode Exit fullscreen mode

Next, run the following commands:

cd notion
npm run build
npm link
Enter fullscreen mode Exit fullscreen mode

After execution, make sure the file notion/build/index.js is successfully created.

Preparing a Notion API Token

To allow the MCP server to access Notion, generate an API token. Go to the Integrations page and select New Integration.

Fill in the integration name, choose a workspace, and keep the Type as Internal (default).

Once the integration is created, go to its details page and copy the token by clicking Show → Copy:

Image description

Editing claude_desktop_config.json

Edit the claude_desktop_config.json file located at:

code ~/Library/Application\ Support/Claude/claude_desktop_config.json
Enter fullscreen mode Exit fullscreen mode

In this file, add the path to the notion/build/index.js file you built earlier (e.g., /Users/<YOUR_USERNAME>/Desktop/mcp-notion-server/notion/build/index.js) under args, and paste the API token under NOTION_API_TOKEN like this:

{
  "mcpServers": {
    "notion": {
      "command": "node",
      "args": [
        "Path to the built file"
      ],
      "env": {
        "NOTION_API_TOKEN": "Your token"
      }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

If you’re configuring other servers alongside this, your configuration might look like this:

{
  "mcpServers": {
    "sqlite": {
      "command": "uvx",
      "args": [
        "mcp-server-sqlite",
        "--db-path",
        "/Users/USER_NAME/test.db"
      ]
    },
    "notion": {
      "command": "node",
      "args": [
        "/Users/USER_NAME/Desktop/mcp-notion-server/notion/build/index.js"
      ],
      "env": {
        "NOTION_API_TOKEN": "API_TOKEN"
      }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Connecting the Integration

In the workspace you configured earlier, create a new page. Then click on the menu in the upper-right corner and select Connect to, followed by your integration.

Image description

Next, copy the page ID from the URL. For example, if the URL is:

https://www.notion.so/mcp-test-notion1234server567apiintegration890
Enter fullscreen mode Exit fullscreen mode

The last 32-character alphanumeric string (notion1234server567apiintegration890) is your page ID.

Let’s Try It Out!

Save an Article

Restart Claude Desktop if it’s already open. After restarting, click the hammer icon, and check if "notion" appears under From Server. If it does, you’re ready to go.

Image description

Now Let's ask Claude to write an article.

Image description

Once done, send the message:

"I want to save this content to Notion with <Your Page ID>."

Claude will prompt you for tool usage permissions—approve it.

Image description

After execution, you should see the article saved to your Notion page:

Image description

Using Databases

Create a database in Notion. Here’s an example where I asked Claude to create a movie database:

Image description

Image description

Add some sample entries:

Image description

Now, ask Claude:

"Tell me movies rated ⭐️⭐️⭐️⭐️⭐️."

It will retrieve and list only the 5-star movies:

Image description

Conclusion

This article introduced just a few features of MCP Notion Server, but there’s so much more you can do with it. Experiment with it and explore its potential!

If you've customized the server or discovered new use cases, I'd love to hear about your findings!
Thank you for reading! 👋

Top comments (0)