{"id":29813305,"url":"https://github.com/aryahadii/notion-mcp-server","last_synced_at":"2026-04-17T05:02:57.760Z","repository":{"id":306893683,"uuid":"1022053578","full_name":"aryahadii/notion-mcp-server","owner":"aryahadii","description":"Minimal MCP Server for Notion, using FastMCP","archived":false,"fork":false,"pushed_at":"2025-07-28T08:01:14.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-28T10:05:31.736Z","etag":null,"topics":["authentication","fastmcp","llm","llmtools","mcp","mcp-server","notion","python","server"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aryahadii.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-18T11:25:46.000Z","updated_at":"2025-07-28T08:01:18.000Z","dependencies_parsed_at":"2025-07-28T10:05:37.723Z","dependency_job_id":"bc10464a-fc1b-41a5-a5b8-4b90e82e1976","html_url":"https://github.com/aryahadii/notion-mcp-server","commit_stats":null,"previous_names":["aryahadii/notion-mcp-server"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/aryahadii/notion-mcp-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aryahadii%2Fnotion-mcp-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aryahadii%2Fnotion-mcp-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aryahadii%2Fnotion-mcp-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aryahadii%2Fnotion-mcp-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aryahadii","download_url":"https://codeload.github.com/aryahadii/notion-mcp-server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aryahadii%2Fnotion-mcp-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31915900,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T18:22:33.417Z","status":"online","status_checked_at":"2026-04-17T02:00:06.879Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["authentication","fastmcp","llm","llmtools","mcp","mcp-server","notion","python","server"],"created_at":"2025-07-28T19:00:33.961Z","updated_at":"2026-04-17T05:02:57.727Z","avatar_url":"https://github.com/aryahadii.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Notion MCP SSE Server\n\nA simple MCP (Model Context Protocol) server that provides read-only access to Notion pages via SSE (Server-Sent Events) transport using FastMCP.\n\n## Features\n\n- **Read-only access** to Notion pages and databases\n- **SSE transport** for real-time communication\n- **Bearer token authentication** for secure SSE endpoints\n- **Docker deployment** ready\n- **Simple configuration** via environment variables\n- **Comprehensive error handling** and logging\n\n## Available Resources\n\n- `notion://pages/{page_id}` - Get a specific page by ID\n- `notion://search/{query}` - Search for pages (use 'all' for all pages)\n- `notion://databases/{database_id}` - Get database information\n- `notion://databases/{database_id}/query/{page_size}` - Query database pages\n\n## Setup\n\n### 1. Notion Integration Setup\n\n1. Go to [https://www.notion.so/profile/integrations](https://www.notion.so/profile/integrations)\n2. Create a new internal integration or select an existing one\n3. Configure it as **read-only** by giving only \"Read content\" access\n4. Copy the integration token (starts with `ntn_`)\n5. Grant the integration access to the pages/databases you want to expose\n\n### 2. Environment Configuration\n\n1. Copy the example environment file:\n\n   ```bash\n   cp .env.example .env\n   ```\n\n2. Edit `.env` and add your Notion token and **base64-encoded** RSA keys for authentication:\n\n   ```env\n   NOTION_TOKEN=ntn_your_integration_token_here\n   RSA_PUBLIC_KEY=\"\u003cbase64-encoded-PEM-public-key\u003e\"\n   RSA_PRIVATE_KEY=\"\u003cbase64-encoded-PEM-private-key\u003e\"\n   HOST=127.0.0.1\n   PORT=8000\n   ```\n\n   \u003e **Important:** The keys **must be base64-encoded PEM strings**, not raw PEM. If you do not have base64-encoded keys, you can generate them as follows:\n   \u003e ```bash\n   \u003e # Generate private key\n   \u003e openssl genpkey -algorithm RSA -out private_key.pem -pkeyopt rsa_keygen_bits:2048\n   \u003e # Extract public key\n   \u003e openssl rsa -pubout -in private_key.pem -out public_key.pem\n   \u003e # Encode keys as base64 (remove newlines for .env compatibility)\n   \u003e base64 -w 0 private_key.pem \u003e private_key.b64\n   \u003e base64 -w 0 public_key.pem \u003e public_key.b64\n   \u003e ```\n   \u003e Then copy the contents of `private_key.b64` and `public_key.b64` into your `.env` as shown above.\n   \u003e\n   \u003e Alternatively, if you start the server or run `python generate_client_token.py` without the keys set, it will print out base64-encoded keys for you to copy into your `.env` file.\n\n\n   \u003e **Note:** For RSA key generation, you can use OpenSSL:\n   \u003e ```bash\n   \u003e # Generate private key\n   \u003e openssl genpkey -algorithm RSA -out private_key.pem -pkeyopt rsa_keygen_bits:2048\n   \u003e # Extract public key\n   \u003e openssl rsa -pubout -in private_key.pem -out public_key.pem\n   \u003e ```\n\n### 3. Installation \u0026 Running\n\n#### Option 1: Local Python\n\n```bash\n# Install dependencies\npip install -r requirements.txt\n\n# Run the server\nfastmcp run server.py -t sse\n```\n\n#### Option 2: Docker\n\n```bash\n# Build and run with Docker Compose\ndocker-compose up --build\n\n# Or build and run manually\ndocker build -t notion-mcp .\ndocker run -p 8000:8000 --env-file .env notion-mcp\n```\n\n## Usage\n\nOnce running, the server exposes a set of tools that can be used by any MCP-compatible client (e.g., an LLM agent for function-calling). The server listens for SSE connections at `http://localhost:8000/sse/` (or your configured host/port).\n\n### Available Tools\n\nThe following tools are available for interacting with Notion:\n\n- `get_page(page_id: str)`: Retrieves a Notion page and its content by its ID.\n- `search_pages(query: str, page_size: int = 10)`: Searches for pages in your Notion workspace.\n- `get_database(database_id: str)`: Retrieves information about a specific Notion database.\n- `query_database(database_id: str, page_size: int = 10)`: Queries a Notion database and returns its pages.\n\n## Authentication\n\nThis server implements Bearer token authentication for SSE endpoints using RSA key pairs:\n\n- **JWT Tokens**: Authentication uses JWT tokens signed with RS256 algorithm\n- **RSA Key Pairs**: Uses asymmetric cryptography for secure token validation\n- **Token Generation**: Includes a utility endpoint to generate tokens for testing\n\n### Using Authentication\n\n1. **Generate a token** using the `/generate_auth_token` endpoint:\n\n   ```bash\n   curl -X POST http://localhost:8000/generate_auth_token \\\n     -H \"Content-Type: application/json\" \\\n     -d '{\"subject\":\"user123\",\"scopes\":[\"read\"],\"expiry_seconds\":3600}'\n   ```\n\n2. **Use the token** in your SSE requests:\n\n   ```bash\n   curl -N http://localhost:8000/sse \\\n     -H \"Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...\"\n   ```\n\n### Testing Authentication\n\nA test script is included to verify authentication is working correctly:\n\n```bash\npython test_auth.py\n```\n\nThis will test both authenticated and unauthenticated requests to ensure the Bearer token authentication is functioning properly.\n\n## Security\n\n- This server provides **read-only** access to Notion\n- Bearer token authentication secures all SSE endpoints\n- Configure your Notion integration with minimal permissions\n- Use environment variables for sensitive configuration\n- The server only exposes data that your integration has access to\n\n## Dependencies\n\n- `fastmcp\u003e=2.0.0` - FastMCP framework for MCP server implementation\n- `notion-client\u003e=2.2.1` - Official Notion API Python client\n- `python-dotenv\u003e=1.0.0` - Environment variable management\n\n## License\n\nMIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faryahadii%2Fnotion-mcp-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faryahadii%2Fnotion-mcp-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faryahadii%2Fnotion-mcp-server/lists"}