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

@aalis/plugin-mcp-client

v0.14.0

Published

MCP 客户端:连接外部 MCP server,把其 tools 注册进工具表

Readme

plugin-mcp-client

作为 MCP (Model Context Protocol) client 连接外部 MCP servers(通过 stdio),把它们暴露的 tools 包装注册到 Aalis 的 ToolService,让 Aalis agent 可以直接调用外部生态的工具。

接入要点

  • 每个 server 在 config 中独立一项(id / command / args / env)
  • 工具名会加前缀 mcp_<server-id>_<tool-name> 避免与本地工具命名冲突
  • 每个 server 注册一个工具分组 mcp:<server-id>,可在 platform 配置中按需启用
  • lifecycle.onDispose 注册了 client 关闭回调,插件卸载时自动断开
  • 工具档位默认 auto——按 MCP 工具注解分档:自称只读(readOnlyHint)→ sensitive (等级 1),有破坏提示或未声明 → restricted(等级 2,未知按可破坏算)。 server 级 visibility 可显式覆盖为 public / sensitive / restricted

配置示例

plugins:
  "@aalis/plugin-mcp-client":
    servers:
      - id: github
        command: npx
        args: ["-y", "@modelcontextprotocol/server-github"]
        env:
          GITHUB_PERSONAL_ACCESS_TOKEN: "ghp_xxx"
        enabled: true

      - id: fs
        command: npx
        args: ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/allowed/dir"]
        visibility: restricted   # 显式收紧:文件系统访问全部按等级 2

依赖

  • @modelcontextprotocol/sdk
  • uses:tools(api-tools / plugin-tools)、logger、lifecycle、config;可选 hostConfig(mcp_set_server_enabled 经它的 applyPluginConfig 改配置并落盘)

注意

  • env 声明了 secret: true:每个 server 的整份 env 算一个密钥,Node 宿主把它移进家目录的 secrets.yaml,配置文件里只留引用;WebUI 不回显,要改就整份重填。token 放进 env,不要写进 args(连接成功时的日志会写出全部 args)
  • args 必须是字符串数组、env 必须是映射;缺省时分别补 [] / {}。显式形态错误或任一成员不能转为字符串时,该 server 记录警告且不启动,其他 server 不受影响;合法的空字符串参数会原样传递
    • 旧版 WebUI 建的条目常带 args: '' / env: '',删除该键或改为 [] / {}
    • 旧版按以下规则解析字符串,改写时照此拆分:args 先按行、再按空白切分,如 args: "-y @scope/pkg" 应改为 ["-y", "@scope/pkg"];env 每行一条 KEY=VALUE,忽略 # 开头的注释行,值去首尾空白
  • 缺少 id 或 command 的条目记录警告并跳过,其它 server 不受影响
  • enabled 不是布尔值、visibility 不在四档选项中时,同样跳过该 server
  • MCP inputSchema 顶层非 type: 'object' 时会被包装为 { input: schema }
  • 工具名超过 64 字符(OpenAI 限制)会被截断
  • 非法字符(/ . 等)会被替换为下划线