Notion auth and project binding for Codex, Claude Code, and other MCP clients.
Project description
Agent Labbook
Agent Labbook is the Notion connection layer for Codex, Claude Code, and other MCP clients. It starts Notion auth, lets you choose which pages or data sources belong to a project, stores project bindings in .labbook/, stores long-lived tokens in a shared credential provider, and returns the API context your agent needs to call Notion directly.
Use it when you want to:
- connect a repo to specific Notion pages or data sources for an agent
- let an agent read or update project docs and data sources through the official Notion API
- avoid building your own Notion auth wrapper for coding agents
It is not a full Notion SDK. After setup, your agent should use the official Notion API directly.
Install
Use Agent Labbook as a local MCP server for the current project.
Requirements:
- Python 3.10 or newer
uv- a Codex, Claude Code, or other MCP-capable client that can run a local MCP server
Recommended setup:
codex mcp add labbook -- uvx agent-labbook mcp
claude mcp add --scope project labbook -- uvx agent-labbook mcp
- or use the checked-in
.mcp.jsonwhen the repository itself is the MCP source
Typical Flow
- Read
labbook://agent-labbook/project/statusor runnotion_status. - If
notion_statusreportssaved_credentials_errororcredential_provider_diagnostics_error, fix the localnotion-access-brokerhelper installation before starting OAuth. A fresh OAuth flow cannot persist shared credentials without it. - If status shows saved shared credentials for this integration, run
notion_list_saved_credentialsand thennotion_attach_saved_credentialfor the workspace you want to reuse. - Use
notion_status.connect_decisionto decide whether you need fresh OAuth scope or only project bindings within the current scope. Clients with chooser UIs can mapconnect_decision.questionsdirectly into those prompts; text-only clients can showconnect_decision.manual_prompt_markdown. - If you only need to bind content that the current integration can already access, run
notion_selection_browser. - Check
notion_status.preferred_browser_flow,notion_status.recommended_open_browser, andnotion_status.browser_environment_hintbefore you start a browser flow. - Otherwise run
notion_auth_browser, ornotion_start_headless_authif connecting through SSH or another headless environment. For browser auth, pass a longtimeout_secondssuch as1800so the background localhost listener stays alive while you finish Notion consent and resource selection. - Choose the Notion pages or data sources for this project.
- Run
notion_statusagain after the browser says the project is connected, after attaching the saved credential, or after reopening the selection UI. - If
notion_statusreportspending_handoff_ready=true, runnotion_finalize_pending_auth. - Read
labbook://agent-labbook/project/bindingsor runnotion_list_bindingsif you want a read-only snapshot of the explicit project roots. - Run
notion_get_api_context. - Use the returned token, headers, and resource IDs with the official Notion API.
MCP Design
- Read-only context is exposed as MCP resources:
labbook://agent-labbook/setup-guidelabbook://agent-labbook/project/statuslabbook://agent-labbook/project/bindings
- Reusable workflows are exposed as prompts:
notion_connect_projectnotion_use_bound_resources
- Mutating actions stay in tools. In particular,
notion_statusis now read-only andnotion_finalize_pending_authis the explicit step that persists a pending browser handoff. - Tools now declare
outputSchemaas well asinputSchema, so MCP clients can discover stable structured outputs and the low-level server can validate successful tool payloads before returning them. notion_statusalso reports credential provider diagnostics so you can tell whether1Passwordorkeyringis currently available and which one would be selected by default.notion_statusnow also reports browser-environment hints so SSH and other headless sessions can prefer headless auth oropen_browser=falsebefore a localhost callback flow is attempted.notion_status.connect_decisiongives clients a common decision payload for interactive UIs and plain-text follow-up questions, so Claude, Codex, and other MCP clients can route the user through the same connect choices.
Hosted Backend
The default app backend is https://superplanner.ai/notion/agent-labbook.
The default shared OAuth backend is https://superplanner.ai/notion/oauth.
The app backend renders the Labbook selection UI and project-specific routes. The shared OAuth backend handles Notion OAuth, token refresh, and signed handoff bundles without keeping your project tokens or Notion content in server-side storage. Long-lived tokens live in the shared local credential provider selected through the notion-access-broker Python helpers, and project bindings stay in .labbook/.
Credential Storage
Agent Labbook no longer writes access tokens or refresh tokens into .labbook/session.json.
- If the local
opCLI is installed and can access 1Password, the default provider automatically prefers1password - If
NOTION_ACCESS_BROKER_1PASSWORD_VAULTis set, 1Password is pinned to that vault; otherwise it uses the default vault - If 1Password is unavailable, the default falls back to
keyring - You can still force either provider with
NOTION_ACCESS_BROKER_CREDENTIAL_PROVIDER=keyring|1password notion-access-brokeris installed as a normal package dependency for released builds;NOTION_ACCESS_BROKER_SRC=/path/to/notion-access-broker[/src]is only needed when you want a local checkout to override the installed helper during development- A fresh project can reuse an existing integration credential through
notion_list_saved_credentialsandnotion_attach_saved_credential - A project with an attached or reusable credential can reopen the hosted selection UI through
notion_selection_browserwithout re-running OAuth consent .labbook/session.jsonstores only the selected credential reference and project metadata, not the token secrets themselves
If you want to self-host it, see docs/self-host.md.
For versioning and migration boundaries, see docs/versioning.md.
Notes
.labbook/should never be committed- this repo handles auth and project binding, not general Notion API wrapping
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agent_labbook-0.14.5.tar.gz.
File metadata
- Download URL: agent_labbook-0.14.5.tar.gz
- Upload date:
- Size: 43.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3852a4a80e16d8c6fea52c712cbb4523ede5347e6fbbfa13d2546a20000cb229
|
|
| MD5 |
0f1bf98cedb05aaef503e2f6ce09eff4
|
|
| BLAKE2b-256 |
ffe4e9db49f65ed13d2a8a5362b5da818f312b5c570a7f7c2a77e56144cbc980
|
Provenance
The following attestation bundles were made for agent_labbook-0.14.5.tar.gz:
Publisher:
publish-pypi.yml on binbinsh/agent-labbook
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agent_labbook-0.14.5.tar.gz -
Subject digest:
3852a4a80e16d8c6fea52c712cbb4523ede5347e6fbbfa13d2546a20000cb229 - Sigstore transparency entry: 1239365248
- Sigstore integration time:
-
Permalink:
binbinsh/agent-labbook@a89dce8dd5a66c5e32a2cffbe948780242f7fb45 -
Branch / Tag:
refs/tags/v0.14.5 - Owner: https://github.com/binbinsh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@a89dce8dd5a66c5e32a2cffbe948780242f7fb45 -
Trigger Event:
push
-
Statement type:
File details
Details for the file agent_labbook-0.14.5-py3-none-any.whl.
File metadata
- Download URL: agent_labbook-0.14.5-py3-none-any.whl
- Upload date:
- Size: 39.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b1fcc57c7fdc4fefd19a3f98b4ddefef4d5895583afc7a5dd696c7f9df8a7b3
|
|
| MD5 |
e1015f8ac9dc998375cc68501c2cc87c
|
|
| BLAKE2b-256 |
6a40ab5d659b4f072de7999fd01bea8e12a30fee53c00c2fb3a51f7b1819914a
|
Provenance
The following attestation bundles were made for agent_labbook-0.14.5-py3-none-any.whl:
Publisher:
publish-pypi.yml on binbinsh/agent-labbook
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agent_labbook-0.14.5-py3-none-any.whl -
Subject digest:
9b1fcc57c7fdc4fefd19a3f98b4ddefef4d5895583afc7a5dd696c7f9df8a7b3 - Sigstore transparency entry: 1239365250
- Sigstore integration time:
-
Permalink:
binbinsh/agent-labbook@a89dce8dd5a66c5e32a2cffbe948780242f7fb45 -
Branch / Tag:
refs/tags/v0.14.5 - Owner: https://github.com/binbinsh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@a89dce8dd5a66c5e32a2cffbe948780242f7fb45 -
Trigger Event:
push
-
Statement type: