notion-gate
Provides controlled access to Notion workspaces via internal integration tokens, with tools to search, fetch pages, query data sources, create/append/update pages, and trash pages under project-specific permission limits.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
notion-gate
Claude Code(또는 다른 MCP 클라이언트)가 프로젝트 폴더마다 정해진 Notion 워크스페이스에, 정해진 권한까지만 접근하게 하는 로컬 stdio MCP 서버.
상태: v0.1.0. 목 서버로만 테스트했다. 실제 Notion API 동작은 수동 검증 체크리스트로 확인해야 한다. Notion Labs와 관계없는 비공식 프로젝트다.
목차
Related MCP server: Notion MCP Server
1. 무엇인가, 왜 OAuth 호스팅 MCP가 아닌가
워크스페이스마다 내부 통합(internal integration) 토큰을 쓰고 Notion REST API를 직접 부른다. 역할별로 토큰을 나눌 수 있다(읽기 전용 / 읽기·쓰기).
프로젝트 폴더의
.notion-gate.json으로 "이 폴더에서는 어느 워크스페이스를 어떤 권한까지" 쓰는지 정한다. 사용자 설정의 상한을 좁히기만 할 수 있다.도구는 8개뿐이다. 영구 삭제·블록 삭제·본문 교체 도구는 없다.
공식 호스팅 Notion MCP(OAuth)는 연결 하나가 워크스페이스 하나이고, 팀이 계정 하나를 공유하면 "누가 어디에 어떤 권한으로" 붙었는지 나누기 어렵다. 호스팅 MCP 여러 개를 프록시하는 방식(예: multi-workspace-for-notion)도 있지만, notion-gate는 반대로 권한을 좁히는 것이 목적이라 토큰 capability와 프로젝트 정책을 직접 다룬다.
2. 위협 모델
gate는 보안 경계가 아니라 사고 방지 장치다. 진짜 경계는 Notion 토큰의 capability와 통합에 연결한 페이지 범위다. 기본은 읽기 전용 토큰을 쓴다. 자세한 내용은 SECURITY.md.
실효 권한 = min(사용자 상한, 프로젝트 요청, 선언한 토큰 능력). trash는 상한과 요청이 둘 다 trash일 때만 생긴다.
3. 설치
Node.js 20 이상(개발·테스트는 22 이상).
아직 npm에 게시하지 않았다. npm의
notion-gate라는 패키지를 설치하거나npx로 실행하지 마라. 이 저장소와 무관한 코드가 토큰이 있는 환경에서 실행될 수 있다. 지금은 소스에서 빌드해 쓴다.
git clone https://github.com/hkjbrian/notion-gate.git
cd notion-gate
npm ci && npm run build
npm link # 로컬 빌드를 notion-gate 명령으로 연결한다(레지스트리를 쓰지 않는다)npm에 게시한 뒤에도 npx -y notion-gate처럼 버전 없이 실행하지 않는다. 실행할 때마다 그 시점의 최신 코드를 받아 토큰이 있는 프로세스에서 실행하게 된다.
4. 통합 만들기와 페이지 연결
Notion → Settings → Connections(통합) → 새 내부 통합을 만든다.
역할별로 따로 만든다. 예:
team-ro(Read content만),team-rw(Read·Insert·Update content).쓰게 할 페이지에서
…→ Connections → 통합을 추가한다. 필요한 페이지만 연결한다.
5. setup
터미널(TTY)에서 실행한다. 토큰은 화면에 보이지 않게 입력받는다.
notion-gate setup team # 상한 read, 토큰 능력 read
notion-gate setup team-rw --max write --cap read_write # 상한이 read보다 크면 y/N 확인/users/me로 토큰을 확인하고 workspace_id·이름을 보여 준 뒤 OS 키링에 저장한다. 내부 통합(owner = workspace) 토큰만 받는다.
--cap은 사용자가 선언하는 값이다. API로 토큰 capability를 확인할 방법이 없어서다.
6. 사용자 설정, 프로젝트 .notion-gate.json, approve
사용자 설정: ~/.config/notion-gate/config.json(윈도우 %APPDATA%\notion-gate\config.json, XDG_CONFIG_HOME·NOTION_GATE_CONFIG_DIR로 바꿀 수 있음). setup이 관리한다.
프로젝트 파일(저장소 루트에 둔다, 커밋해도 된다 — 비밀이 없다):
{
"version": 1,
"default": "team",
"workspaces": {
"team": { "workspace_id": "…", "permission": "write", "write_parents": ["<부모 페이지 ID>"] }
}
}감지 순서:
CLAUDE_PROJECT_DIR→ MCP roots 첫 항목 → 작업 디렉터리. 거기서 위로 올라가며 처음 찾은 파일 하나만 쓴다..git이 있는 디렉터리, 홈, 루트에서 멈춘다(홈·루트의 파일은 읽지 않는다).파일이 없으면 모든 별칭이
read, 기본 별칭 없음(도구마다workspace인자 필요).read보다 큰 권한은 사람이 승인해야 생긴다:notion-gate approve(TTY 필요). 파일 내용이 바뀌면(SHA-256) 다시 승인할 때까지read로 강등된다.write_parents: 쓰기를 허용할 바로 위 부모 ID 목록. 생성은 부모 ID, 수정·휴지통·덧붙이기는 대상 페이지의 부모(또는 대상 자신)를 본다. 조상 재귀 검사는 하지 않는다: 목록에 넣은 페이지의 손자 페이지는 거부된다. 거기에 쓰려면 그 바로 위 부모를 목록에 직접 넣는다. 없으면 토큰이 닿는 모든 페이지.
예시: .notion-gate.example.json (trash는 꺼 둠).
7. OS별 MCP 등록
notion-gate install-mcp # 현재 OS용 명령을 출력만 한다
notion-gate install-mcp --os windows --version 0.1.0출력된 claude mcp add --scope user … 명령을 직접 실행한다. notion-gate는 Claude Code 설정을 건드리지 않는다.
윈도우에서 cmd /c 래퍼가 필요한지는 확인하지 못했다(docs/spike.md ⑨).
8. 도구와 권한 매트릭스
모든 도구는 workspace 인자(생략 시 프로젝트 기본 별칭)를 받는다.
도구 | 하는 일 | 필요 권한 | annotation |
| 별칭·권한·감지 근거 표(네트워크 없음) | 없음 | readOnly |
| 제목 검색. 제목·ID·URL·부모만 | read | readOnly |
| 속성 + 공식 | read | readOnly |
| data source 필터·정렬 조회. database ID면 data source가 하나일 때 자동 선택 | read | readOnly |
| 페이지·data source 아래 생성(write_parents 검사) | write | destructive: false |
| 블록 덧붙이기. 100블록 단위 순차 전송, 2,000자 분할 | write | destructive: false |
| 속성만 수정( | write | destructive: true |
|
| trash | destructive: true |
오류는 isError: true와 CODE: 메시지 형식이다. 예: PERMISSION_DENIED, UNAPPROVED_PROJECT, UNKNOWN_WORKSPACE, NO_DEFAULT_WORKSPACE, WORKSPACE_MISMATCH, PARENT_NOT_ALLOWED, TOKEN_MISSING, RATE_LIMITED, WRITE_UNCERTAIN, NOTION_<status>_<code>.
속도·재시도: 별칭마다 약 3 rps 큐. GET·search·query만 재시도(429/529/5xx, Retry-After 준수). 쓰기는 자동 재시도하지 않는다 — 네트워크 오류나 5xx로 끝나면 WRITE_UNCERTAIN을 돌려주니 대상을 다시 읽어 확인한다.
Notion-Version은 2026-03-11로 고정이다.
9. whoami 읽는 법
감지: env:CLAUDE_PROJECT_DIR /path/to/proj → /path/to/proj/.notion-gate.json
승인: 미승인
기본 별칭: team
별칭 workspace_id workspace_name owner 상한 요청 실효 토큰능력(선언)
team (기본) … Team A workspace write write read* read_write
* team: 프로젝트 파일 미승인 → write를 read로 강등(notion-gate approve)*는 실효 권한이 요청보다 낮다는 뜻이고 아래에 이유가 나온다.owner는 내부 통합이면 항상
workspace다. 토큰을 만든 사람이 누구인지는 API로 알 수 없어 표시하지 않는다.토큰 능력은 setup 때 선언한 값이다.
10. 감사 로그
~/.local/state/notion-gate/audit.jsonl(윈도우 %LOCALAPPDATA%\notion-gate\audit.jsonl, XDG_STATE_HOME·NOTION_GATE_STATE_DIR로 변경). whoami를 뺀 모든 도구 호출을 성공·거부·오류 모두 기록하고, 수정·휴지통 전에는 이전 제목·속성을 남긴다.
해시 체인으로 변조를 탐지만 한다(notion-gate whoami --verify-audit). 여러 Claude 세션이 동시에 쓰면 체인이 갈라질 수 있고 verify가 그 줄을 보고한다.
11. Claude Code 권장 설정
쓰기 도구는 자동 허용하지 않는다. 예를 들어 사용자 설정의 permissions에 다음처럼 둘 수 있다(notion-gate는 이 설정을 건드리지 않는다 — 안내만):
{
"permissions": {
"allow": ["mcp__notion-gate__whoami", "mcp__notion-gate__search", "mcp__notion-gate__fetch_page", "mcp__notion-gate__query_data_source"],
"deny": ["mcp__notion-gate__trash_page"]
}
}create_page·append·update_page는 allow에 넣지 말고 매번 확인받는다.
12. 문제 해결
리눅스 키링 오류(D-Bus/Secret Service 없음): gnome-keyring 등을 켜거나, 환경변수
NOTION_GATE_TOKEN_<ALIAS>(별칭 대문자,-는_:my-team→NOTION_GATE_TOKEN_MY_TEAM)를 쓰거나,config.json에"allow_file_secrets": true를 켜고 다시 setup.429: 읽기는 자동으로 기다렸다 재시도한다. 쓰기는
RATE_LIMITED로 끝나니 잠시 뒤 다시 한다.UNAPPROVED_PROJECT: 터미널에서notion-gate approve.TOKEN_MISSING:notion-gate setup <별칭>. 로그는 stderr에 나오며NOTION_GATE_LOG_LEVEL=debug로 자세히 볼 수 있다.키링을 아예 쓰지 않으려면
NOTION_GATE_DISABLE_KEYRING=1.
13. 비밀 스캔
저장소에 토큰이 들어가지 않게 gitleaks 등을 pre-commit이나 CI에 둔다. 이 저장소 CI도 ntn_…/secret_… 패턴을 grep한다. 테스트의 가짜 토큰은 ntn_TEST_… 형태다.
개발
npm ci
npm run build && npm testM0 조사 결과: docs/spike.md. 실제 API 검증 항목: docs/manual-checklist.md.
라이선스
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Hosted Notion MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Hosted MCP for Google Workspace, Atlassian and Notion: one OAuth, per-user accounts, write access.
Your team's Claude on company Calendar and Drive: admins grant each action, every call is logged.
Let Claude or Cursor pay for MCP tools under hard caps, with Approve or Decline on every pay.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables interaction with Notion workspaces, allowing users to search, query databases, create/update pages, and manage content via natural language through MCP.-
- AlicenseAqualityCmaintenanceEnables Claude to interact with Notion workspaces, including searching, reading, creating, and editing pages and databases, as well as managing comments and users.12MIT
- AlicenseBqualityCmaintenanceEnables AI assistants to interact with Notion workspaces through MCP, supporting database queries, page creation, web searches, and agent workflows with human-in-the-loop task approval.5MIT
- AlicenseNot gradedqualityAmaintenanceEnables MCP clients such as Claude, Cursor and ChatGPT to read and write in Notion using a single token, covering search, page creation and editing, database queries, comments and file uploads through natural language. It also supports headless use in automation and CI, with batched, idempotent writes and compact context cost.6,999 npmMIT