notion-mcp 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- notion_mcp-0.2.0/.github/ISSUE_TEMPLATE/bug_report.yml +55 -0
- notion_mcp-0.2.0/.github/ISSUE_TEMPLATE/config.yml +5 -0
- notion_mcp-0.2.0/.github/ISSUE_TEMPLATE/feature_request.yml +28 -0
- notion_mcp-0.2.0/.github/pull_request_template.md +15 -0
- notion_mcp-0.2.0/.github/workflows/ci.yml +50 -0
- notion_mcp-0.2.0/.github/workflows/publish.yml +61 -0
- notion_mcp-0.2.0/.gitignore +44 -0
- notion_mcp-0.2.0/CONTRIBUTING.md +38 -0
- notion_mcp-0.2.0/Docs/Developer/API.md +32 -0
- notion_mcp-0.2.0/Docs/Developer/api/cli.md +204 -0
- notion_mcp-0.2.0/Docs/Developer/api/core.md +95 -0
- notion_mcp-0.2.0/Docs/Developer/architecture/overview.md +101 -0
- notion_mcp-0.2.0/Docs/Developer/mcp_tools/README.md +86 -0
- notion_mcp-0.2.0/Docs/Developer/mcp_tools/auth.md +11 -0
- notion_mcp-0.2.0/Docs/Developer/mcp_tools/blocks.md +18 -0
- notion_mcp-0.2.0/Docs/Developer/mcp_tools/comments.md +13 -0
- notion_mcp-0.2.0/Docs/Developer/mcp_tools/config.md +11 -0
- notion_mcp-0.2.0/Docs/Developer/mcp_tools/custom_emojis.md +9 -0
- notion_mcp-0.2.0/Docs/Developer/mcp_tools/data_sources.md +40 -0
- notion_mcp-0.2.0/Docs/Developer/mcp_tools/databases.md +44 -0
- notion_mcp-0.2.0/Docs/Developer/mcp_tools/file_uploads.md +21 -0
- notion_mcp-0.2.0/Docs/Developer/mcp_tools/pages.md +22 -0
- notion_mcp-0.2.0/Docs/Developer/mcp_tools/raw_api.md +10 -0
- notion_mcp-0.2.0/Docs/Developer/mcp_tools/search.md +7 -0
- notion_mcp-0.2.0/Docs/Developer/mcp_tools/users.md +12 -0
- notion_mcp-0.2.0/Docs/Developer/mcp_tools/views.md +21 -0
- notion_mcp-0.2.0/Docs/Developer/packaging.md +143 -0
- notion_mcp-0.2.0/Docs/Developer/testing/cli.md +43 -0
- notion_mcp-0.2.0/Docs/Developer/testing/core.md +33 -0
- notion_mcp-0.2.0/Docs/Developer/testing/live.md +60 -0
- notion_mcp-0.2.0/Docs/Developer/testing/mcp.md +33 -0
- notion_mcp-0.2.0/Docs/Developer/testing/scenarios.md +49 -0
- notion_mcp-0.2.0/Docs/Developer/testing/strategy.md +41 -0
- notion_mcp-0.2.0/Docs/User/Cli/Auth_And_User.md +23 -0
- notion_mcp-0.2.0/Docs/User/Cli/Block.md +24 -0
- notion_mcp-0.2.0/Docs/User/Cli/Comments.md +19 -0
- notion_mcp-0.2.0/Docs/User/Cli/Database_DataSource.md +77 -0
- notion_mcp-0.2.0/Docs/User/Cli/File_Uploads.md +23 -0
- notion_mcp-0.2.0/Docs/User/Cli/MCP_Server.md +62 -0
- notion_mcp-0.2.0/Docs/User/Cli/Overview.md +27 -0
- notion_mcp-0.2.0/Docs/User/Cli/Page.md +39 -0
- notion_mcp-0.2.0/Docs/User/Cli/Project_Config.md +29 -0
- notion_mcp-0.2.0/Docs/User/Cli/Raw_API.md +17 -0
- notion_mcp-0.2.0/Docs/User/Cli/Search_And_Custom_Emoji.md +19 -0
- notion_mcp-0.2.0/Docs/User/Cli/Views.md +23 -0
- notion_mcp-0.2.0/Docs/User/Cli.md +37 -0
- notion_mcp-0.2.0/Docs/User/Configuration.md +253 -0
- notion_mcp-0.2.0/Docs/User/Guide.md +108 -0
- notion_mcp-0.2.0/Docs/User/Installation.md +127 -0
- notion_mcp-0.2.0/Docs/User/MCP_Clients.md +304 -0
- notion_mcp-0.2.0/Docs/User/Troubleshooting.md +65 -0
- notion_mcp-0.2.0/Docs/User/Uninstallation.md +160 -0
- notion_mcp-0.2.0/Docs/skills/CHANGELOG.md +9 -0
- notion_mcp-0.2.0/Docs/skills/README.md +46 -0
- notion_mcp-0.2.0/Docs/skills/claude/SKILL.md +31 -0
- notion_mcp-0.2.0/Docs/skills/codex/SKILL.md +38 -0
- notion_mcp-0.2.0/Docs/skills/references/full.md +147 -0
- notion_mcp-0.2.0/Docs/skills/references/normal.md +58 -0
- notion_mcp-0.2.0/Docs/skills/references/quick.md +31 -0
- notion_mcp-0.2.0/Docs/skills/third_party/SKILL.md +32 -0
- notion_mcp-0.2.0/LICENSE +201 -0
- notion_mcp-0.2.0/PKG-INFO +112 -0
- notion_mcp-0.2.0/README.md +77 -0
- notion_mcp-0.2.0/SECURITY.md +41 -0
- notion_mcp-0.2.0/dist/.gitignore +1 -0
- notion_mcp-0.2.0/env.example +19 -0
- notion_mcp-0.2.0/notion_mcp/README.md +33 -0
- notion_mcp-0.2.0/notion_mcp/__init__.py +20 -0
- notion_mcp-0.2.0/pyproject.toml +117 -0
- notion_mcp-0.2.0/requirements.txt +10 -0
- notion_mcp-0.2.0/src/notion_mcp/README.md +33 -0
- notion_mcp-0.2.0/src/notion_mcp/__init__.py +26 -0
- notion_mcp-0.2.0/src/notion_mcp/cli/__init__.py +11 -0
- notion_mcp-0.2.0/src/notion_mcp/cli/app.py +75 -0
- notion_mcp-0.2.0/src/notion_mcp/cli/commands/__init__.py +18 -0
- notion_mcp-0.2.0/src/notion_mcp/cli/commands/auth.py +71 -0
- notion_mcp-0.2.0/src/notion_mcp/cli/commands/blocks.py +247 -0
- notion_mcp-0.2.0/src/notion_mcp/cli/commands/comments.py +89 -0
- notion_mcp-0.2.0/src/notion_mcp/cli/commands/config.py +422 -0
- notion_mcp-0.2.0/src/notion_mcp/cli/commands/custom_emojis.py +54 -0
- notion_mcp-0.2.0/src/notion_mcp/cli/commands/data_sources.py +180 -0
- notion_mcp-0.2.0/src/notion_mcp/cli/commands/databases.py +656 -0
- notion_mcp-0.2.0/src/notion_mcp/cli/commands/file_uploads.py +104 -0
- notion_mcp-0.2.0/src/notion_mcp/cli/commands/init.py +28 -0
- notion_mcp-0.2.0/src/notion_mcp/cli/commands/pages.py +712 -0
- notion_mcp-0.2.0/src/notion_mcp/cli/commands/project.py +191 -0
- notion_mcp-0.2.0/src/notion_mcp/cli/commands/raw_api.py +47 -0
- notion_mcp-0.2.0/src/notion_mcp/cli/commands/search.py +36 -0
- notion_mcp-0.2.0/src/notion_mcp/cli/commands/server.py +248 -0
- notion_mcp-0.2.0/src/notion_mcp/cli/commands/status.py +87 -0
- notion_mcp-0.2.0/src/notion_mcp/cli/commands/users.py +63 -0
- notion_mcp-0.2.0/src/notion_mcp/cli/commands/version.py +69 -0
- notion_mcp-0.2.0/src/notion_mcp/cli/commands/views.py +99 -0
- notion_mcp-0.2.0/src/notion_mcp/cli/core_services.py +169 -0
- notion_mcp-0.2.0/src/notion_mcp/cli/formatting.py +64 -0
- notion_mcp-0.2.0/src/notion_mcp/config.py +96 -0
- notion_mcp-0.2.0/src/notion_mcp/core/__init__.py +12 -0
- notion_mcp-0.2.0/src/notion_mcp/core/attachments/__init__.py +26 -0
- notion_mcp-0.2.0/src/notion_mcp/core/attachments/attachment_store.py +159 -0
- notion_mcp-0.2.0/src/notion_mcp/core/attachments/context_resolver.py +63 -0
- notion_mcp-0.2.0/src/notion_mcp/core/attachments/database_attachment.py +274 -0
- notion_mcp-0.2.0/src/notion_mcp/core/attachments/page_attachment.py +211 -0
- notion_mcp-0.2.0/src/notion_mcp/core/audit.py +90 -0
- notion_mcp-0.2.0/src/notion_mcp/core/auth.py +82 -0
- notion_mcp-0.2.0/src/notion_mcp/core/client.py +75 -0
- notion_mcp-0.2.0/src/notion_mcp/core/config.py +242 -0
- notion_mcp-0.2.0/src/notion_mcp/core/errors.py +302 -0
- notion_mcp-0.2.0/src/notion_mcp/core/identifiers.py +69 -0
- notion_mcp-0.2.0/src/notion_mcp/core/models.py +31 -0
- notion_mcp-0.2.0/src/notion_mcp/core/project/__init__.py +20 -0
- notion_mcp-0.2.0/src/notion_mcp/core/project/project_config.py +224 -0
- notion_mcp-0.2.0/src/notion_mcp/core/project/project_paths.py +134 -0
- notion_mcp-0.2.0/src/notion_mcp/core/project/project_resolver.py +108 -0
- notion_mcp-0.2.0/src/notion_mcp/core/services/__init__.py +21 -0
- notion_mcp-0.2.0/src/notion_mcp/core/services/base.py +47 -0
- notion_mcp-0.2.0/src/notion_mcp/core/services/blocks.py +90 -0
- notion_mcp-0.2.0/src/notion_mcp/core/services/comments.py +54 -0
- notion_mcp-0.2.0/src/notion_mcp/core/services/custom_emojis.py +60 -0
- notion_mcp-0.2.0/src/notion_mcp/core/services/data_sources.py +115 -0
- notion_mcp-0.2.0/src/notion_mcp/core/services/databases.py +95 -0
- notion_mcp-0.2.0/src/notion_mcp/core/services/file_uploads.py +84 -0
- notion_mcp-0.2.0/src/notion_mcp/core/services/pages.py +215 -0
- notion_mcp-0.2.0/src/notion_mcp/core/services/raw_api.py +121 -0
- notion_mcp-0.2.0/src/notion_mcp/core/services/search.py +26 -0
- notion_mcp-0.2.0/src/notion_mcp/core/services/users.py +48 -0
- notion_mcp-0.2.0/src/notion_mcp/core/services/views.py +95 -0
- notion_mcp-0.2.0/src/notion_mcp/dependencies.py +44 -0
- notion_mcp-0.2.0/src/notion_mcp/mcp_server/__init__.py +11 -0
- notion_mcp-0.2.0/src/notion_mcp/mcp_server/process_manager.py +460 -0
- notion_mcp-0.2.0/src/notion_mcp/mcp_server/runner.py +46 -0
- notion_mcp-0.2.0/src/notion_mcp/mcp_server/server.py +174 -0
- notion_mcp-0.2.0/src/notion_mcp/mcp_server/tools/__init__.py +23 -0
- notion_mcp-0.2.0/src/notion_mcp/mcp_server/tools/auth.py +59 -0
- notion_mcp-0.2.0/src/notion_mcp/mcp_server/tools/blocks.py +118 -0
- notion_mcp-0.2.0/src/notion_mcp/mcp_server/tools/comments.py +62 -0
- notion_mcp-0.2.0/src/notion_mcp/mcp_server/tools/config.py +67 -0
- notion_mcp-0.2.0/src/notion_mcp/mcp_server/tools/custom_emojis.py +51 -0
- notion_mcp-0.2.0/src/notion_mcp/mcp_server/tools/data_sources.py +123 -0
- notion_mcp-0.2.0/src/notion_mcp/mcp_server/tools/databases.py +147 -0
- notion_mcp-0.2.0/src/notion_mcp/mcp_server/tools/file_uploads.py +96 -0
- notion_mcp-0.2.0/src/notion_mcp/mcp_server/tools/pages.py +118 -0
- notion_mcp-0.2.0/src/notion_mcp/mcp_server/tools/raw_api.py +41 -0
- notion_mcp-0.2.0/src/notion_mcp/mcp_server/tools/search.py +35 -0
- notion_mcp-0.2.0/src/notion_mcp/mcp_server/tools/shared.py +182 -0
- notion_mcp-0.2.0/src/notion_mcp/mcp_server/tools/users.py +62 -0
- notion_mcp-0.2.0/src/notion_mcp/mcp_server/tools/views.py +83 -0
- notion_mcp-0.2.0/src/notion_mcp/models/__init__.py +5 -0
- notion_mcp-0.2.0/src/notion_mcp/models/config_model.py +21 -0
- notion_mcp-0.2.0/src/notion_mcp/routes/__init__.py +8 -0
- notion_mcp-0.2.0/src/notion_mcp/routes/blocks.py +65 -0
- notion_mcp-0.2.0/src/notion_mcp/routes/databases.py +95 -0
- notion_mcp-0.2.0/src/notion_mcp/routes/pages.py +75 -0
- notion_mcp-0.2.0/src/notion_mcp/server.py +37 -0
- notion_mcp-0.2.0/tests/__init__.py +1 -0
- notion_mcp-0.2.0/tests/conftest.py +12 -0
- notion_mcp-0.2.0/tests/live/__init__.py +1 -0
- notion_mcp-0.2.0/tests/live/test_live_auth_validate.py +25 -0
- notion_mcp-0.2.0/tests/live/test_live_content_consistency_e2e.py +475 -0
- notion_mcp-0.2.0/tests/live/test_live_mcp_server_http_e2e.py +640 -0
- notion_mcp-0.2.0/tests/test_cli.py +42 -0
- notion_mcp-0.2.0/tests/test_config.py +44 -0
- notion_mcp-0.2.0/tests/test_server_blocks.py +58 -0
- notion_mcp-0.2.0/tests/test_server_databases.py +59 -0
- notion_mcp-0.2.0/tests/test_server_pages.py +63 -0
- notion_mcp-0.2.0/tests/v2/__init__.py +1 -0
- notion_mcp-0.2.0/tests/v2/cli/__init__.py +1 -0
- notion_mcp-0.2.0/tests/v2/cli/helpers.py +8 -0
- notion_mcp-0.2.0/tests/v2/cli/test_config_commands.py +100 -0
- notion_mcp-0.2.0/tests/v2/cli/test_data_source_namespace.py +91 -0
- notion_mcp-0.2.0/tests/v2/cli/test_database_container.py +75 -0
- notion_mcp-0.2.0/tests/v2/cli/test_database_shortcut_commands.py +116 -0
- notion_mcp-0.2.0/tests/v2/cli/test_dry_run.py +53 -0
- notion_mcp-0.2.0/tests/v2/cli/test_english_output_text.py +19 -0
- notion_mcp-0.2.0/tests/v2/cli/test_help_text.py +74 -0
- notion_mcp-0.2.0/tests/v2/cli/test_init.py +54 -0
- notion_mcp-0.2.0/tests/v2/cli/test_legacy_database_query_raw_api.py +38 -0
- notion_mcp-0.2.0/tests/v2/cli/test_raw_api_positioning.py +53 -0
- notion_mcp-0.2.0/tests/v2/cli/test_resource_commands.py +85 -0
- notion_mcp-0.2.0/tests/v2/cli/test_stage8_extended_resource_commands.py +141 -0
- notion_mcp-0.2.0/tests/v2/cli/test_stage8_status_capabilities.py +11 -0
- notion_mcp-0.2.0/tests/v2/cli/test_status.py +50 -0
- notion_mcp-0.2.0/tests/v2/core/__init__.py +1 -0
- notion_mcp-0.2.0/tests/v2/core/test_audit.py +27 -0
- notion_mcp-0.2.0/tests/v2/core/test_auth.py +53 -0
- notion_mcp-0.2.0/tests/v2/core/test_client.py +47 -0
- notion_mcp-0.2.0/tests/v2/core/test_config.py +105 -0
- notion_mcp-0.2.0/tests/v2/core/test_database_data_source_services.py +116 -0
- notion_mcp-0.2.0/tests/v2/core/test_database_service_container_only.py +5 -0
- notion_mcp-0.2.0/tests/v2/core/test_errors.py +30 -0
- notion_mcp-0.2.0/tests/v2/core/test_notion_version_policy.py +60 -0
- notion_mcp-0.2.0/tests/v2/core/test_packaging_metadata.py +39 -0
- notion_mcp-0.2.0/tests/v2/core/test_packaging_metadata_v2.py +41 -0
- notion_mcp-0.2.0/tests/v2/core/test_services_and_raw_api.py +173 -0
- notion_mcp-0.2.0/tests/v2/core/test_stage5_services_extended.py +188 -0
- notion_mcp-0.2.0/tests/v2/fixtures/__init__.py +1 -0
- notion_mcp-0.2.0/tests/v2/fixtures/fake_notion.py +36 -0
- notion_mcp-0.2.0/tests/v2/mcp_server/__init__.py +1 -0
- notion_mcp-0.2.0/tests/v2/mcp_server/test_dangerous_tools.py +30 -0
- notion_mcp-0.2.0/tests/v2/mcp_server/test_server_lifecycle.py +22 -0
- notion_mcp-0.2.0/tests/v2/mcp_server/test_stage5_tool_coverage.py +66 -0
- notion_mcp-0.2.0/tests/v2/mcp_server/test_tool_calls.py +65 -0
- notion_mcp-0.2.0/tests/v2/mcp_server/test_tool_inventory.py +54 -0
- notion_mcp-0.2.0/tests/v2/mcp_tools/__init__.py +1 -0
- notion_mcp-0.2.0/tests/v2/mcp_tools/test_database_data_source_tools.py +140 -0
- notion_mcp-0.2.0/tests/v2/mcp_tools/test_legacy_database_query_raw_api.py +89 -0
- notion_mcp-0.2.0/tests/v2/scenarios/__init__.py +1 -0
- notion_mcp-0.2.0/tests/v2/scenarios/test_cli_documentation_inventory.py +99 -0
- notion_mcp-0.2.0/tests/v2/scenarios/test_cli_to_core_to_fake_notion.py +34 -0
- notion_mcp-0.2.0/tests/v2/scenarios/test_documentation_reader_boundary.py +37 -0
- notion_mcp-0.2.0/tests/v2/scenarios/test_existing_rest_smoke.py +28 -0
- notion_mcp-0.2.0/tests/v2/scenarios/test_full_local_config_flow.py +35 -0
- notion_mcp-0.2.0/tests/v2/scenarios/test_install_and_run.py +29 -0
- notion_mcp-0.2.0/tests/v2/scenarios/test_isolated_install.py +41 -0
- notion_mcp-0.2.0/tests/v2/scenarios/test_mcp_client_flow.py +20 -0
- notion_mcp-0.2.0/tests/v2/scenarios/test_mcp_to_core_to_fake_notion.py +26 -0
- notion_mcp-0.2.0/tests/v2/scenarios/test_page_content_edit_workflow.py +97 -0
- notion_mcp-0.2.0/tests/v2/scenarios/test_stage1_documentation_alignment.py +63 -0
- notion_mcp-0.2.0/tests/v2/scenarios/test_stage7_documentation_completeness.py +64 -0
- notion_mcp-0.2.0/tests/v2/scenarios/test_stage8_release_readiness.py +48 -0
- notion_mcp-0.2.0/tests/v3/__init__.py +1 -0
- notion_mcp-0.2.0/tests/v3/cli/__init__.py +1 -0
- notion_mcp-0.2.0/tests/v3/cli/test_database_attach.py +103 -0
- notion_mcp-0.2.0/tests/v3/cli/test_database_context_resolution.py +132 -0
- notion_mcp-0.2.0/tests/v3/cli/test_database_detach.py +37 -0
- notion_mcp-0.2.0/tests/v3/cli/test_database_status.py +49 -0
- notion_mcp-0.2.0/tests/v3/cli/test_page_attach.py +89 -0
- notion_mcp-0.2.0/tests/v3/cli/test_page_block_edit_attach.py +120 -0
- notion_mcp-0.2.0/tests/v3/cli/test_page_content_attach.py +86 -0
- notion_mcp-0.2.0/tests/v3/cli/test_page_context_resolution.py +45 -0
- notion_mcp-0.2.0/tests/v3/cli/test_page_detach.py +57 -0
- notion_mcp-0.2.0/tests/v3/cli/test_page_insert.py +65 -0
- notion_mcp-0.2.0/tests/v3/cli/test_page_status.py +93 -0
- notion_mcp-0.2.0/tests/v3/cli/test_page_url_inputs.py +112 -0
- notion_mcp-0.2.0/tests/v3/cli/test_project_init.py +88 -0
- notion_mcp-0.2.0/tests/v3/cli/test_project_status.py +82 -0
- notion_mcp-0.2.0/tests/v3/cli/test_public_command_surface_revision.py +147 -0
- notion_mcp-0.2.0/tests/v3/core/__init__.py +1 -0
- notion_mcp-0.2.0/tests/v3/core/test_database_attachment_store.py +58 -0
- notion_mcp-0.2.0/tests/v3/core/test_identifier_parsing.py +21 -0
- notion_mcp-0.2.0/tests/v3/core/test_page_attachment_store.py +71 -0
- notion_mcp-0.2.0/tests/v3/core/test_page_content_service.py +129 -0
- notion_mcp-0.2.0/tests/v3/core/test_project_resolver.py +67 -0
- notion_mcp-0.2.0/tests/v3/scenarios/__init__.py +1 -0
- notion_mcp-0.2.0/tests/v3/scenarios/test_attach_database_workflow.py +115 -0
- notion_mcp-0.2.0/tests/v3/scenarios/test_attach_page_workflow.py +62 -0
- notion_mcp-0.2.0/tests/v3/scenarios/test_project_context_discovery.py +57 -0
- notion_mcp-0.2.0/tests/v4/cli/test_server_commands.py +106 -0
- notion_mcp-0.2.0/tests/v4/mcp_server/test_http_tool_output_contract.py +13 -0
- notion_mcp-0.2.0/tests/v4/mcp_server/test_process_manager.py +93 -0
- notion_mcp-0.2.0/tomllib.py +74 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
name: Bug report
|
|
2
|
+
description: Report a reproducible problem in notion-mcp.
|
|
3
|
+
title: "[Bug]: "
|
|
4
|
+
body:
|
|
5
|
+
- type: markdown
|
|
6
|
+
attributes:
|
|
7
|
+
value: |
|
|
8
|
+
Do not include real Notion tokens, private workspace data, local config
|
|
9
|
+
files, or unredacted logs. Sensitive security reports should follow
|
|
10
|
+
SECURITY.md instead of a public issue.
|
|
11
|
+
- type: textarea
|
|
12
|
+
id: summary
|
|
13
|
+
attributes:
|
|
14
|
+
label: Summary
|
|
15
|
+
description: What happened?
|
|
16
|
+
validations:
|
|
17
|
+
required: true
|
|
18
|
+
- type: textarea
|
|
19
|
+
id: reproduce
|
|
20
|
+
attributes:
|
|
21
|
+
label: Reproduction steps
|
|
22
|
+
description: Provide the smallest command sequence or MCP client flow that reproduces the issue.
|
|
23
|
+
placeholder: |
|
|
24
|
+
1. Run `notion-mcp ...`
|
|
25
|
+
2. Observe ...
|
|
26
|
+
validations:
|
|
27
|
+
required: true
|
|
28
|
+
- type: textarea
|
|
29
|
+
id: expected
|
|
30
|
+
attributes:
|
|
31
|
+
label: Expected behavior
|
|
32
|
+
validations:
|
|
33
|
+
required: true
|
|
34
|
+
- type: textarea
|
|
35
|
+
id: actual
|
|
36
|
+
attributes:
|
|
37
|
+
label: Actual behavior
|
|
38
|
+
description: Include sanitized output only.
|
|
39
|
+
validations:
|
|
40
|
+
required: true
|
|
41
|
+
- type: input
|
|
42
|
+
id: version
|
|
43
|
+
attributes:
|
|
44
|
+
label: Version or commit
|
|
45
|
+
placeholder: "notion-mcp 0.2.0 or commit SHA"
|
|
46
|
+
- type: textarea
|
|
47
|
+
id: environment
|
|
48
|
+
attributes:
|
|
49
|
+
label: Environment
|
|
50
|
+
description: OS, Python version, install method, MCP client if applicable.
|
|
51
|
+
placeholder: |
|
|
52
|
+
OS:
|
|
53
|
+
Python:
|
|
54
|
+
Install method:
|
|
55
|
+
MCP client:
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
name: Feature request
|
|
2
|
+
description: Suggest an improvement or new capability.
|
|
3
|
+
title: "[Feature]: "
|
|
4
|
+
body:
|
|
5
|
+
- type: textarea
|
|
6
|
+
id: problem
|
|
7
|
+
attributes:
|
|
8
|
+
label: Problem or use case
|
|
9
|
+
description: What workflow should this improve?
|
|
10
|
+
validations:
|
|
11
|
+
required: true
|
|
12
|
+
- type: textarea
|
|
13
|
+
id: proposal
|
|
14
|
+
attributes:
|
|
15
|
+
label: Proposed behavior
|
|
16
|
+
description: Describe the CLI, MCP tool, configuration, or documentation change you want.
|
|
17
|
+
validations:
|
|
18
|
+
required: true
|
|
19
|
+
- type: textarea
|
|
20
|
+
id: alternatives
|
|
21
|
+
attributes:
|
|
22
|
+
label: Alternatives considered
|
|
23
|
+
description: Optional. Mention current workarounds or other designs.
|
|
24
|
+
- type: textarea
|
|
25
|
+
id: compatibility
|
|
26
|
+
attributes:
|
|
27
|
+
label: Compatibility notes
|
|
28
|
+
description: Optional. Mention any impact on existing CLI commands, MCP tools, or config files.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
## Summary
|
|
2
|
+
|
|
3
|
+
-
|
|
4
|
+
|
|
5
|
+
## Validation
|
|
6
|
+
|
|
7
|
+
- [ ] `uv run pytest -q -p no:cacheprovider`
|
|
8
|
+
- [ ] `uv run ruff check .`
|
|
9
|
+
- [ ] `uv run mypy src`
|
|
10
|
+
- [ ] Documentation updated, or not applicable
|
|
11
|
+
|
|
12
|
+
## Safety
|
|
13
|
+
|
|
14
|
+
- [ ] No real Notion tokens, private workspace data, local config files, or unredacted logs are included.
|
|
15
|
+
- [ ] Live Notion tests were not run, or their credential/data scope is documented.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
push:
|
|
6
|
+
branches:
|
|
7
|
+
- main
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
test:
|
|
14
|
+
name: Python ${{ matrix.python-version }}
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
env:
|
|
17
|
+
PYTHONDONTWRITEBYTECODE: "1"
|
|
18
|
+
UV_PROJECT_ENVIRONMENT: /tmp/notion-mcp-ci-${{ matrix.python-version }}
|
|
19
|
+
strategy:
|
|
20
|
+
fail-fast: false
|
|
21
|
+
matrix:
|
|
22
|
+
python-version:
|
|
23
|
+
- "3.10"
|
|
24
|
+
- "3.12"
|
|
25
|
+
|
|
26
|
+
steps:
|
|
27
|
+
- name: Check out repository
|
|
28
|
+
uses: actions/checkout@v4
|
|
29
|
+
|
|
30
|
+
- name: Set up Python
|
|
31
|
+
uses: actions/setup-python@v5
|
|
32
|
+
with:
|
|
33
|
+
python-version: ${{ matrix.python-version }}
|
|
34
|
+
|
|
35
|
+
- name: Set up uv
|
|
36
|
+
uses: astral-sh/setup-uv@v5
|
|
37
|
+
with:
|
|
38
|
+
enable-cache: true
|
|
39
|
+
|
|
40
|
+
- name: Run tests
|
|
41
|
+
run: uv run pytest -q -p no:cacheprovider
|
|
42
|
+
|
|
43
|
+
- name: Run ruff
|
|
44
|
+
run: uv run ruff check .
|
|
45
|
+
|
|
46
|
+
- name: Run mypy
|
|
47
|
+
run: uv run mypy src
|
|
48
|
+
|
|
49
|
+
- name: Build package
|
|
50
|
+
run: uv build --out-dir /tmp/notion-mcp-dist
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
name: Publish Python package
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types:
|
|
6
|
+
- published
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
build:
|
|
14
|
+
name: Build distributions
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- name: Check out repository
|
|
19
|
+
uses: actions/checkout@v4
|
|
20
|
+
|
|
21
|
+
- name: Set up Python
|
|
22
|
+
uses: actions/setup-python@v5
|
|
23
|
+
with:
|
|
24
|
+
python-version: "3.12"
|
|
25
|
+
|
|
26
|
+
- name: Set up uv
|
|
27
|
+
uses: astral-sh/setup-uv@v5
|
|
28
|
+
with:
|
|
29
|
+
enable-cache: true
|
|
30
|
+
|
|
31
|
+
- name: Build distributions
|
|
32
|
+
run: uv build
|
|
33
|
+
|
|
34
|
+
- name: Upload distributions
|
|
35
|
+
uses: actions/upload-artifact@v4
|
|
36
|
+
with:
|
|
37
|
+
name: python-package-distributions
|
|
38
|
+
path: dist/*
|
|
39
|
+
if-no-files-found: error
|
|
40
|
+
|
|
41
|
+
publish:
|
|
42
|
+
name: Publish to PyPI
|
|
43
|
+
if: github.event_name == 'release'
|
|
44
|
+
needs: build
|
|
45
|
+
runs-on: ubuntu-latest
|
|
46
|
+
environment:
|
|
47
|
+
name: pypi
|
|
48
|
+
url: https://pypi.org/p/notion-mcp
|
|
49
|
+
permissions:
|
|
50
|
+
contents: read
|
|
51
|
+
id-token: write
|
|
52
|
+
|
|
53
|
+
steps:
|
|
54
|
+
- name: Download distributions
|
|
55
|
+
uses: actions/download-artifact@v4
|
|
56
|
+
with:
|
|
57
|
+
name: python-package-distributions
|
|
58
|
+
path: dist/
|
|
59
|
+
|
|
60
|
+
- name: Publish distributions to PyPI
|
|
61
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
__pycache__/
|
|
2
|
+
# BEGIN git-guard managed ignore rules
|
|
3
|
+
.*
|
|
4
|
+
!.gitignore
|
|
5
|
+
!.gitmodules
|
|
6
|
+
!.github/
|
|
7
|
+
.github/**
|
|
8
|
+
!.github/workflows/
|
|
9
|
+
!.github/workflows/*.yml
|
|
10
|
+
!.github/workflows/*.yaml
|
|
11
|
+
!.github/actions/
|
|
12
|
+
!.github/actions/**
|
|
13
|
+
!.github/ISSUE_TEMPLATE/
|
|
14
|
+
!.github/ISSUE_TEMPLATE/**
|
|
15
|
+
!.github/PULL_REQUEST_TEMPLATE.md
|
|
16
|
+
!.github/pull_request_template.md
|
|
17
|
+
!.github/PULL_REQUEST_TEMPLATE/
|
|
18
|
+
!.github/PULL_REQUEST_TEMPLATE/**
|
|
19
|
+
!.github/DISCUSSION_TEMPLATE/
|
|
20
|
+
!.github/DISCUSSION_TEMPLATE/**
|
|
21
|
+
!.github/dependabot.yml
|
|
22
|
+
!.github/CODEOWNERS
|
|
23
|
+
!.github/FUNDING.yml
|
|
24
|
+
!.github/SECURITY.md
|
|
25
|
+
!.github/CODE_OF_CONDUCT.md
|
|
26
|
+
!.github/CONTRIBUTING.md
|
|
27
|
+
!.github/SUPPORT.md
|
|
28
|
+
AGENTS.md
|
|
29
|
+
# END git-guard managed ignore rules
|
|
30
|
+
*.py[cod]
|
|
31
|
+
*.pyo
|
|
32
|
+
.pytest_cache/
|
|
33
|
+
.ruff_cache/
|
|
34
|
+
.mypy_cache/
|
|
35
|
+
.venv/
|
|
36
|
+
uv.lock
|
|
37
|
+
build/
|
|
38
|
+
dist/
|
|
39
|
+
*.egg-info/
|
|
40
|
+
.DS_Store
|
|
41
|
+
.dev_docs/
|
|
42
|
+
.private_docs/
|
|
43
|
+
tests/v5/
|
|
44
|
+
Docs/skills/test_copies/
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Pull requests are welcome.
|
|
4
|
+
|
|
5
|
+
## Before Opening a Pull Request
|
|
6
|
+
|
|
7
|
+
Use a small, focused change. Keep unrelated refactors, formatting churn, and
|
|
8
|
+
generated files out of the PR.
|
|
9
|
+
|
|
10
|
+
Run the local checks when they apply:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
uv run pytest -q -p no:cacheprovider
|
|
14
|
+
uv run ruff check .
|
|
15
|
+
uv run mypy src
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Live Notion tests require explicit opt-in and real credentials. Do not run or
|
|
19
|
+
document live results unless the test command, required environment variables,
|
|
20
|
+
and data-safety scope are clear.
|
|
21
|
+
|
|
22
|
+
## Documentation
|
|
23
|
+
|
|
24
|
+
Update user or developer documentation when a change affects CLI commands,
|
|
25
|
+
MCP tools, configuration, installation, security behavior, or public package
|
|
26
|
+
metadata.
|
|
27
|
+
|
|
28
|
+
## Security
|
|
29
|
+
|
|
30
|
+
Do not include real Notion tokens, private workspace content, local config files,
|
|
31
|
+
or unredacted logs in issues, pull requests, tests, or documentation.
|
|
32
|
+
|
|
33
|
+
Report sensitive security issues through the process in [SECURITY.md](SECURITY.md).
|
|
34
|
+
|
|
35
|
+
## License
|
|
36
|
+
|
|
37
|
+
By contributing to this repository, you agree that your contribution is licensed
|
|
38
|
+
under the Apache License 2.0.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# 开发者接口索引
|
|
2
|
+
|
|
3
|
+
本文档面向开发者,说明当前仓库的接口文档入口。当前项目已经从 REST 原型补全为本地 Notion MCP 服务器。
|
|
4
|
+
|
|
5
|
+
## 当前接口状态
|
|
6
|
+
|
|
7
|
+
- `src/notion_mcp/core/`:唯一业务逻辑层,供 CLI、MCP Tool 和兼容代码复用。
|
|
8
|
+
- `src/notion_mcp/server.py` 与 `src/notion_mcp/routes/`:内部 REST 原型兼容代码,不是公开 server CLI 入口,也不是最终 MCP Tool 接口。
|
|
9
|
+
- `src/notion_mcp/cli/`:git-like CLI,人类入口,调用 Core。
|
|
10
|
+
- `src/notion_mcp/mcp_server/`:MCP server 和 MCP tools,Agent/LLM 结构化入口,调用 Core。
|
|
11
|
+
|
|
12
|
+
## 文档入口
|
|
13
|
+
|
|
14
|
+
- Core API:`Docs/Developer/api/core.md`
|
|
15
|
+
- CLI API:`Docs/Developer/api/cli.md`
|
|
16
|
+
- Core 测试:`Docs/Developer/testing/core.md`
|
|
17
|
+
- CLI 测试:`Docs/Developer/testing/cli.md`
|
|
18
|
+
- MCP 测试:`Docs/Developer/testing/mcp.md`
|
|
19
|
+
- Live 测试:`Docs/Developer/testing/live.md`
|
|
20
|
+
- 场景测试:`Docs/Developer/testing/scenarios.md`
|
|
21
|
+
- MCP Tool contract:`Docs/Developer/mcp_tools/README.md`
|
|
22
|
+
|
|
23
|
+
## 调用边界
|
|
24
|
+
|
|
25
|
+
目标调用关系必须保持为:
|
|
26
|
+
|
|
27
|
+
```text
|
|
28
|
+
Human -> CLI -> Core
|
|
29
|
+
Agent / LLM -> MCP Tool -> Core
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
禁止 MCP Tool 通过 CLI 字符串调用,也禁止 CLI 和 MCP Tool 各自复制业务逻辑。
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
# CLI API
|
|
2
|
+
|
|
3
|
+
本文档面向开发者,记录当前 `notion-mcp` CLI 的公开命令面、隐藏兼容入口和 Core 调用边界。CLI 负责终端使用体验,业务能力必须来自 Core service。
|
|
4
|
+
|
|
5
|
+
## 入口
|
|
6
|
+
|
|
7
|
+
- package:`notion_mcp.cli`
|
|
8
|
+
- console script:`notion-mcp = notion_mcp.cli:app`
|
|
9
|
+
- root app:`src/notion_mcp/cli/app.py`
|
|
10
|
+
- help options:`--help` and `-h`
|
|
11
|
+
|
|
12
|
+
## 核心边界
|
|
13
|
+
|
|
14
|
+
```text
|
|
15
|
+
CLI -> Core -> Notion SDK/API
|
|
16
|
+
MCP Tool -> Core -> Notion SDK/API
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
CLI 不应直接调用 Notion SDK。新增命令时,应先确认对应 Core service 能力;如果 Core 缺失,应先补 Core,再接 CLI。
|
|
20
|
+
|
|
21
|
+
## 公开 Root 命令
|
|
22
|
+
|
|
23
|
+
- `notion-mcp init`
|
|
24
|
+
- 初始化当前目录的项目级 `.notion_mcp/`。
|
|
25
|
+
- 不写入 token,不要求 user id。
|
|
26
|
+
- `notion-mcp pwd`
|
|
27
|
+
- 从当前目录向上解析项目根目录。
|
|
28
|
+
- `notion-mcp version`
|
|
29
|
+
- 输出 MCP package version 和配置的 Notion API version。
|
|
30
|
+
- `notion-mcp config --global --show`
|
|
31
|
+
- 输出全局配置摘要,不暴露 token。
|
|
32
|
+
- `notion-mcp config --global user.token <token>`
|
|
33
|
+
- 更新全局 token。
|
|
34
|
+
- `notion-mcp config --global user.name <name>`
|
|
35
|
+
- 更新全局用户显示名称。
|
|
36
|
+
- `notion-mcp config --local --show`
|
|
37
|
+
- 输出当前项目级配置摘要。
|
|
38
|
+
|
|
39
|
+
`project`、`local`、root `status`、`config global/local` 和 `config set/get/unset/list` 只保留为隐藏兼容入口,不属于公开命令面。
|
|
40
|
+
|
|
41
|
+
## Project Context
|
|
42
|
+
|
|
43
|
+
项目上下文由 Core 提供:
|
|
44
|
+
|
|
45
|
+
```text
|
|
46
|
+
ProjectResolver
|
|
47
|
+
ProjectConfigStore
|
|
48
|
+
AttachmentStore
|
|
49
|
+
ContextResolver
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
解析规则:
|
|
53
|
+
|
|
54
|
+
```text
|
|
55
|
+
explicit id > attached state > error
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
项目级配置:
|
|
59
|
+
|
|
60
|
+
```text
|
|
61
|
+
.notion_mcp/config.json
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Attach state:
|
|
65
|
+
|
|
66
|
+
```text
|
|
67
|
+
.notion_mcp/state/page.attach.json
|
|
68
|
+
.notion_mcp/state/database.attach.json
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
项目级配置和 attach state 不得保存 token。
|
|
72
|
+
|
|
73
|
+
## Page CLI
|
|
74
|
+
|
|
75
|
+
公开命令:
|
|
76
|
+
|
|
77
|
+
Page id inputs are normalized through `src/notion_mcp/core/identifiers.py`. Public `<page_id>` arguments accept raw page ids, copied Notion URLs, and Markdown links that contain Notion URLs.
|
|
78
|
+
|
|
79
|
+
- `notion-mcp page attach <page_id>`
|
|
80
|
+
- 绑定当前项目默认 page。
|
|
81
|
+
- `attach` 语义是 project context binding,不是 file attachment。
|
|
82
|
+
- `notion-mcp page status`
|
|
83
|
+
- 显示当前绑定 page。
|
|
84
|
+
- `notion-mcp page refresh`
|
|
85
|
+
- 重新读取绑定 page 的标题、URL 和状态,只刷新本地 state,不修改 Notion 远端。
|
|
86
|
+
- `notion-mcp page detach`
|
|
87
|
+
- 删除本地 page attach state,不修改 Notion 远端。
|
|
88
|
+
- `notion-mcp page retrieve [page_id]`
|
|
89
|
+
- 读取 page 元信息。
|
|
90
|
+
- 无参数时使用 attached page。
|
|
91
|
+
- `notion-mcp page blocks [page_id]`
|
|
92
|
+
- 读取 page 内容块摘要。
|
|
93
|
+
- 无参数时使用 attached page。
|
|
94
|
+
- `notion-mcp page create`
|
|
95
|
+
- 创建 page。
|
|
96
|
+
- payload 没有 parent 且存在 attached page 时,默认使用 attached page 作为 parent。
|
|
97
|
+
- `notion-mcp page create --parent-page <page_id>`
|
|
98
|
+
- 在指定 parent page 下创建 child page。
|
|
99
|
+
- `notion-mcp page update <page_id>`
|
|
100
|
+
- 更新普通 page 或 data source entry page properties。
|
|
101
|
+
- `notion-mcp page trash <page_id>`
|
|
102
|
+
- 将 page 移入 trash。
|
|
103
|
+
|
|
104
|
+
隐藏兼容入口保留给旧的 page content/current/deattach aliases、旧 page-scoped block group 和旧 page insert group。它们不得作为公开用户命令记录。
|
|
105
|
+
|
|
106
|
+
## Block CLI
|
|
107
|
+
|
|
108
|
+
公开命令:
|
|
109
|
+
|
|
110
|
+
- `notion-mcp block children <block_id>`
|
|
111
|
+
- 列出 child blocks。
|
|
112
|
+
- `notion-mcp block append <block_id>`
|
|
113
|
+
- 追加 child blocks。
|
|
114
|
+
- `notion-mcp block insert-after <block_id>`
|
|
115
|
+
- 在目标 block 后插入 sibling blocks。
|
|
116
|
+
- `notion-mcp block update <block_id>`
|
|
117
|
+
- 更新 block。
|
|
118
|
+
- `notion-mcp block trash <block_id>`
|
|
119
|
+
- 将 block 移入 trash。
|
|
120
|
+
|
|
121
|
+
`insert-before` 不作为稳定公开命令。`block remove` 只作为隐藏兼容别名,行为等同 trash。
|
|
122
|
+
|
|
123
|
+
## Database 和 DataSource
|
|
124
|
+
|
|
125
|
+
语义边界:
|
|
126
|
+
|
|
127
|
+
```text
|
|
128
|
+
database = container
|
|
129
|
+
data_source = table under database
|
|
130
|
+
page = page or data source entry
|
|
131
|
+
block = page content node
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
容器级能力使用 `database`。表级 schema/query/templates/page-entry 能力使用 `data-source`。只有使用当前绑定 database 的 active data source 时,才允许 `database` 快捷命令。
|
|
135
|
+
|
|
136
|
+
### Database 容器命令
|
|
137
|
+
|
|
138
|
+
- `notion-mcp database attach <database_id>`
|
|
139
|
+
- `notion-mcp database attach <database_id> --data-source <id_or_name>`
|
|
140
|
+
- `notion-mcp database status`
|
|
141
|
+
- `notion-mcp database refresh`
|
|
142
|
+
- `notion-mcp database detach`
|
|
143
|
+
- `notion-mcp database retrieve [database_id]`
|
|
144
|
+
- `notion-mcp database sources [database_id]`
|
|
145
|
+
- `notion-mcp database create`
|
|
146
|
+
- `notion-mcp database create --parent-page <page_id>`
|
|
147
|
+
- `notion-mcp database update <database_id>`
|
|
148
|
+
- `notion-mcp database rename <database_id> <new_name>`
|
|
149
|
+
|
|
150
|
+
`database create` 创建 database 容器,并创建 initial data source。`database update` 只允许容器级更新,不用于修改 data source schema。
|
|
151
|
+
|
|
152
|
+
### Database 快捷命令
|
|
153
|
+
|
|
154
|
+
这些命令只作用于 attached database 的 active data source:
|
|
155
|
+
|
|
156
|
+
- `notion-mcp database query --payload <json>`
|
|
157
|
+
- `notion-mcp database page create --properties <json>`
|
|
158
|
+
- `notion-mcp database property rename <property> <new_name>`
|
|
159
|
+
|
|
160
|
+
公开 CLI 不提供 `database query --data-source`、`database page create <data_source_id>`、`database page update <page_id>` 或三参数 `database property rename`。显式 data source 操作必须使用 `data-source`;page property 更新使用 `page update`。
|
|
161
|
+
|
|
162
|
+
### DataSource 命令
|
|
163
|
+
|
|
164
|
+
- `notion-mcp data-source retrieve <data_source_id>`
|
|
165
|
+
- `notion-mcp data-source query <data_source_id>`
|
|
166
|
+
- `notion-mcp data-source create`
|
|
167
|
+
- `notion-mcp data-source create <database_id>`
|
|
168
|
+
- `notion-mcp data-source update <data_source_id>`
|
|
169
|
+
- `notion-mcp data-source templates <data_source_id>`
|
|
170
|
+
- `notion-mcp data-source property rename <data_source_id> <property> <new_name>`
|
|
171
|
+
- `notion-mcp data-source page create <data_source_id>`
|
|
172
|
+
|
|
173
|
+
## 其他对象域
|
|
174
|
+
|
|
175
|
+
- `notion-mcp auth validate`
|
|
176
|
+
- `notion-mcp auth whoami`
|
|
177
|
+
- `notion-mcp user me/list/retrieve`
|
|
178
|
+
- `notion-mcp comment list/create/reply`
|
|
179
|
+
- `notion-mcp view retrieve/list/query/create/update`
|
|
180
|
+
- `notion-mcp file-upload retrieve/list/create/send/complete`
|
|
181
|
+
- `notion-mcp search query`
|
|
182
|
+
- `notion-mcp custom-emoji list/retrieve`
|
|
183
|
+
- `notion-mcp raw-api operations`
|
|
184
|
+
- `notion-mcp raw-api invoke <operation>`
|
|
185
|
+
- `notion-mcp server run`
|
|
186
|
+
- `notion-mcp server status`
|
|
187
|
+
- `notion-mcp server stop`
|
|
188
|
+
- `notion-mcp server logs`
|
|
189
|
+
- `notion-mcp server remove`
|
|
190
|
+
- `notion-mcp server stdio`
|
|
191
|
+
|
|
192
|
+
Raw API 是高级兜底入口,不应作为普通 page/database 编辑路径。
|
|
193
|
+
|
|
194
|
+
## 移除的旧入口
|
|
195
|
+
|
|
196
|
+
以下旧 root 命令不再作为公开 CLI 入口:
|
|
197
|
+
|
|
198
|
+
- `notion-mcp set-token`
|
|
199
|
+
- `notion-mcp set-user`
|
|
200
|
+
- `notion-mcp show`
|
|
201
|
+
- `notion-mcp run`
|
|
202
|
+
- `notion-mcp mcp serve`
|
|
203
|
+
|
|
204
|
+
配置使用 `notion-mcp config --global ...`;MCP server 使用 `notion-mcp server ...`。
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# Core API
|
|
2
|
+
|
|
3
|
+
本文档面向开发者,记录 `src/notion_mcp/core/` 当前已经实现的 Core 能力。Core 是唯一业务逻辑层,CLI 和 MCP Tool 都应调用 Core,而不是直接调用 Notion SDK。
|
|
4
|
+
|
|
5
|
+
## 配置
|
|
6
|
+
|
|
7
|
+
模块:`src/notion_mcp/core/config.py`
|
|
8
|
+
|
|
9
|
+
- `CoreConfig`
|
|
10
|
+
- 保存 `notion_token`、`user_name`、`user_id`、`notion_version`、`timeout_ms`、`retry`、`default_transport` 和 `audit_enabled`。
|
|
11
|
+
- `user_id` 必须是 UUID。
|
|
12
|
+
- 默认 `notion_version` 为 `2026-03-11`。
|
|
13
|
+
- `init_core_config(...)`
|
|
14
|
+
- 初始化配置并写入本地配置文件。
|
|
15
|
+
- 配置文件权限写为 `0600`。
|
|
16
|
+
- `load_core_config(...)`
|
|
17
|
+
- 读取配置文件并返回严格校验后的 `CoreConfig`。
|
|
18
|
+
- `update_core_config(...)`
|
|
19
|
+
- 只更新传入字段,不清空未传入字段。
|
|
20
|
+
- `redacted_config(...)`
|
|
21
|
+
- 返回状态输出使用的脱敏配置,不泄露 token。
|
|
22
|
+
|
|
23
|
+
## 错误模型
|
|
24
|
+
|
|
25
|
+
模块:`src/notion_mcp/core/errors.py`
|
|
26
|
+
|
|
27
|
+
- `CoreError`
|
|
28
|
+
- 所有 Core 错误的基类。
|
|
29
|
+
- `to_dict()` 返回 `type`、`code`、`message`、`details`。
|
|
30
|
+
- `ConfigNotFoundError`
|
|
31
|
+
- `ConfigValidationError`
|
|
32
|
+
- `NotionAuthError`
|
|
33
|
+
- `NotionOperationError`
|
|
34
|
+
|
|
35
|
+
CLI JSON 输出和 MCP tool 响应应复用这些错误结构。
|
|
36
|
+
|
|
37
|
+
## Notion SDK Client
|
|
38
|
+
|
|
39
|
+
模块:`src/notion_mcp/core/client.py`
|
|
40
|
+
|
|
41
|
+
- `NotionClientFactory`
|
|
42
|
+
- 从 `CoreConfig` 创建 Notion SDK client。
|
|
43
|
+
- 注入 `auth`、`notion_version`、`timeout_ms` 和 `retry`。
|
|
44
|
+
- 支持 `client_cls` 和 `fake_client`,用于测试和后续 MCP 场景测试。
|
|
45
|
+
- `create_notion_client(...)`
|
|
46
|
+
- 默认 client factory 入口。
|
|
47
|
+
|
|
48
|
+
## 认证
|
|
49
|
+
|
|
50
|
+
模块:`src/notion_mcp/core/auth.py`
|
|
51
|
+
|
|
52
|
+
- `AuthService.validate(...)`
|
|
53
|
+
- 调用 `client.users.me()` 校验 token。
|
|
54
|
+
- 可传入 `expected_user_id`,用于校验配置中的 Notion 用户 UUID 是否匹配当前 token。
|
|
55
|
+
- 返回 `AuthValidationResult`。
|
|
56
|
+
|
|
57
|
+
## 审计
|
|
58
|
+
|
|
59
|
+
模块:`src/notion_mcp/core/audit.py`
|
|
60
|
+
|
|
61
|
+
- `AuditRecorder.record(...)`
|
|
62
|
+
- 写入 JSONL 审计记录。
|
|
63
|
+
- 字段包含 `timestamp`、`configured_user_id`、`operation`、`target`、`dry_run` 和 `metadata`。
|
|
64
|
+
- 会移除 `notion_token`、`token`、`auth`、`authorization`、`bearer` 等敏感字段。
|
|
65
|
+
|
|
66
|
+
## Notion 对象域服务
|
|
67
|
+
|
|
68
|
+
目录:`src/notion_mcp/core/services/`
|
|
69
|
+
|
|
70
|
+
当前已按对象域建立服务模块:
|
|
71
|
+
|
|
72
|
+
- `blocks.py`
|
|
73
|
+
- `pages.py`
|
|
74
|
+
- `databases.py`
|
|
75
|
+
- `data_sources.py`
|
|
76
|
+
- `users.py`
|
|
77
|
+
- `comments.py`
|
|
78
|
+
- `views.py`
|
|
79
|
+
- `file_uploads.py`
|
|
80
|
+
- `search.py`
|
|
81
|
+
- `custom_emojis.py`
|
|
82
|
+
- `raw_api.py`
|
|
83
|
+
|
|
84
|
+
这些服务只依赖 Core 和 Notion SDK-compatible client,不导入 CLI 或 MCP 层。
|
|
85
|
+
|
|
86
|
+
## Raw API
|
|
87
|
+
|
|
88
|
+
模块:`src/notion_mcp/core/services/raw_api.py`
|
|
89
|
+
|
|
90
|
+
- `registered_operations()`
|
|
91
|
+
- 返回允许 pass-through 的 Notion SDK 操作名。
|
|
92
|
+
- `RawNotionService.invoke(operation, arguments)`
|
|
93
|
+
- 只允许调用登记表内的操作。
|
|
94
|
+
- 禁止未登记操作和私有属性。
|
|
95
|
+
- 用于补足 “支持 Notion SDK/API 公开能力” 的扩展入口。
|