Skip to main content
Glama
sandraschi

Notepad++ MCP Server

by sandraschi

Notepad++ MCP 服务器

FastMCP Version Ruff Linted with Biome Built with Just

CI Release Python FastMCP License: MIT Version

用于 WindowsNotepad++ 的 MCP 服务器。使用 FastMCP 3.1.0,包含组合工具(更少的工具,相同的覆盖范围)、可选的 HTTP 网桥采样(兼容 Ollama 的 HTTP 或客户端 LLM)、提示词skill:// 资源以及 Agentic(代理) 工作流。

编辑器与本仓库的区别: Notepad++ 自身的优势(Scintilla、插件、宏、会话等)与本 MCP 暴露的功能是分开的。请参阅 docs/EDITOR_AND_MCP_SCOPE.md 以获取清晰的划分和更全面的编辑器端概述。


要求

项目

说明

操作系统

Windows 10/11 (64-bit)

编辑器

已安装 Notepad++ 8+

Python

3.12+ (pyproject.toml 中的 requires-python)

API

pywin32 (在 Windows 上自动拉取)


Related MCP server: Windows Automation MCP Server

安装

推荐: uv

从本仓库克隆:

git clone https://github.com/sandraschi/notepadpp-mcp.git
Set-Location notepadpp-mcp
uv sync
uv run notepadpp-mcp --help

或者以可编辑模式安装该包:

uv pip install -e ".[dev]"

当包发布到 PyPI 后,你可以运行:

uvx notepadpp-mcp

使用

服务器运行方式

发布的控制台脚本为 notepadpp-mcp (pyproject.toml 中的 notepadpp_mcp.server:run)。

  • 默认 stdio: 大多数 MCP 宿主(Claude Desktop, Cursor 等)使用的方式。无需额外标志。

  • 可选 HTTP 网桥:127.0.0.1 上运行 FastAPI + uvicorn,MCP HTTP 位于 /mcp

notepadpp-mcp --http --port 10815

如果 10815 端口被占用,请更改 --port(如果你使用一组 MCP Web 应用,请参阅中央端口注册表)。

MCP 客户端配置

Claude Desktop (claude_desktop_config.json):将 command/args 指向你的安装路径。以下是使用固定仓库路径下的 uv 的示例:

{
  "mcpServers": {
    "notepadpp-mcp": {
      "command": "uv",
      "args": ["run", "--directory", "D:/Dev/repos/notepadpp-mcp", "notepadpp-mcp"]
    }
  }
}

如果 notepadpp-mcpPATH 中:

{
  "mcpServers": {
    "notepadpp-mcp": {
      "command": "notepadpp-mcp",
      "args": []
    }
  }
}

旧版: 旧文档引用了 python -m notepadpp_mcp.tools.server。除非你在调试该模块,否则请优先使用 notepadpp-mcp

调用工具(概念)

助手通过名称调用 MCP 工具;你不需要在 PowerShell 中运行这些工具。以下是组合工具中 操作 的示例:

工具

典型的 operation

file_ops

open, new, save, info

text_ops

insert, find

status_ops

help, system_status, health_check

tab_ops

list, switch, close

session_ops

save, load, list

linting_ops

python, javascript, json, markdown

display_ops

fix_invisible_text, fix_display_issue

plugin_ops

discover, install, list, execute

此外:suggest_notepad_planagentic_notepad_workflow(编排),具体取决于构建版本。

会话快照 (session_ops)

  • save:复制 Notepad++ 的实时 session.xml(通常为 %APPDATA%\Notepad++\session.xml,其中列出了 所有打开的缓冲区),并将其保存为 %APPDATA%\Notepad++\notepadpp-mcp-sessions\** 下的命名文件。格式与 Notepad++ 用于 **加载会话** / **-openSession 的格式一致。如果实时文件丢失或未列出任何文件,服务器将回退到由 活动标签页 路径构建的 最小会话(前提是该路径在磁盘上存在)。

  • load:运行 notepad++.exe -openSession "<saved.xml>"。是打开 新实例 还是 现有实例 取决于你在 Notepad++ 中的 多实例 设置。

  • 覆盖项NOTEPADPP_SESSION_STORAGE_DIR(存储命名 *.xml 的位置),NOTEPADPP_LIVE_SESSION_XML(覆盖实时 session.xml 的路径,例如便携版或 -settingsDir 布局)。

采样(用于工作流的 LLM)

