|
| 1 | +# Config-based Agent Sample - MCP Toolset with Notion MCP Server |
| 2 | + |
| 3 | +This sample demonstrates how to configure an ADK agent to use the Notion MCP server for interacting with Notion pages and databases. |
| 4 | + |
| 5 | +## Setup Instructions |
| 6 | + |
| 7 | +### 1. Create a Notion Integration |
| 8 | + |
| 9 | +1. Go to [Notion Integrations](https://www.notion.so/my-integrations) |
| 10 | +2. Click "New integration" |
| 11 | +3. Give it a name and select your workspace |
| 12 | +4. Copy the "Internal Integration Secret" (starts with `ntn_`) |
| 13 | + |
| 14 | +For detailed setup instructions, see the [Notion MCP Server documentation](https://www.npmjs.com/package/@notionhq/notion-mcp-server). |
| 15 | + |
| 16 | +### 2. Configure the Agent |
| 17 | + |
| 18 | +Replace `<your_notion_token>` in `root_agent.yaml` with your actual Notion integration token: |
| 19 | + |
| 20 | +```yaml |
| 21 | +env: |
| 22 | + OPENAPI_MCP_HEADERS: '{"Authorization": "Bearer secret_your_actual_token_here", "Notion-Version": "2022-06-28"}' |
| 23 | +``` |
| 24 | +
|
| 25 | +### 3. Grant Integration Access |
| 26 | +
|
| 27 | +**Important**: After creating the integration, you must grant it access to specific pages and databases: |
| 28 | +
|
| 29 | +1. Go to `Access` tab in [Notion Integrations](https://www.notion.so/my-integrations) page |
| 30 | +2. Click "Edit access" |
| 31 | +3. Add pages or databases as needed |
| 32 | + |
| 33 | +### 4. Run the Agent |
| 34 | + |
| 35 | +Use the `adk web` to run the agent and interact with your Notion workspace. |
| 36 | + |
| 37 | +## Example Queries |
| 38 | + |
| 39 | +- "What can you do for me?" |
| 40 | +- "Search for 'project' in my pages" |
| 41 | +- "Create a new page called 'Meeting Notes'" |
| 42 | +- "List all my databases" |
| 43 | + |
| 44 | +## Troubleshooting |
| 45 | + |
| 46 | +- If you get "Unauthorized" errors, check that your token is correct |
| 47 | +- If you get "Object not found" errors, ensure you've granted the integration access to the specific pages/databases |
| 48 | +- Make sure the Notion API version in the headers matches what the MCP server expects |
0 commit comments