Notion Internal Integration binding for Codex, Claude Code, and other MCP clients.
Project description
Notion Agent Labbook
Notion Agent Labbook is a local MCP server that connects a project to Notion through a Notion Internal Integration secret. It stores project metadata in .labbook/, can open the Notion integrations dashboard to help the user fetch the secret, lets the user choose between system keychain and 1Password when both are available, lets agents search accessible pages and data sources, and returns the official API context for direct Notion API calls.
This version does not use OAuth, a shared credential broker, or a hosted Worker.
Main Features
- Open the Notion integrations dashboard and guide the user to the Internal Integration Secret.
- Detect whether system keychain and 1Password are available, and let the user choose.
- Store the secret in the local system keychain, in 1Password, or override it with
NOTION_AGENT_LABBOOK_TOKEN. - Search the pages and data sources the bot can access.
- Bind only the pages or data sources a project should use.
- Return access tokens, headers, and bound resource IDs for the official Notion API.
- Work with Codex, Claude Code, and other MCP-capable clients.
Install
Requirements:
- Python 3.10 or newer
uv- a Codex, Claude Code, or another MCP-capable client
Recommended:
codex mcp add labbook -- uvx agent-labbook mcp
claude mcp add --scope project labbook -- uvx agent-labbook mcp
For OpenCode or other MCP clients, add the following to your .mcp.json:
{
"mcpServers": {
"labbook": {
"command": "uvx",
"args": ["agent-labbook", "mcp"]
}
}
}
Or generate this config with:
uvx agent-labbook print-mcp-config
Or use the checked-in .mcp.json for local development from a cloned copy of this repo.
Recommended Flow
- Read
labbook://agent-labbook/project/statusor runnotion_status. - Run
notion_prepare_internal_integrationto open the Notion integrations dashboard and inspectstorage_options,storage_default, andstorage_choice_required. - Create a Notion Internal Integration, copy its secret from the
Configurationtab, and share the target pages or data sources with the bot in Notion. - Save the secret with
notion_configure_internal_integration, choosingstorage=keychainorstorage=1password, or setNOTION_AGENT_LABBOOK_TOKEN. - Run
notion_search_resourcesto find accessible content. - Run
notion_bind_resourcesto bind the pages or data sources this project should use. - Read
labbook://agent-labbook/project/bindingsor runnotion_list_bindingsto inspect the bound roots. - Run
notion_get_api_contextand use the returned token, headers, and resource IDs with the official Notion API.
Save The Secret
Use notion_configure_internal_integration for persistent storage:
storage=keychainDefault recommendation for local development when system keychain is available.storage=1passwordUse when theopCLI is installed and signed in. You can optionally provideop_vaultandop_item_title.NOTION_AGENT_LABBOOK_TOKENUse for CI, temporary runs, or environments where no local secret backend is available.
If more than one local backend is available and you omit storage, the tool will ask the caller to make an explicit choice instead of guessing.
Check The Secret
Use notion_status or agent-labbook doctor to inspect the current setup without retrieving the secret itself.
Important fields:
authenticatedWhether the project currently has a usable Internal Integration secret.storageWhich persistent backend this project is configured to use.secret_planThe recommended secret strategy for this machine right now.storage_optionsThe detected local storage backends and their availability.storage_choice_requiredWhether the caller should ask the user to choose between keychain and 1Password.
To verify that the secret also has the correct Notion permissions, prefer notion_search_resources instead of notion_get_api_context.
Guide Users
The recommended user-facing flow for agents is:
- Call
notion_status. - If
authenticated=false, callnotion_prepare_internal_integration. - If
storage_choice_required=true, ask the user whether they wantkeychainor1password. - Tell the user to copy the
Internal Integration Secretfrom Notion'sConfigurationtab. - Call
notion_configure_internal_integration. - Tell the user to share the target pages or data sources with the integration bot.
- Call
notion_search_resourcesand thennotion_bind_resources.
Do not call notion_get_api_context just to check whether the setup worked. That tool returns the secret and should only be used when the client is ready to make real Notion API calls.
If your content already exists as markdown, prefer Notion's markdown content APIs:
POST /v1/pageswithmarkdownGET /v1/pages/{page_id}/markdownPATCH /v1/pages/{page_id}/markdown
Reference: Working with Markdown Content
Notes
.labbook/should never be committed.- This repo handles local configuration and project binding, not general Notion API wrapping.
- The system keychain is the default recommendation. 1Password is supported when the
opCLI is available and signed in. notion_get_api_contextreturns the secret. Treat it as a last-mile API call step, not a health check.- For local setup notes, see docs/self-host.md.
- For versioning details, see docs/versioning.md.
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.17.1.tar.gz.
File metadata
- Download URL: agent_labbook-0.17.1.tar.gz
- Upload date:
- Size: 28.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d6add8d9b3681b055d2d7ae4c8a34b1841fb4ed6ff0a131e6689ce80f994336f
|
|
| MD5 |
7843acac02c5ceef31bc9e28885f6742
|
|
| BLAKE2b-256 |
9e1ed0a6547b9e8444086589adf3b721683e76cfd6f30e2ca848803706303028
|
Provenance
The following attestation bundles were made for agent_labbook-0.17.1.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.17.1.tar.gz -
Subject digest:
d6add8d9b3681b055d2d7ae4c8a34b1841fb4ed6ff0a131e6689ce80f994336f - Sigstore transparency entry: 1271525415
- Sigstore integration time:
-
Permalink:
binbinsh/agent-labbook@e9a43462ec08d6b21b92093235badb6ad3b11ab4 -
Branch / Tag:
refs/tags/v0.17.1 - Owner: https://github.com/binbinsh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@e9a43462ec08d6b21b92093235badb6ad3b11ab4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file agent_labbook-0.17.1-py3-none-any.whl.
File metadata
- Download URL: agent_labbook-0.17.1-py3-none-any.whl
- Upload date:
- Size: 26.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d51e0098f5054f550f9f8747e6ea7c5413aab1bb0386be54693af46b9e61c233
|
|
| MD5 |
5ad35bae34b460d2a413e6e75b05d61f
|
|
| BLAKE2b-256 |
b0a0e67321cf057e3e4120047912f7071a320c2e569b1995c09ad9d73a2f646c
|
Provenance
The following attestation bundles were made for agent_labbook-0.17.1-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.17.1-py3-none-any.whl -
Subject digest:
d51e0098f5054f550f9f8747e6ea7c5413aab1bb0386be54693af46b9e61c233 - Sigstore transparency entry: 1271525471
- Sigstore integration time:
-
Permalink:
binbinsh/agent-labbook@e9a43462ec08d6b21b92093235badb6ad3b11ab4 -
Branch / Tag:
refs/tags/v0.17.1 - Owner: https://github.com/binbinsh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@e9a43462ec08d6b21b92093235badb6ad3b11ab4 -
Trigger Event:
push
-
Statement type: