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

ts-mcp-server-demo

v0.0.2

Published

Model Context Protocol 服务器示例

Downloads

14

Readme

MCP服务器示例项目

这是一个基于Model Context Protocol的服务器示例,实现了简单的计算工具功能。

工作流程

flowchart TD
    A[启动服务器] --> B[工具注册]
    B --> C[等待请求]
    C --> D{请求类型?}
    D -->|list_tools| E[返回工具列表]
    D -->|call_tool| F[执行工具]
    F --> G[返回结果]
    E --> C
    G --> C

功能特性

  • 提供计算两数之和的工具
  • 支持标准输入输出传输
  • 完善的错误处理机制

安装步骤

  1. 确保已安装Node.js (版本16+)和npm
  2. 克隆项目仓库
  3. 安装依赖:
npm install
  1. 构建项目:
npm run build

使用方法

  1. 启动服务器:
npm run inspector
  1. 通过标准输入发送请求
  2. 服务器将通过标准输出返回结果

示例请求

列出可用工具:

{
  "method": "list_tools",
  "params": {}
}

调用计算工具:

{
  "method": "call_tool",
  "params": {
    "name": "calculate_sum",
    "arguments": {
      "a": 5,
      "b": 3
    }
  }
}

开发

  • 开发模式:
npm run watch

NPM包发布指南

  1. 准备发布:
# 确保所有测试通过
npm test

# 确保构建产物是最新的
npm run build

# 检查package.json配置
npm pkg get name version main files
  1. 登录NPM账号:
npm login
  1. 更新版本号(遵循语义化版本):
# 主版本号(不兼容的API修改)
npm version major

# 次版本号(向下兼容的功能新增)
npm version minor

# 修订号(向下兼容的问题修正)
npm version patch
  1. 验证发布包内容:
# 查看将被发布的文件列表
npm pack --dry-run
  1. 发布到NPM仓库:
npm publish
  1. 验证发布结果:
# 查看已发布的包信息
npm view ${package-name}

注意事项

  • 确保package.json中的必要字段(name, version, main, files等)已正确配置
  • 发布前请确保:
    • 所有测试通过
    • 构建产物是最新的
    • CHANGELOG.md已更新
  • 如需发布公开包,请移除package.json中的private字段
  • 发布后请及时更新CHANGELOG.md中的版本信息

许可证

ISC