Skip to main content
Glama

shareone-mcp

面向「数据提交」的无状态 Model Context Protocol 服务:把 ShareOne 的文本页 / 二进制 / 远程源 / 元数据更新封装成 4 个 MCP 工具,并附带可被 npx skills 发现的 Agent Skill。

基于 TypeScript + @modelcontextprotocol/sdk + Zod + Express,Node.js 20+,使用原生 fetch / Buffer,内存优先,不引入 Sudowork 代理、交互式绑定、二维码或评论监听。

npm 包:@online2311/shareone-mcp

安装

1) MCP(推荐:npx)

在 Cursor / Claude Desktop / 其他 MCP 客户端的配置里:

{
  "mcpServers": {
    "shareone": {
      "command": "npx",
      "args": ["-y", "@online2311/shareone-mcp"],
      "env": {
        "SHAREONE_API_KEY": "your_api_key_here"
      }
    }
  }
}

Cursor 也可显式加上 "type": "stdio"。默认传输为 stdio;仅在需要 HTTP 时设置 MCP_TRANSPORT=http。

可选环境变量:SHAREONE_BASE_URL(默认 https://s.shareone.vip)。

2) Agent Skill(npx skills add)

仓库布局符合 Vercel skills CLI:skills/shareone-mcp/SKILL.md(frontmatter 含 name / description)。

# 从 GitHub(合并到 main 后)
npx skills add online2311/shareone-mcp

# 指定 skill / agent / 非交互
npx skills add online2311/shareone-mcp --skill shareone-mcp -a cursor -y

# 全局安装
npx skills add online2311/shareone-mcp -g --skill shareone-mcp -y

也支持本地路径:npx skills add ./path/to/shareone-mcp --skill shareone-mcp -a cursor -y。

3) 两者配合

  1. 用上面的 mcp.json 拉起 @online2311/shareone-mcp,并设置 SHAREONE_API_KEY。

  2. 用 npx skills add online2311/shareone-mcp 把使用指引装进 Agent。

  3. Agent 按 skill 路由意图,实际动作走 MCP 的 4 个 tools;也可读取 MCP prompt shareone_usage 或 resource shareone://docs/skill。

Related MCP server: Share HTML

工具

工具

作用

shareone_submit_data

文本/页面通道 POST/PUT /api/v1/pages(format: html / markdown / text / json)

shareone_submit_binary

二进制三段式上传(credential → 直传 → confirm),必要时 multipart 回退

shareone_submit_remote_source

remote_url 创建/更新,或 refresh_only 刷新已绑定分享

shareone_update_metadata

更新密码 / 水印 / slug / 开关;auto 路由可回退到 files

另暴露:

  • Prompt:shareone_usage

  • Resource:shareone://docs/skill(与 skills/shareone-mcp/SKILL.md 同文)

环境变量

变量

说明

默认

SHAREONE_API_KEY

ShareOne API Key(请求头 X-API-Key)

必填(调用工具时)

SHAREONE_BASE_URL

API 根地址

https://s.shareone.vip

MCP_TRANSPORT

stdio 或 http

stdio

MCP_BIND_HOST

HTTP 绑定地址

127.0.0.1

MCP_PORT

HTTP 端口

3100

MCP_AUTH_TOKEN

可选;设置后 /mcp 需要 Authorization: Bearer <token>

空

stdio 传输的读缓冲默认提高到 24 MiB(SDK 默认 10 MiB),以便略超 16 MiB 的页面提交能返回 PAYLOAD_TOO_LARGE,而不是直接断开连接。

快速开始(开发)

cp .env.example .env
# 编辑 .env,填入 SHAREONE_API_KEY

npm install
npm run build
npm test

# stdio(默认)
SHAREONE_API_KEY=... npm start

# HTTP
MCP_TRANSPORT=http SHAREONE_API_KEY=... npm run start:http

HTTP 模式

  • 监听:POST http://127.0.0.1:3100/mcp

  • express.json limit:25mb

  • 无状态:每个请求新建 McpServer + StreamableHTTPServerTransport(sessionIdGenerator: undefined)

curl -sS http://127.0.0.1:3100/healthz

协议要点(已对照 sudoprivacy/shareone-skill)

  • 鉴权头:X-API-Key

  • 页面正文字段名:html_content(不是 content / html)

  • 自定义短链字段:custom_slug

  • 文本页扩展:.html / .md / .txt,UTF-8 最大 16 MiB

  • 新建页默认 allow_comments: false(与 skill 脚本一致)

  • 二进制:POST /api/v1/files/credential → azure PUT(x-ms-blob-type: BlockBlob)或 s3 multipart POST → POST /api/v1/files/confirm

  • 有 Idempotency-Key,或直传返回 400 且包含 Direct upload is only supported... 时,回退 POST /api/v1/files multipart

  • 远程刷新:POST /api/v1/pages/{share_id}/refresh

  • 元数据:先 pages;404 或 skill 中的 400「only for HTML/Markdown…」时回退 /api/v1/files/{share_id}

  • 工具失败:isError: true,并原样透传 ShareOne JSON 错误体(含 error_code / detail)

与完整 skill 默认值的差异

项

sudoprivacy/shareone-skill

本服务

默认 SHAREONE_BASE_URL

https://shareone.app

https://s.shareone.vip

能力面

发布/下载/评论/账号/协作者/二维码等

仅数据提交四通道 + 元数据

元数据回退

已知前缀策略

auto:page/裸 ref 先 pages,404 或 400 文案再回退 files

开发

npm run typecheck
npm test
npm run build

测试使用 mock fetch,不发起真实线上调用。

真实 API 冒烟测试

npm run build
export SHAREONE_API_KEY=your_api_key_here
npm run test:live

License

MIT

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      C
      maintenance
      Enables sharing self-contained HTML files via public or access-key-protected private links. Provides MCP tools to create shares, retrieve public share metadata, and describe the service.
      6
      -
    • A
      license
      A
      quality
      C
      maintenance
      Enables MCP clients to upload local files, create default 24-hour controlled download links, and list, inspect, or permanently delete owned files and shares via a dedicated API key.
      5
      1
      Apache 2.0