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

@swylink/cli

v1.2.2

Published

Swylink MCP Adapter CLI

Downloads

53

Readme

🌐 English | Portugues | Espanol | Francais | Deutsch | 中文

@swylink/cli

Swylink 让你的 AI 编程工具保持同步。 在 Cursor 中保存上下文,从 Claude Code 中搜索。在 Windsurf 中做出决策,其他所有 IDE 立即知晓。

┌──────────┐     ┌─────────────┐     ┌──────────┐
│  Cursor   │────▶│   Swylink   │◀────│  Claude   │
│  save     │     │   Cloud     │     │  search   │
└──────────┘     └─────────────┘     └──────────┘
                        ▲
                        │
                  ┌──────────┐
                  │ Windsurf  │
                  │  search   │
                  └──────────┘

CLI 通过 MCP(Model Context Protocol)将你的 IDE 连接到 Swylink — 这是 AI 工具集成的开放标准。你的 IDE 会自动发现 Swylink 的工具,AI 助手无需任何手动干预即可使用它们。


快速开始

1. 创建账户

swylink.com 注册并开始免费试用。

2. 获取设置 token

进入你的 Swylink 控制面板设备添加设备 → 复制一次性设置 token。

3. 连接你的第一个 IDE

# 方式 A:通过环境变量设置 token
SWYLINK_SETUP_TOKEN=swk_setup_xxxxx npx @swylink/cli start --ide cursor --profile my-project

# 方式 B:通过文件传递 token
npx @swylink/cli start --ide cursor --profile my-project --setup-token-file ~/swylink-token.txt

就这样。首次运行时,CLI 会将 token 换取一个永久设备凭证。下次只需运行:

npx @swylink/cli start --ide cursor --profile my-project

4. 连接更多 IDE

对每个 IDE 重复步骤 2-3。每个设备获取自己的 token,但它们在你的账户下共享上下文。


IDE 配置指南

Cursor / Windsurf

添加到你的 MCP 设置(~/.cursor/mcp.json 或 IDE 设置):

{
  "mcpServers": {
    "swylink": {
      "command": "npx",
      "args": ["-y", "@swylink/cli", "start", "--ide", "cursor", "--profile", "my-project"]
    }
  }
}

Claude Code

claude mcp add swylink -- npx -y @swylink/cli start --ide claude-code --profile my-project

Codex (OpenAI)

{
  "mcpServers": {
    "swylink": {
      "command": "npx",
      "args": ["-y", "@swylink/cli", "start", "--ide", "codex", "--profile", "my-project"]
    }
  }
}

Gemini CLI

{
  "mcpServers": {
    "swylink": {
      "command": "npx",
      "args": ["-y", "@swylink/cli", "start", "--ide", "gemini", "--profile", "my-project"]
    }
  }
}

其他 MCP 兼容 IDE

任何支持基于 stdio 的 MCP 的工具都可以使用。采用相同的模式:

npx -y @swylink/cli start --ide <your-ide-name> --profile <profile>

工作原理

你的 AI 助手会自动获得 6 个工具:

