npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

dingdoc-writer-mcp

v0.1.9

Published

A local stdio MCP server that writes plain text into DingTalk docs through the locally logged-in Google Chrome session on macOS.

Readme

DingDoc Writer MCP

一个本地 stdio MCP 服务,用你本机已登录的 Google Chrome 向钉钉文档写入纯文本。

它不需要 Playwright,也不依赖浏览器扩展。服务端通过 macOS 的 osascript 控制 Chrome,把页面内的写入脚本注入到钉钉文档页,再走编辑器自身的输入链路完成写入。

能力

  • 向指定钉钉文档追加或插入纯文本
  • 清空指定钉钉文档当前正文内容
  • 保留换行
  • 支持写到正文开头、正文末尾、当前光标处
  • 列出当前已打开的钉钉文档标签页
  • 读取当前激活的钉钉文档标签页信息

前置条件

  • macOS
  • 已安装 Google Chrome.app
  • Chrome 里已经登录钉钉文档,并且对目标文档有编辑权限
  • 运行 MCP 的宿主应用有权限通过“自动化”控制 Chrome

第一次实际调用写入工具时,macOS 可能会弹权限框,请允许。

本地启动

cd dingdoc-writer-mcp
node ./server.mjs

npm 包结构

这个目录现在已经是标准 npm 包结构:

  • 可执行入口:bin.dingdoc-writer-mcp -> ./server.mjs
  • 打包白名单:files
  • Node 版本约束:engines.node
  • 可用 npm pack / npm publish

本地验证打包:

npm pack --dry-run

发布到 npm 后,其他 agent 的配置可以直接写成:

{
  "mcpServers": {
    "dingdoc-writer": {
      "command": "npx",
      "args": ["-y", "dingdoc-writer-mcp"]
    }
  }
}

MCP 配置示例

1. 本地源码方式

如果你是直接从源码目录运行:

{
  "mcpServers": {
    "dingdoc-writer": {
      "command": "node",
      "args": ["/absolute/path/to/dingdoc-writer-mcp/server.mjs"]
    }
  }
}

2. npm 包方式

参考 mcp.example.json。发布到 npm 后,可直接写成:

{
  "mcpServers": {
    "dingdoc-writer": {
      "command": "npx",
      "args": ["-y", "dingdoc-writer-mcp"]
    }
  }
}

3. 全局安装后的推荐 JSON 配置

如果目标机器已经全局安装了这个包,推荐直接使用 node + server.mjs 绝对路径,通常会比 npx 更稳定:

{
  "mcpServers": {
    "dingdoc-writer": {
      "command": "/opt/homebrew/opt/node@22/bin/node",
      "args": ["/opt/homebrew/lib/node_modules/dingdoc-writer-mcp/server.mjs"],
      "startup_timeout_sec": 60
    }
  }
}

4. 使用 npx 的通用 JSON 配置

如果目标机器没有全局安装,也可以直接使用带版本的 npx 配置:

{
  "mcpServers": {
    "dingdoc-writer": {
      "command": "npx",
      "args": ["-y", "[email protected]"],
      "startup_timeout_sec": 60
    }
  }
}

Tools

write_dingdoc_text

向钉钉文档写入纯文本。

参数:

  • url?: string 不传时,要求当前激活的 Chrome 标签页已经是目标钉钉文档。
  • text: string
  • position?: "start" | "end" | "cursor" 当前稳定支持 start 和 cursor
  • open_in_new_tab?: boolean 默认 true
  • timeout_ms?: number 默认 60000

select_dingdoc_text

进入钉钉文档编辑状态后执行两次全选。

参数:

  • url?: string 不传时,要求当前激活的 Chrome 标签页已经是目标钉钉文档。
  • open_in_new_tab?: boolean 默认 true
  • timeout_ms?: number 默认 60000

行为:

  • 先尝试让编辑器进入可输入状态
  • 默认会先走两次 Tab 的聚焦流程
  • 再执行两次 Ctrl+A

copy_dingdoc_text

进入钉钉文档编辑状态后全选并复制。

参数:

  • url?: string 不传时,要求当前激活的 Chrome 标签页已经是目标钉钉文档。
  • open_in_new_tab?: boolean 默认 true
  • timeout_ms?: number 默认 60000

行为:

  • 先尝试让编辑器进入可输入状态
  • 默认会先走两次 Tab 的聚焦流程
  • 再执行两次 Ctrl+A
  • 最后执行一次 Ctrl+C

paste_dingdoc_clipboard_text

清空钉钉文档正文后,直接粘贴当前系统剪贴板内容。

参数:

  • url?: string 不传时,要求当前激活的 Chrome 标签页已经是目标钉钉文档。
  • open_in_new_tab?: boolean 默认 true
  • timeout_ms?: number 默认 60000

行为:

  • 先尝试让编辑器进入可输入状态
  • 清空正文
  • 再执行一次系统粘贴

clear_dingdoc_text

清空钉钉文档正文。

参数:

  • url?: string 不传时,要求当前激活的 Chrome 标签页已经是目标钉钉文档。
  • open_in_new_tab?: boolean 默认 true
  • timeout_ms?: number 默认 60000

行为:

  • 先尝试让编辑器进入可输入状态
  • 再执行两次全选
  • 最后发送删除键

get_active_dingdoc_tab

返回当前激活的 Chrome 标签页信息;如果当前标签页不是钉钉文档会报错。

list_open_dingdoc_tabs

列出当前已打开的钉钉文档标签页。

限制

  • 当前实现写入的是纯文本,不保留富文本样式
  • 只针对普通钉钉文档编辑器,暂不支持表格、白板、表单、AI Table
  • 写入依赖 Chrome 当前用户态;如果你切换了账号,MCP 也会跟着用那个账号
  • position="end" 目前在 Chrome AppleScript 模式下还不稳定;建议手动放好光标后使用 cursor
  • npm registry 上当前公开版本是 0.1.6;当前仓库版本是 0.1.9

安装前置条件

  • macOS
  • 已安装 Google Chrome
  • Chrome 已登录钉钉文档
  • Chrome 已开启:显示 > 开发者 > 允许 Apple 事件中的 JavaScript