🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@sakasegawa/notion-cli

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

@sakasegawa/notion-cli

CLI wrapper for Remote Notion MCP

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

@sakasegawa/notion-cli

CLI wrapper for Remote Notion MCP — read and write Notion from the terminal.

Designed for both humans and coding agents (Claude Code, Codex, etc.). All output is structured JSON with recovery hints on errors.

Features

  • Full Notion workspace access: search, pages, databases, views, comments, users, teams, meeting notes
  • OAuth 2.0 + PKCE authentication (browser-based, zero-config)
  • Agent-first design: --json output, structured error hints (What + Why + Hint)
  • Escape hatch: notion api <tool> [json] for direct MCP tool access
  • Single bundled ESM binary, Node.js >= 18

Install

npm install -g @sakasegawa/notion-cli

Quick Start

# Authenticate (opens browser, one-time)
notion login

# Search and fetch
notion search "project plan"
notion fetch <id>

# Create and update pages
notion page create --title "New Page" --parent <page-id>
notion page update <id> --prop "Status=Done"

# Database workflow
notion db create --title "Tasks" --parent <page-id> \
  --prop "Name:title" --prop "Status:select=Open,Done"
notion page create --parent collection://<ds-id> \
  --title "Task 1" --prop "Status=Open"

Commands

CommandDescription
notion loginLog in to Notion via OAuth
notion logoutLog out from Notion
notion whoamiShow current Notion user info
notion search <query>Search pages, databases, and users across workspace
notion fetch <url-or-id>Retrieve a page, database, or data source by URL or ID
notion page createCreate a page (with --title, --parent, --prop, --body)
notion page update <id>Update page properties or content
notion page move <id...> --to <parent>Move pages to a new parent
notion page duplicate <id>Duplicate a page
notion db createCreate a database (with --title, --parent, --prop, or --schema)
notion db update <id>Update database schema or metadata
notion db query <view-url>Query a database view
notion view createCreate a database view (via --data)
notion view updateUpdate a database view (via --data)
notion comment create <id>Add a comment to a page
notion comment list <id>List comments on a page
notion user listList and search workspace users
notion team listList and search workspace teams
notion meeting-notes queryQuery meeting notes with filters
notion api <tool> [json]Call any MCP tool directly (escape hatch)

Run notion <command> --help for detailed usage, examples, and tips.

Common Workflows

Search, fetch, and update

notion search "Project Plan"               # Find pages/databases
notion fetch <id>                           # Get content and metadata
notion page update <id> --prop "Status=Done"  # Update properties

Create a database and add entries

# Create a database under a page
notion db create --title "Tasks" --parent <page-id> \
  --prop "Name:title" --prop "Status:select=Open,Done"

# Response includes data_source_id (collection://...)
# Create entries using that ID
notion page create --parent collection://<ds-id> \
  --title "Task 1" --prop "Status=Open"

# Create a view and query
notion view create --data '{"database_id":"<db-id>","data_source_id":"collection://<ds-id>","type":"table","name":"All"}'
notion db query "https://www.notion.so/<db-id>?v=<view-id>"

Pipe content from stdin

echo "# Meeting Notes" | notion page create --title "Notes" --parent <id> --body -

Global Flags

FlagDescription
--jsonOutput as JSON (structured, parseable)
--rawOutput raw MCP response (full server payload)
--verboseVerbose output
--no-colorDisable colors

Agent Usage

This CLI is optimized for coding agents. Key patterns:

  • Use --json for structured, parseable output
  • Errors include recovery hints: What happened, Why, and what to do next
  • Workflow: searchfetch (get IDs/schema) → create/update/query
  • For databases: always notion fetch <db-id> first to get data_source_id

Error example:

Error: notion-create-pages failed
  Why: Could not find page with ID: abc123...
  Hint: If adding to a database, use --data with "parent":{"data_source_id":"<ds-id>",...}.
        Run "notion fetch <db-id>" to get the data_source_id

Escape Hatch

For advanced use or unsupported operations, call any MCP tool directly:

notion api notion-search '{"query":"test","page_size":3}'
echo '{"query":"test"}' | notion api notion-search

Requirements

  • Node.js >= 18
  • A Notion account (OAuth authentication via browser)

License

MIT

Keywords

notion

FAQs

Package last updated on 18 Mar 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts