Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NppMCP — MCP Server for Nextpad++ (macOS)

An MCP (Model Context Protocol) server that exposes the live editor to AI coding agents (Claude Code, Cursor, VS Code, Windsurf, …). Agents can see the document you are actually editing — including unsaved edits — rather than just files on disk.

The server is a small HTTP listener bound to 127.0.0.1 only, authenticated with a per-install Bearer token. Phase 1 is read-only.

Tools (Phase 1)

Tool Returns
get_status server / host / plugin status, port, read-only flag, tool count
get_active_document path (or untitled), buffer id, language, EOL, dirty flag, length, caret, selection
get_selection the currently selected text
get_text the live document text (optionally a 1-based line range)
get_caret_context the lines around the caret
list_open_documents the open, saved files across both views, with the active one flagged
find_in_document matches (line, column, line text) for a literal or regex query

Using it

Open Plugins → MCP Server → Show MCP Server Panel (or click the toolbar button). Press Start, then use one of the Copy client setup buttons to put a ready-to-paste config on your clipboard. For Claude Code:

claude mcp add --transport http nextpad http://127.0.0.1:52700/mcp \
  --header "Authorization: Bearer <token>"

Requests appear live in the panel's activity log. The port, token, read-only mode, and "start on launch" are configurable in the panel and persisted to NppMcpServer.ini in the plugin config dir (token stored 0600).

Security

  • Binds 127.0.0.1 only — never reachable from the network.
  • Every request requires Authorization: Bearer <token> (constant-time compare).
  • Browser Origin headers that aren't localhost are rejected (DNS-rebinding guard).
  • Read-only by default; no code execution.

Build

cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j$(sysctl -n hw.ncpu)
cmake --install build     # → ~/Library/Application Support/Nextpad++/plugins/NppMCP/

Produces a universal (arm64 + x86_64) dylib, deployment target macOS 11.

test/harness_main.mm is a standalone transport/auth/JSON-RPC regression harness that links only NppMcpServer.mm + Foundation (no editor needed).

About

MCP server plugin (AI-agent control) for Nextpad++ (GTK4 Linux)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages