# Notion MCP - AI Workspace Management for Agents (`red.cars/notion-mcp`) Actor

47 tools for AI agents that manage Notion workspaces. Wraps the Notion PP CLI as an MCP server with PPE billing.

- **URL**: https://apify.com/red.cars/notion-mcp.md
- **Developed by:** [AutomateLab](https://apify.com/red.cars) (community)
- **Categories:** MCP servers, AI
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event + usage

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Notion MCP Actor

**47 tools for AI agents that manage Notion workspaces.** Wraps the `notion-pp-mcp` binary as an Apify Standby MCP actor with PPE billing.

### What It Does

Notion MCP wraps the [Notion Printing Press CLI](https://github.com/mvanhorn/printing-press-library) as an MCP server, giving AI agents full access to:

- **Pages** - Create, read, update, move, archive pages; retrieve page properties
- **Databases** - Query and create databases, tables, and datasets
- **Blocks** - Manage block children, update, delete, append content
- **Comments** - Create, list, update, delete comments on pages and blocks
- **Users** - Get user info, workspace users, self info
- **Views** - Create and manage views, run view queries
- **Search** - Search pages and databases by title
- **OAuth** - Manage OAuth tokens for third-party integrations
- **File Uploads** - Upload and manage files in Notion
- **Workflows** - Archive pages and update workflow status
- **Analytics** - Analyze locally synced data with group-by and summary
- **SQL** - Query synced Notion data with SQL

### Why Use It

- **AI Agent Integration** - Standard MCP protocol, works with any MCP client (Claude, Cursor, etc.)
- **Offline SQLite Store** - Syncs Notion data locally for fast querying without API rate limits
- **PPE Billing** - Per-tool pricing via Apify PPE; read ops $0.03, write ops $0.08
- **47 Tools** - Full Notion API coverage via well-designed CLI interface

### Quick Start

#### 1. Get an Apify Actor

```bash
## Clone the actor
apify clone notion-mcp
cd notion-mcp

## Or create a new one
apify create --template=ts-standby notion-mcp
````

#### 2. Set Environment Variable

Set `NOTION_API_TOKEN` in your Apify actor settings or `.env`:

```
NOTION_API_TOKEN=secret_your_notion_integration_token
```

#### 3. Configure MCP Client

Add to your MCP client config (Claude Code, Cursor, etc.):

```json
{
  "mcpServers": {
    "notion": {
      "command": "curl",
      "args": ["-N", "https://api.apify.com/v2/acts/wdwdwdwdwd~notion-mcp/runs?token=$APIFY_TOKEN"],
      "env": {
        "APIFY_TOKEN": "your_apify_api_token"
      }
    }
  }
}
```

Or use the Apify MCP gateway:

```json
{
  "mcpServers": {
    "notion": {
      "command": "npx",
      "args": ["-y", "@apify/mcp-gateway", "notion-mcp", "--token", "$APIFY_TOKEN"]
    }
  }
}
```

### MCP Tools Reference

| Category | Tool | Description | PPE Price |
|----------|------|-------------|-----------|
| **Pages** | `pages_retrieve_a` | Retrieve a page by ID | $0.03 |
| | `pages_patch` | Update page properties | $0.08 |
| | `pages_post` | Create a new page | $0.08 |
| | `pages_move_page` | Move a page to another parent | $0.08 |
| | `pages_markdown_retrieve_page` | Get page as markdown | $0.03 |
| | `pages_markdown_update_page` | Update page with markdown | $0.08 |
| | `pages_properties_retrieve_a_page_property` | Get page property value | $0.03 |
| **Databases** | `databases_retrieve` | Get database metadata | $0.03 |
| | `databases_query` | Query a database with filters | $0.03 |
| | `databases_create` | Create a new database | $0.08 |
| | `databases_update` | Update database schema | $0.08 |
| **Blocks** | `blocks_retrieve_a` | Get a block by ID | $0.03 |
| | `blocks_children_get_block` | Get block children | $0.03 |
| | `blocks_update_a` | Update a block | $0.08 |
| | `blocks_children_patch_block` | Append block children | $0.08 |
| | `blocks_delete_a` | Delete a block | $0.08 |
| **Comments** | `comments_list` | List comments | $0.03 |
| | `comments_retrieve` | Get a comment | $0.03 |
| | `comments_create_a` | Create a comment | $0.08 |
| | `comments_update_a` | Update a comment | $0.08 |
| | `comments_delete_a` | Delete a comment | $0.08 |
| **Users** | `users_get` | Get user by ID | $0.03 |
| | `users_get_self` | Get current user | $0.03 |
| | `users_get_userid` | Get user by ID (alternate) | $0.03 |
| **Search** | `search` | Search pages and databases | $0.03 |
| | `notion_search_post` | Advanced search with filters | $0.03 |
| **Views** | `views_list` | List views in a database | $0.03 |
| | `views_retrieve_a` | Get view by ID | $0.03 |
| | `views_queries_get_view_query_results` | Execute a view query | $0.03 |
| | `views_create` | Create a new view | $0.08 |
| | `views_update_a` | Update a view | $0.08 |
| | `views_queries_create_view_query` | Create a view query | $0.08 |
| | `views_queries_delete_view_query` | Delete a view query | $0.08 |
| **Sync** | `sync` | Sync data from Notion to local SQLite | $0.03 |
| | `sync_pages` | Sync pages to local store | $0.03 |
| | `changed` | Get recently changed items | $0.03 |
| | `stale` | Get stale synced items | $0.03 |
| **Analytics** | `analytics` | Analyze synced data | $0.03 |
| **SQL** | `sql` | Query synced data with SQL | $0.03 |
| **Data Sources** | `data_sources_query_post_database` | Query a data source | $0.03 |
| | `data_sources_retrieve_a` | Get data source info | $0.03 |
| | `data_sources_create_a_database` | Create a data source database | $0.08 |
| | `data_sources_update_a` | Update a data source | $0.08 |
| **File Uploads** | `file_uploads_list` | List file uploads | $0.03 |
| | `file_uploads_retrieve` | Get file upload info | $0.03 |
| | `file_uploads_create_file` | Create a file upload | $0.08 |
| | `file_uploads_send_upload_file` | Send file data | $0.08 |
| | `file_uploads_complete_file_upload` | Complete a file upload | $0.08 |
| **OAuth** | `oauth_create_a_token` | Create OAuth token | $0.08 |
| | `oauth_introspect_token` | Introspect OAuth token | $0.08 |
| | `oauth_revoke_token` | Revoke OAuth token | $0.08 |
| **Workflows** | `workflow_archive` | Archive a workflow | $0.08 |
| | `workflow_status` | Get workflow status | $0.08 |
| **Other** | `import` | Import data into Notion | $0.08 |
| | `custom_emojis_list` | List custom emojis | $0.03 |
| | `blocks_query_meeting_notes` | Query meeting notes blocks | $0.03 |

### Direct API Invocation

You can also call tools directly via HTTP without MCP:

```bash
curl -X POST https://api.apify.com/v2/acts/wdwdwdwdwd~notion-mcp/runs \
  -H "Content-Type: application/json" \
  -d '{
    "token": "your_apify_token",
    "input": {
      "tool": "pages_retrieve_a",
      "args": { "page_id": "your_page_id" }
    }
  }'
```

### Comparison: Notion MCP vs Native Notion API

| Aspect | Notion MCP | Native Notion API |
|--------|-----------|-------------------|
| **Protocol** | MCP (Model Context Protocol) | REST API |
| **Tool count** | 47 tools | 100+ endpoints |
| **Offline storage** | SQLite (via sync) | None |
| **AI agent support** | Native MCP integration | Manual HTTP code |
| **SQL queries** | Yes (via `sql` tool) | No |
| **PPE pricing** | $0.03-$0.08 per call | API usage limits |
| **Rate limits** | Cached via local sync | 3/sec, 60/sec burst |

### Local Development

```bash
## Install dependencies
npm install

## Build TypeScript
npm run build

## Run locally (requires Apify SDK)
node dist/main.js

## Test with MCP protocol
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}' | notion-pp-mcp
```

### GitHub Topics

`notion` `mcp` `mcp-server` `notion-api` `ai-agents`

### Support

- **Issues**: https://github.com/red-cars-io/notion-mcp/issues
- **Apify**: https://apify.com/notion-mcp
- **Notion PP CLI**: https://github.com/mvanhorn/printing-press-library

# Actor input Schema

## `tool` (type: `string`):

Notion tool to call (e.g. pages\_retrieve\_a, databases\_query, search)

## `args` (type: `object`):

Tool arguments as key-value pairs

## Actor input object example

```json
{
  "tool": "pages_retrieve_a",
  "args": {
    "page_id": "abc123"
  }
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("red.cars/notion-mcp").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("red.cars/notion-mcp").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call red.cars/notion-mcp --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=red.cars/notion-mcp",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Notion MCP - AI Workspace Management for Agents",
        "description": "47 tools for AI agents that manage Notion workspaces. Wraps the Notion PP CLI as an MCP server with PPE billing.",
        "version": "1.0",
        "x-build-id": "NbqSn1pTydDlkEu7e"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/red.cars~notion-mcp/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-red.cars-notion-mcp",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/red.cars~notion-mcp/runs": {
            "post": {
                "operationId": "runs-sync-red.cars-notion-mcp",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/red.cars~notion-mcp/run-sync": {
            "post": {
                "operationId": "run-sync-red.cars-notion-mcp",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "tool"
                ],
                "properties": {
                    "tool": {
                        "title": "Notion Tool",
                        "type": "string",
                        "description": "Notion tool to call (e.g. pages_retrieve_a, databases_query, search)",
                        "default": "pages_retrieve_a"
                    },
                    "args": {
                        "title": "Tool Arguments",
                        "type": "object",
                        "description": "Tool arguments as key-value pairs"
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