保存上下文(save_context

当你的 AI 完成任务后,它会保存所做的操作:

AI:"我重构了身份验证模块。"
     → 保存:摘要、决策、标签、变更文件
     → 即时同步到所有已连接的 IDE

搜索上下文(search_context

在开始任务前,你的 AI 会检查其他 IDE 已完成的工作:

AI:"让我看看关于身份验证有哪些已有的决策..."
     → 在所有已连接的 IDE 之间搜索
     → 即使措辞不同也能找到相关决策
     → 返回智能分层结果(见下文)

智能分层响应

搜索结果按相关性自动分类,以节省 AI 的上下文窗口:

| 相关性 | 层级 | AI 看到的内容 | |--------|------|---------------| | 高 | full | 全部内容:摘要、决策、文件、标签 | | 中 | summary | 摘要 + 标签(可按需请求详情) | | 低 | minimal | 仅摘要(可按需请求详情) |

效果: token 使用量大幅减少。你的 AI 可以随时通过 context_detail 请求完整详情 — 不会丢失任何信息。

获取完整详情(context_detail

当搜索结果以 summaryminimal 形式返回时,你的 AI 可以请求完整条目:

AI:"我需要这条上下文记录的完整详情..."
     → 返回包含所有字段的完整条目

发送消息(send_message

向你账户下所有已连接的 IDE 会话广播消息。

读取历史(read_context

读取上下文历史中最近的 N 条消息。

清除历史(clear_context

删除你账户下的所有上下文消息。


CLI 命令

swylink start

启动 MCP 桥接。这是你的 IDE 运行的命令。

swylink start --ide <name> --profile <name> [options]

| 选项 | 描述 | 默认值 | |------|------|--------| | --ide | IDE 标识符 | IDE_CLIENT_NAME 环境变量 | | --profile | 配置文件名(每个账户/工作区使用一个) | default | | --server | WebSocket 服务器 URL | wss://api.swylink.com/ws | | --setup-token-file | 包含设置 token 的文件路径 | - |

swylink auth login

使用邮箱和密码进行身份验证。凭证存储在本地。

swylink auth login --profile my-project

swylink auth whoami

查看当前登录的用户。

swylink auth whoami --profile my-project

swylink auth logout

登出并清除已存储的凭证。

swylink auth logout --profile my-project

swylink doctor

诊断连接、身份验证和配置问题。

swylink doctor --profile my-project

配置文件

使用配置文件在同一台机器上管理多个账户或工作区。

# 工作项目
swylink start --ide cursor --profile work

# 个人项目
swylink start --ide cursor --profile personal
  • 配置路径:~/.config/swylink/profiles/<profile>/config.json
  • 默认配置文件:default
  • 建议:始终设置 --profile,以避免项目之间的凭证冲突

环境变量

| 变量 | 描述 | 默认值 | |------|------|--------| | SWYLINK_SETUP_TOKEN | 控制面板中的一次性设置 token | - | | SWYLINK_PROFILE | 配置文件名 | default | | IDE_CLIENT_NAME | IDE 标识符 | - | | WS_URL | WebSocket 服务器 URL | wss://api.swylink.com/ws | | API_BASE_URL | REST API 基础 URL | https://api.swylink.com |


更新

# 全局安装
npm update -g @swylink/cli

# 或者直接使用 npx(始终获取最新版本)
npx @swylink/cli@latest start --ide cursor --profile my-project

安全与隐私

  • 你的上下文数据是私密的。 每个用户的上下文是隔离的 — 只有你已连接的 IDE 才能访问你的上下文记录。
  • 凭证存储在本地。 设备凭证保存在 ~/.config/swylink/,永远不会离开你的设备。
  • 设置 token 是一次性的。 一旦换取设备凭证,该 token 即失效。
  • 所有连接都经过加密。 与 Swylink 服务器的通信使用 TLS(WSS/HTTPS)。
  • 你可以随时撤销设备。 进入控制面板 → 设备,即可撤销任何已连接的 IDE。

常见问题

问:我的代码会被发送到 Swylink 吗? 不会。只有你明确保存的上下文摘要、决策、标签和文件路径会被存储。你的实际源代码永远不会离开你的设备。

问:其他用户能看到我的上下文吗? 不能。上下文限定在你的账户范围内。只有使用你的凭证认证的 IDE 才能读取或写入你的上下文。

问:断网后会怎样? CLI 会自动尝试重新连接。你的 IDE 继续正常工作 — 连接恢复后上下文同步会自动继续。

问:我可以使用自托管的后端吗? 可以。使用 --server wss://your-server.com/ws 指向你自己的实例。

问:如何删除我的所有上下文数据? 在任何已连接的 IDE 中使用 clear_context 工具,或联系支持团队。


故障排除

"Device credential invalid or expired"

你的设备凭证已从控制面板撤销。生成新的设置 token 并重新连接:

SWYLINK_SETUP_TOKEN=<new-token> swylink start --ide cursor --profile my-project

"No active subscription"

你的试用期已过期或订阅处于非活跃状态。在 swylink.com/dashboard/settings 检查你的账单信息。

"Connection refused" / "WebSocket error"

  1. 检查你的网络连接
  2. 运行 swylink doctor --profile my-project 进行诊断
  3. 如果使用自定义服务器,通过 --server 验证 URL

"Authentication timeout"

设置 token 可能无效或已被使用。请从控制面板生成新的 token。

MCP 工具未在 IDE 中显示

  1. 验证 CLI 是否正在运行:检查 IDE 的 MCP 服务器列表
  2. 添加 MCP 配置后重启 IDE
  3. 运行 swylink doctor 验证连接状态

系统要求

  • Node.js 20+
  • 有效的 Swylink 账户(提供免费试用)
  • 兼容 MCP 的 IDE(Cursor、Claude Code、Windsurf、Codex、Gemini CLI 等)

更新日志

v1.2.2

  • 修复 npm 文档语言链接
  • 新增安全与隐私部分和常见问题

v1.2.1

  • 完善文档,包含 IDE 配置指南、故障排除和 6 种语言翻译

v1.2.0

  • 新增 context_detail 工具,支持按需获取完整条目
  • 智能分层搜索响应 — 大幅减少上下文窗口使用量
  • 改进搜索相关性处理

v1.1.0

  • 智能上下文层:save_contextsearch_context 工具
  • 跨 IDE 上下文同步,支持语义搜索
  • 所有已连接 IDE 之间自动共享上下文

v1.0.1

  • 引导设置 token 流程,用于设备凭证配置
  • 多配置文件支持

v1.0.0

  • 首次发布:MCP 桥接,包含 send_messageread_contextclear_context

许可证

UNLICENSED - 专有软件。需要有效的 Swylink 订阅。