Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 45 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,36 @@ Inspired by [linear-cli](https://github.com/schpet/linear-cli) - stay in the ter

**Works great with AI agents** — includes a [skill](#skills) that lets agents search, create, and manage your Notion workspace alongside your code.

> **This is a fork** of [lox/notion-cli](https://github.com/lox/notion-cli) that adds a
> generic [`tools call`](#calling-any-mcp-tool) command for invoking any Notion MCP
> tool by name (e.g. `notion-query-data-sources`), plus `--json` input schemas in
> `tools list`. Everything else is upstream.

## Installation

### From Source
### As a dependency (install the pinned binary)

Install the CLI straight from this repository — this is the recommended way to
depend on it from another project's tooling, scripts, or CI:

```bash
go install github.com/lox/notion-cli@latest
# latest from the default branch
go install github.com/miguelpalomera/notion-cli@latest

# or pin an exact tag / commit for reproducible builds (recommended for CI)
go install github.com/miguelpalomera/notion-cli@v0.1.0
go install github.com/miguelpalomera/notion-cli@<commit-sha>
```

This drops a `notion-cli` binary in `$(go env GOPATH)/bin` (put that on your `PATH`).
Requires Go 1.22+. In CI, run the same `go install …@<tag>` step before invoking `notion-cli`.

### Build Locally

```bash
git clone https://github.com/lox/notion-cli
git clone https://github.com/miguelpalomera/notion-cli
cd notion-cli
mise run build
mise run build # or: go build -o notion-cli .
```

## Quick Start
Expand Down Expand Up @@ -161,13 +177,37 @@ The comment commands accept a page URL, ID, or name. `comment list` includes bot

```bash
notion-cli tools # List available MCP tools
notion-cli tools --json # Output tools as JSON
notion-cli tools --json # Output tools as JSON (includes each tool's inputSchema)
notion-cli version # Show version
notion-cli --version # Alias for version
notion-cli -v # Short alias for version
notion-cli --help # Show help
```

### Calling any MCP tool

`tools call` is a generic escape hatch: it invokes **any** Notion MCP tool by name with
a JSON argument object, so you can reach capabilities that have no dedicated subcommand
(for example querying a data source's rows). Discover tool names and their argument
schemas with `notion-cli tools --json`.

```bash
# arguments inline as a JSON object
notion-cli tools call notion-fetch --args '{"id":"<page-or-db-id>"}'

# arguments from a file, or from stdin with "-"
notion-cli tools call notion-query-data-sources --args-file ./query.json
echo '{"data":{"mode":"sql","data_source_urls":["collection://<id>"],"query":"SELECT * FROM \"collection://<id>\" LIMIT 5"}}' \
| notion-cli tools call notion-query-data-sources -f -

# --raw prints the full tool result (all content blocks + isError) as JSON;
# the default prints just the text content
notion-cli tools call notion-fetch --args '{"id":"<id>"}' --raw
```

By default the command prints the tool's text content and exits non-zero if the tool
reports an error. Use `--raw`/`-r` when you need the structured result.

## Configuration

The CLI uses Notion's remote MCP server with OAuth authentication. On first run, `notion-cli auth login` will open your browser to authorize the CLI with your Notion workspace.
Expand Down
8 changes: 4 additions & 4 deletions cmd/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import (
"time"

"github.com/fatih/color"
"github.com/lox/notion-cli/internal/cli"
"github.com/lox/notion-cli/internal/config"
"github.com/lox/notion-cli/internal/mcp"
"github.com/lox/notion-cli/internal/output"
"github.com/miguelpalomera/notion-cli/internal/cli"
"github.com/miguelpalomera/notion-cli/internal/config"
"github.com/miguelpalomera/notion-cli/internal/mcp"
"github.com/miguelpalomera/notion-cli/internal/output"
"golang.org/x/term"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/auth_api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"strings"
"testing"

"github.com/lox/notion-cli/internal/config"
"github.com/miguelpalomera/notion-cli/internal/config"
)

func captureStdout(t *testing.T, fn func()) string {
Expand Down
4 changes: 2 additions & 2 deletions cmd/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"testing"
"time"

"github.com/lox/notion-cli/internal/config"
"github.com/lox/notion-cli/internal/mcp"
"github.com/mark3labs/mcp-go/client/transport"
"github.com/miguelpalomera/notion-cli/internal/config"
"github.com/miguelpalomera/notion-cli/internal/mcp"
)

func isolateAuthConfig(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions cmd/comment.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"context"
"strings"

"github.com/lox/notion-cli/internal/cli"
"github.com/lox/notion-cli/internal/mcp"
"github.com/lox/notion-cli/internal/output"
"github.com/miguelpalomera/notion-cli/internal/cli"
"github.com/miguelpalomera/notion-cli/internal/mcp"
"github.com/miguelpalomera/notion-cli/internal/output"
"golang.org/x/net/html"
)

Expand Down
4 changes: 2 additions & 2 deletions cmd/comment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"reflect"
"testing"

"github.com/lox/notion-cli/internal/mcp"
"github.com/lox/notion-cli/internal/output"
"github.com/miguelpalomera/notion-cli/internal/mcp"
"github.com/miguelpalomera/notion-cli/internal/output"
)

func TestBuildCommentListRequest(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions cmd/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"os"
"strings"

"github.com/lox/notion-cli/internal/cli"
"github.com/lox/notion-cli/internal/mcp"
"github.com/lox/notion-cli/internal/output"
"github.com/miguelpalomera/notion-cli/internal/cli"
"github.com/miguelpalomera/notion-cli/internal/mcp"
"github.com/miguelpalomera/notion-cli/internal/output"
)

type DBCmd struct {
Expand Down
8 changes: 4 additions & 4 deletions cmd/page.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import (
"path/filepath"
"strings"

"github.com/lox/notion-cli/internal/api"
"github.com/lox/notion-cli/internal/cli"
"github.com/lox/notion-cli/internal/mcp"
"github.com/lox/notion-cli/internal/output"
"github.com/miguelpalomera/notion-cli/internal/api"
"github.com/miguelpalomera/notion-cli/internal/cli"
"github.com/miguelpalomera/notion-cli/internal/mcp"
"github.com/miguelpalomera/notion-cli/internal/output"
)

type PageCmd struct {
Expand Down
4 changes: 2 additions & 2 deletions cmd/page_edit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"strings"
"testing"

"github.com/lox/notion-cli/internal/cli"
"github.com/lox/notion-cli/internal/mcp"
"github.com/miguelpalomera/notion-cli/internal/cli"
"github.com/miguelpalomera/notion-cli/internal/mcp"
)

func TestBuildPageEditRequestReplace(t *testing.T) {
Expand Down
8 changes: 4 additions & 4 deletions cmd/page_local_images.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import (

"golang.org/x/sync/errgroup"

"github.com/lox/notion-cli/internal/api"
"github.com/lox/notion-cli/internal/cli"
"github.com/lox/notion-cli/internal/mcp"
"github.com/lox/notion-cli/internal/output"
"github.com/miguelpalomera/notion-cli/internal/api"
"github.com/miguelpalomera/notion-cli/internal/cli"
"github.com/miguelpalomera/notion-cli/internal/mcp"
"github.com/miguelpalomera/notion-cli/internal/output"
)

// localImageUploadConcurrency caps concurrent local image uploads. Each
Expand Down
4 changes: 2 additions & 2 deletions cmd/page_local_images_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"strings"
"testing"

"github.com/lox/notion-cli/internal/api"
"github.com/lox/notion-cli/internal/mcp"
"github.com/miguelpalomera/notion-cli/internal/api"
"github.com/miguelpalomera/notion-cli/internal/mcp"
)

type fakePageUpdater struct {
Expand Down
4 changes: 2 additions & 2 deletions cmd/page_view_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"errors"
"testing"

"github.com/lox/notion-cli/internal/mcp"
"github.com/lox/notion-cli/internal/output"
"github.com/miguelpalomera/notion-cli/internal/mcp"
"github.com/miguelpalomera/notion-cli/internal/output"
)

func TestShouldLoadPageViewComments(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package cmd

import "github.com/lox/notion-cli/internal/config"
import "github.com/miguelpalomera/notion-cli/internal/config"

type Context struct {
Profile string
Expand Down
6 changes: 3 additions & 3 deletions cmd/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package cmd
import (
"context"

"github.com/lox/notion-cli/internal/cli"
"github.com/lox/notion-cli/internal/mcp"
"github.com/lox/notion-cli/internal/output"
"github.com/miguelpalomera/notion-cli/internal/cli"
"github.com/miguelpalomera/notion-cli/internal/mcp"
"github.com/miguelpalomera/notion-cli/internal/output"
)

type SearchCmd struct {
Expand Down
Loading