Piper Morgan’s Notion integration provides seamless knowledge management through MCP+Spatial Intelligence architecture, enabling natural interaction with your Notion workspace.
Create Notion Integration
secret_)Environment Setup
# Add to .env file
NOTION_API_KEY=secret_your_integration_token
NOTION_WORKSPACE_ID=your_workspace_id # Optional
Grant Access
python cli/commands/notion.py status
Shows configuration status, connection state, and setup instructions.
python cli/commands/notion.py test
Validates API key and tests live connection to Notion workspace.
python cli/commands/notion.py search --query "project requirements"
Search across your Notion workspace for relevant content.
python cli/commands/notion.py pages
Display up to 20 pages from your Notion workspace with titles, IDs, and URLs.
python cli/commands/notion.py create "Page Title"
Create a new page with the specified title. Optionally specify a parent page:
python cli/commands/notion.py create "Page Title" --parent-id "parent-page-id"
If no parent is specified, the system will automatically select the first available page as the parent.
NotionMCPAdapter (services/integrations/mcp/notion_adapter.py)
connect(), get_current_user(), search(), create_page(), get_page(), list_pages()NotionSpatialIntelligence (services/intelligence/spatial/notion_spatial.py)
NotionCanonicalQueryEngine (services/features/notion_queries.py)
NotionConfig (config/notion_config.py)
# Automatic enhancement of queries with Notion context
from services.features.notion_queries import enhance_with_notion_intelligence
result = await enhance_with_notion_intelligence(
intent=user_intent,
session_id=session.id,
canonical_handlers=handlers
)
# Run Notion integration tests
PYTHONPATH=. python -m pytest tests/features/test_notion_integration.py -v
PYTHONPATH=. python -m pytest tests/features/test_notion_spatial_integration.py -v
The CLI supports full CRUD operations for comprehensive testing:
# Full CRUD cycle test
python cli/commands/notion.py status # Verify connection
python cli/commands/notion.py pages # List existing pages
python cli/commands/notion.py search --query "test" # Search content
python cli/commands/notion.py create "Test Page" # Create new page
python cli/commands/notion.py search --query "Test Page" # Verify creation
“NOTION_API_KEY not set”
.envsecret_“Connection test failed”
“No pages found”
“Failed to create page”
The Notion integration is fully functional with complete CRUD operations:
Status: ✅ Complete (October 15, 2025)
Piper Morgan’s Notion integration has been upgraded to Notion API version 2025-09-03, which introduces important changes to how databases and data sources are handled.
Notion API 2025-09-03 separates the concepts of “databases” and “data sources”:
This enables databases to combine multiple data sources, but requires using data_source_id instead of database_id for certain operations.
Good news: The upgrade is completely automatic! The integration handles data_source_id behind the scenes:
data_source_id from the database metadatadatabase_id format for backward compatibilitydata_source_id)database_id)SDK Version: notion-client==2.5.0 (upgraded from 2.2.1)
API Version Header: All requests include Notion-Version: 2025-09-03
Implementation:
get_data_source_id() - Fetches primary data source for a databasecreate_database_item() - Uses data_source_id automaticallyFor more details, see:
To verify the upgrade is working:
# Check SDK version
pip show notion-client
# Should show: Version: 2.5.0
# Test database operations
python cli/commands/notion.py test
# Should succeed with no errors
For issues or questions:
tests/features/python cli/commands/notion.py status for diagnostics