Notion Terminal MCP
Allows Notion Custom Agents to execute terminal commands and manage files on the host machine through MCP tools.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Notion Terminal MCPlist the files in the workspace"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Notion Terminal MCP
An authenticated, production-ready remote Model Context Protocol (MCP) server providing Terminal Execution and Filesystem Tools to Notion Custom Agents, Claude, Cursor, and autonomous AI agents over Streamable HTTP.
Includes built-in zero-config public tunneling via the official Ngrok Node.js SDK (@ngrok/ngrok).
π ΠΠΎΠΊΡΠΌΠ΅Π½ΡΠ°ΡΠΈΡ Π½Π° ΡΡΡΡΠΊΠΎΠΌ ΡΠ·ΡΠΊΠ΅ Π΄ΠΎΡΡΡΠΏΠ½Π° Π² USER_GUIDE_RU.md. π€ Agent Specifications & JSON Schemas available in AGENTS.md.
Features
π₯οΈ Liquid Glass Desktop GUI App: Modern Electron + React desktop interface with system tray integration (hide from taskbar, background execution), live status cards, real-time audit log stream, one-click Notion credentials copy, and visual settings editor.
β‘ Streamable HTTP Transport: Modern MCP server implementation running on Express.
π Built-in Ngrok Tunnel: Expose your local MCP server to Notion with a single command (
npm run startornpm run dev) using@ngrok/ngrok.π» Terminal Execution: Execute PowerShell or cmd commands with configurable timeouts, working directories, and recursive process tree termination.
π Browser Automation: Launch host browsers (Chrome/Edge), navigate, execute arbitrary JavaScript, click elements, fill inputs, extract DOM text/HTML, and capture screenshots.
π Filesystem Operations: Full set of tools for reading, writing, moving, listing, statting, and deleting files and directories.
π Security & Sandboxing:
Sandboxed Mode (
FULL_ACCESS=false): Strict path containment inside a configuredFILES_ROOTwith path traversal defense.Full Host Mode (
FULL_ACCESS=true): Unrestricted access when you need full host automation.Timing-Safe Auth: Constant-time comparison (
crypto.timingSafeEqual) for Bearer tokens and API keys.Host Header Validation: Prevents DNS rebinding and unauthorized host header spoofing.
π€ Agent-First Design: Detailed specifications and JSON schemas optimized for AI models (AGENTS.md).
Related MCP server: Notion Cowork Bridge
Quick Start
1. Installation
Clone the repository and install dependencies:
git clone https://github.com/Speedstu/notion-terminal-mcp.git
cd notion-terminal-mcp
npm install2. Environment Setup
Copy .env.example to .env or run the setup script:
# Automated setup (generates a secure 32+ character API key)
.\setup.ps1Or manually:
Copy-Item .env.example .env
# Generate a secure token:
npm run tokenEdit your .env file:
# Required: Secure API Key for Notion
MCP_API_KEY=your_generated_32_char_api_key
PORT=3000
HOST=127.0.0.1
# Ngrok Public Tunnel (Optional but recommended for Notion)
NGROK_ENABLED=true
NGROK_AUTHTOKEN=your_ngrok_authtoken_here
NGROK_DOMAIN=your-static-name.ngrok-free.app
# Security & Sandboxing
FULL_ACCESS=false
FILES_ROOT=./workspace
ALLOWED_HOSTS=localhost:3000;127.0.0.1:3000;*.ngrok-free.app;*.ngrok.app;*.ngrok-free.dev3. Build & Run
# Build TypeScript
npm run build
# Start production server
npm run startFor development with hot reload:
npm run devWhen started with NGROK_ENABLED=true, the server will output connection details ready to paste into Notion:
============================================================
NOTION MCP AGENT CONNECTION READY
============================================================
URL to paste into Notion: https://your-domain.ngrok-free.app/mcp
Authentication Header:
Header Name: Authorization
Header Value: Bearer <your_token>
============================================================Alternative: Free Cloudflare Quick Tunnel (No Account Required)
If you don't have an Ngrok account, run:
.\start-public.ps1This PowerShell script automatically:
Downloads and validates the official Authenticode-signed
cloudflaredbinary intotools/.Compiles TypeScript (
npm run build).Starts the MCP server on
http://127.0.0.1:3000.Spawns an ephemeral Cloudflare tunnel (
https://<random-subdomain>.trycloudflare.com).Prints the ready-to-copy Notion endpoint (
https://<random>.trycloudflare.com/mcp) andAuthorizationheader.
Connecting to Notion Custom Agents
In Notion, open Settings & members β Connections (or open your Notion Custom Agent settings).
Add a new Custom MCP Connection.
Set Server URL to:
https://your-tunnel-url/mcp(e.g.,
https://your-domain.ngrok-free.app/mcporhttps://xyz.trycloudflare.com/mcp)Set Authentication:
Header Name:
AuthorizationHeader Value:
Bearer <YOUR_MCP_API_KEY>(or usex-api-key: <YOUR_MCP_API_KEY>)
Test the connection. Notion will automatically discover all 20 tools across terminal execution, filesystem operations, workspace navigation, and host browser automation.
Available MCP Tools (20 Tools)
See AGENTS.md for full JSON schemas, input parameters, response formats, and agent best practices.
π₯οΈ Terminal Execution
Tool | Description |
| Execute PowerShell or cmd.exe commands on the host with native UTF-8 encoding, configurable timeouts, custom |
π Filesystem Operations
Tool | Description |
| Search files by glob pattern ( |
| Safely replace an exact block of code or text in a file without rewriting the entire file. |
| Read file contents (UTF-8 text or Base64 binary) with offset pagination for large files. |
| Create, overwrite, or append content to files (automatically creates missing parent directories). |
| List directory contents recursively or flat with file sizes and directory metadata. |
| Inspect file/directory metadata (size, created/modified timestamps, permissions). |
| Create directories and any missing parent directories recursively. |
| Move or rename files and directories, with optional destination overwrite. |
| Permanently delete files or directories ( |
ποΈ Workspace Management
Tool | Description |
| Inspect the current active working directory and base |
| Switch the active working directory for subsequent commands and relative path resolution (e.g. switch to a project subdirectory). |
π Host Browser Automation
Tool | Description |
| Launch host browser (Google Chrome or Microsoft Edge) and navigate to a URL. Opens visible window by default ( |
| Navigate the active browser tab to a new URL with custom wait conditions ( |
| Execute arbitrary JavaScript expressions or async functions inside the page context and return the JSON result. |
| Click an element on the webpage matching a CSS selector. |
| Type text into an input or textarea element on the active page, with optional field clearing. |
| Extract rendered text, raw DOM HTML, or page title from the document or a specific CSS selector. |
| Capture full-page or viewport screenshots to a PNG file or return base64. |
| Close the active browser instance and all open tabs cleanly. |
Configuration Reference (.env)
Variable | Default | Description |
| required | Secret key for authentication (min 32 characters). |
|
| Port for the HTTP server. |
|
| Host address to bind to. |
|
| Enable/disable automatic ngrok tunnel creation on start. |
|
| Ngrok authtoken (optional if configured globally via ngrok CLI). |
|
| Static/custom ngrok domain (e.g. |
|
| Semicolon-separated list of allowed |
|
| When |
|
| Base directory for the sandbox when |
|
| Default timeout for terminal commands (2 minutes). |
|
| Max stdout/stderr capture size (1 MB). |
|
| Max file size read/write limit per request (10 MB). |
Project Structure
notion-terminal-mcp/
βββ desktop/ # Electron + React Liquid Glass Desktop GUI
β βββ index.html # Desktop app HTML entrypoint
β βββ src/
β βββ main/ # Electron main process (lifecycle, system tray, IPC)
β β βββ index.ts # BrowserWindow & tray menu initialization
β β βββ preload.ts # Context bridge IPC definitions
β β βββ server-manager.ts # Background MCP server runner & log parser
β βββ renderer/ # React + Tailwind CSS UI components
β βββ App.tsx # Liquid Glass UI state & layout
β βββ components/ # Notion card, controls, log viewer, settings modal
β βββ styles/ # Liquid glass visual styles & animations
βββ src/ # Headless MCP Server (Node.js / Express)
β βββ config.ts # Type-safe environment, defaults & validation
β βββ index.ts # Server CLI entry point & lifecycle
β βββ server.ts # Express HTTP server & MCP Streamable HTTP endpoint
β βββ middleware/
β β βββ auth.ts # Timing-safe token & API key authentication
β β βββ host.ts # Host header validation & DNS rebinding guard
β βββ tools/ # 20 MCP Tools
β β βββ browser.ts # Puppeteer-core browser automation manager
β β βββ command.ts # Process tree management & execution
β β βββ filesystem.ts # Sandboxed filesystem CRUD operations
β β βββ index.ts # MCP tool registrations
β β βββ types.ts # MCP result helpers & interfaces
β βββ tunnel/
β βββ ngrok.ts # Ngrok SDK manager & Notion connection banner
βββ AGENTS.md # Detailed AI Agent Specification & JSON schemas
βββ USER_GUIDE_RU.md # Comprehensive Russian documentation & guide
βββ electron-builder.yml # Windows packaging configuration (Portable + NSIS)
βββ package.json
βββ setup.ps1 # PowerShell initial environment setup script
βββ start-public.ps1 # Zero-config Cloudflare Quick Tunnel launcher
βββ tsconfig*.jsonNPM Scripts
npm run app:startβ Build and launch the Desktop GUI App (Electron + Liquid Glass UI) for local testing without packaging.npm run app:devβ Launch the Desktop App in live development mode with hot-reload (Vite + Electron).npm run package:portableβ Build a standalone Portable.exe(no installation required). Output:release/Notion Terminal MCP <version>.exe.npm run package:installerβ Build a Windows Setup/Installer.exe(NSIS wizard). Output:release/Notion Terminal MCP Setup <version>.exe.npm run package:exeβ Build both Portable and Installer executable packages at once.npm run buildβ Compile TypeScript server, Electron main/preload, and Vite React renderer.npm run startβ Run headless MCP server fromdist/index.js(CLI mode).npm run devβ Run headless MCP server withtsx watch(CLI dev mode).npm run checkβ Type-check all TypeScript configurations (server, desktop, electron).npm run tokenβ Generate a cryptographically secure random 32-byte hex token forMCP_API_KEY.
Packaging Executables (.exe)
When you need standalone Windows binaries (.exe), run:
Command | Target | Output in |
| Portable single executable |
|
| NSIS Setup Wizard (Start Menu & Desktop shortcuts) |
|
| Both targets (Portable + Installer) | Both files above |
npm run app:start only compiles TypeScript and runs Electron live in development/test mode. It does not create .exe files in release/. To generate .exe binaries, always use the npm run package:* commands.
Security Policy
Please review SECURITY.md for security considerations and vulnerability reporting guidelines.
This server cannot be deployed
Maintenance
Related MCP Connectors
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
Secure tunneling, reverse proxy and remote access for local applications.
Zero-setup MCP gateway securely connecting AI to your tools with authentication and workflows
- emisarOAuthdev.emisar
Let AI operate servers without SSH. Choose actions, approve risky changes, and audit every step.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables Notion AI to interact with local files, execute shell commands, and delegate complex tasks to local AI agents. Provides file operations, command execution, and task delegation capabilities for local workspace management.110MIT
- AlicenseNot gradedqualityAmaintenanceGives Notion Custom Agents real file tools and a real terminal over the Model Context Protocol, enabling them to read, edit, and run commands directly on the user's machine.1MIT
- AlicenseNot gradedqualityCmaintenanceEnables remote MCP clients like ChatGPT to run shell commands and manage files on your local machine via a Cloudflare tunnel, exposing tools for file operations, search, and task management.1MIT
- FlicenseNot gradedqualityCmaintenanceEnables remote access to local filesystem and Windows command execution through MCP-compatible clients like Notion AI, Claude, and Cursor via secure public tunnels with bearer authentication and proxy support.-