可选。按照服务器 / NotepadSamplingHandler 中的文档设置环境变量,例如:

  • NOTEPADPP_SAMPLING_BASE_URL:兼容 OpenAI 的基础 URL(例如 Ollama http://127.0.0.1:11434/v1

  • NOTEPADPP_SAMPLING_MODEL

  • NOTEPADPP_SAMPLING_USE_CLIENT_LLM:在支持的情况下让 MCP 宿主运行采样


工具概述(组合工具)

工具

用途

file_ops

打开、新建、保存、文件信息

text_ops

在缓冲区中插入/查找

status_ops

帮助、系统状态、健康检查

tab_ops

列出/切换/关闭标签页

session_ops

保存/加载/列出工作区会话

linting_ops

Python, JS, JSON, Markdown(可用时使用 PATH 中的 ruff / eslint

display_ops

不可见文本 / 显示故障

plugin_ops

发现/安装/列出/执行插件

响应使用一致的字典结构:successmessagesummary,以及相关的 error / recovery_options


仓库中的文档

  • docs/EDITOR_AND_MCP_SCOPE.mdNotepad++ (编辑器) 与本服务器:编辑器的优势,MCP 网桥的边界

  • docs/NOTEPADPP_MACROS.md(人们的使用场景,shortcuts.xml,精选集 / 未来工具构想)

  • src/notepadpp_mcp/docs/:API 说明,示例,PRD(如有)

  • src/notepadpp_mcp/docs_manifest.py:Web 网桥的 REST/MCP 概述(启用时)


开发

uv pip install -e ".[dev]"
uv run pytest src/notepadpp_mcp/tests/
uv run ruff check src/notepadpp_mcp tests
uv run ruff format src/notepadpp_mcp tests

可选:如果存在 demonstration_test.py 或项目 dev.py,可用于集成冒烟测试。


路线图 / 待办事项 (扩展)

已计划或开放的工作,欢迎贡献者参与:

  • [ ] 多实例 / 多窗口:当打开多个 Notepad++ 时,针对特定的 HWND

  • [ ] 更丰富的插件流:协调的多插件步骤,来自插件管理器的更好错误界面

  • [ ] Linting:HTML/CSS,可选的 linter 配置文件

  • [ ] 配置档案:服务器端默认值(路径、超时、自动启动)

  • [ ] 批处理:具有进度报告的一流批处理文件操作

  • [ ] Web UI:使文档与实际仪表板包(例如 web_sota/)和端口保持一致

  • [ ] 测试 / 覆盖率:提高覆盖率;保持 Windows 运行器上的 CI 绿色

  • [ ] :仓库内的精选 XML 片段;可选的 %APPDATA%\Notepad++\shortcuts.xml 读取/列出/合并(参见 docs/NOTEPADPP_MACROS.md

旧的变更日志要点(多实例、插件分析等)在仍然适用的情况下已合并到上述列表中。


故障排除

  • 找不到 Notepad++:安装 Notepad++,启动一次,或者如果你的构建版本支持,启用自动启动行为。

  • Windows API 不可用:使用 Windows;在与服务器相同的环境中安装 pywin32

  • 客户端中缺少工具:重启宿主,检查 MCP 日志,确认 notepadpp-mcp 在终端中运行且无错误。

  • 会话保存为空 / 失败:Notepad++ 可能在打开已保存文件或 重启 编辑器之前不会刷新 session.xml;确保 设置 > 首选项 > 备份 中的会话行为符合你的预期。对于便携版安装,请将 NOTEPADPP_LIVE_SESSION_XML 设置为正确的 session.xml


变更日志 (简要)

  • 0.2.xsession_ops 持久化命名会话:复制实时 session.xml,通过 -openSession 加载(参见 README 中的 会话快照 部分)。

  • 0.2.0:FastMCP 3.1.0,采样,技能,提示词,代理工作流,HTTP 网桥 + server.py 中实现的 Web 钩子。

  • 更早版本:组合工具整合,Linting 和插件工具。


🛡️ 工业级技术栈

本项目遵循 SOTA 14.1 工业标准,用于高保真代理编排:

  • Python (核心):使用 Ruff 进行 Linting 和格式化。核心处理程序中对 print 语句零容忍 (T201)。

  • Webapp (UI):使用 Biome 进行亚毫秒级 Linting。严格执行 noConsoleLog

  • 协议合规性:强化 stdout/stderr 隔离,确保抗崩溃的 JSON-RPC 通信。

  • 自动化:所有舰队操作的 Justfile 配方(just lint, just fix, just dev)。

  • 安全性:通过 banditsafety 进行自动化审计。

许可证

MIT - 参见 LICENSE

A
license - permissive license
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • F
    license
    A
    quality
    F
    maintenance
    Enables Excel file manipulation through Microsoft's official COM automation interface using xlwings, designed for corporate environments where security policies prevent direct file access. Provides 25 tools for workbook operations, data manipulation, formatting, charts, pivot tables, and worksheet management through native Excel integration.
    2
    29
    9
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables comprehensive Windows desktop automation including screen capture, OCR text extraction, mouse/keyboard control, window management, process control, and clipboard operations through 25+ tools for AI agents.
    3
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    Provides essential developer tools for workspace management, including advanced file searching, project structure analysis, and batch code editing. It enables users to efficiently navigate, analyze, and modify source code within their development environment.
    7
    56
    MIT

View all related MCP servers

Related MCP Connectors

  • Control Unreal Engine to browse assets, import content, and manage levels and sequences. Automate…

  • AI access to your aNotepad online notes: read, search, write, and organize via 22 tools.

  • Streamline your workflow with Felix. Integrate it into your workspace and tailor its behavior to y…

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/sandraschi/notepadpp-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server