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

@kagol/next-sdk-copilot

v0.0.1

Published

Simplified SDK for building intelligent web applications with MCP protocol

Readme

@opentiny/next-sdk

一个简化的 SDK,用于快速构建基于 MCP 协议的智能 Web 应用。

特性

  • 🚀 简化的 API: 将复杂的 MCP 协议封装成简单易用的接口
  • 🔄 自动重连: 内置连接管理和自动重连机制
  • 🛠️ 工具支持: 简化的工具、资源、提示注册
  • ⏱️ 长任务支持: 内置进度报告和任务取消机制
  • 🔐 认证管理: 自动处理认证和授权流程
  • 📱 用户引导: 简化的用户输入收集机制

安装

npm install @opentiny/next-sdk

快速开始

客户端使用

import { createClient } from '@opentiny/next-sdk';

const client = createClient({
  name: 'My App Client',
  mcpUrl: 'http://localhost:3000/mcp'
});

await client.initialize();

服务端使用

import { createServer } from '@opentiny/next-sdk';

const server = createServer({
  name: 'My App Server'
});

await server.initialize(transport);

// 注册工具
server.addTool(
  'calculate',
  '执行计算',
  async ({ a, b, operation }) => {
    switch (operation) {
      case 'add': return a + b;
      case 'subtract': return a - b;
      default: throw new Error('Unsupported operation');
    }
  }
);

API 文档

NextSDKClient

构造函数选项

  • name: 客户端名称
  • version: 客户端版本
  • mcpUrl: MCP 服务器 URL
  • authUrl: 认证服务器 URL
  • clientMetadata: 客户端元数据配置

方法

  • initialize(): 初始化客户端
  • cleanup(): 清理资源
  • getClient(): 获取原始 MCP 客户端实例

NextSDKServer

构造函数选项

  • name: 服务器名称
  • version: 服务器版本
  • capabilities: 服务器能力配置

方法

  • initialize(transport): 初始化服务器
  • addTool(name, description, handler, parameters?): 注册工具
  • addResource(name, uri, handler): 注册资源
  • addPrompt(name, handler): 注册提示
  • addLongTask(name, description, handler): 注册长任务
  • elicitUserInput(message, schema): 收集用户输入
  • sendLog(level, message): 发送日志
  • requestSampling(messages, options?): 请求大模型

示例

查看 examples/ 目录获取更多使用示例。

许可证

MIT

这个 SDK 的设计目标是:

  1. 简化复杂性: 将原本需要 6 个步骤的复杂配置简化为几行代码
  2. 提供默认值: 为大部分配置项提供合理的默认值
  3. 保持灵活性: 允许高级用户自定义配置
  4. 错误处理: 内置错误处理和重连机制
  5. 类型安全: 提供完整的 TypeScript 类型支持

主要简化的方面:

  • 客户端初始化: 从复杂的多步骤配置简化为单个 initialize() 调用
  • 工具注册: 从复杂的 zod 类型定义简化为简单的参数对象
  • 长任务处理: 内置进度报告和取消机制
  • 资源管理: 简化资源注册和更新流程
  • 错误处理: 自动处理连接错误和重连
  • 生命周期管理: 自动处理资源清理

这样,用户只需要关注业务逻辑,而不需要处理复杂的 MCP 协议细节。这个 SDK 的设计目标是:

  1. 简化复杂性: 将原本需要 6 个步骤的复杂配置简化为几行代码
  2. 提供默认值: 为大部分配置项提供合理的默认值
  3. 保持灵活性: 允许高级用户自定义配置
  4. 错误处理: 内置错误处理和重连机制
  5. 类型安全: 提供完整的 TypeScript 类型支持

主要简化的方面:

  • 客户端初始化: 从复杂的多步骤配置简化为单个 initialize() 调用
  • 工具注册: 从复杂的 zod 类型定义简化为简单的参数对象
  • 长任务处理: 内置进度报告和取消机制
  • 资源管理: 简化资源注册和更新流程
  • 错误处理: 自动处理连接错误和重连
  • 生命周期管理: 自动处理资源清理

这样,用户只需要关注业务逻辑,而不需要处理复杂