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

@zlooks.cn/resources-server

v2.0.9

Published

独立的资源目录服务。管理数据只通过 MCP;访客页面完全公开,不需要登录、token 或 `resources:read`。

Readme

Resources Server

独立的资源目录服务。管理数据只通过 MCP;访客页面完全公开,不需要登录、token 或 resources:read。

目录与页面

Project(影视、教育等)→ Category → Resource。资源没有详情页,单入口直接跳转,多入口弹出选择框。

  • /resource/edu:当前 Project 的分类及每类前 N 条,N 来自 Project.previewLimit。
  • /resource/edu/science?page=2&size=20:分类完整列表,支持 q 关键词。
  • 不提供 Project 列表、Explore 页面或后台管理页面。通过具体 Project 链接进入。

Project 的 supportsImages 和 themeColor 在创建时指定,之后可修改。图片模式统一使用海报卡片,缺图、图片加载失败时使用同尺寸占位;无图模式统一使用文字卡片。切换模式不会删除封面链接。themeColor 为六位十六进制颜色,如 #28737f,透传到前端 Ant Design 主题。previewLimit 默认 6,支持 1–12。

页面沿用确认稿的浅色布局,不随系统切换暗色。Project 可通过 headline、actionLabel 配置横幅标题和按钮文字,省略时使用通用文案;资源可设置 badge 封面角标,入口可设置 description 说明。上述内容均通过 MCP 管理;局部更新省略这些字段会保留原值,传 null 可清除横幅文案或角标。

MCP 权限

| Scope | 范围 | | --- | --- | | resources:read | 所有 Project 的 MCP 管理查询、动态 Resources | | resources:write | 所有 Project 的 MCP 创建、修改、删除 | | * | 原平台管理员权限 |

两种资源 scope 独立,没有 Project UUID 级别授权。常规维护 token 可配置 ['resources:read', 'resources:write']。前台的公开读取走独立业务查询,不使用上述权限。

Provider ID 为 navigation,公开工具名称如下:

| 对象 | Tools | | --- | --- | | Project | create-project、read-project、list-projects、update-project、delete-project | | Category | create-category、read-category、list-categories、update-category、delete-category | | Resource | create-resource、read-resource、list-resources、update-resource、delete-resource |

例如调用 navigation.create-project:

{
  "slug": "edu",
  "name": "教育资源",
  "description": "公开课程与学习资料",
  "supportsImages": false,
  "themeColor": "#28737f",
  "previewLimit": 6
}

使用返回的 UUID 创建 Category,再使用 Category UUID 创建资源。Category、Resource 操作均携带 projectId,服务端校验真实父级关系;此字段用于数据关联校验,不是授权 scope。

{
  "projectId": "<Project UUID>",
  "categoryId": "<Category UUID>",
  "title": "公开课程",
  "description": "课程介绍",
  "coverUrl": null,
  "links": [
    { "label": "主入口", "url": "https://example.com/course" },
    { "label": "备用入口", "url": "https://example.org/course" }
  ]
}

动态 Resources:navigation://projects/{id}、navigation://projects/{projectId}/categories/{id}、navigation://projects/{projectId}/entries/{id}。navigation.maintain-project Prompt 可从空参数开始,使用 target(project/category/resource)和 operation(create/update/delete)选择流程,或提供 changeRequest 描述目标。它基于真实输入 schema 展示完整字段、必填项与默认值,逐步询问缺失信息;修改前读取并仅更新指定字段,替换 links 前确认完整入口,删除前确认对象与影响,写入后重新读取。获取 Prompt 本身不修改数据。

更新为局部修改;提供 links 时替换整个数组。删除为永久删除,非空 Project/Category 会拒绝删除;可用 enabled: false 暂停公开展示,禁用父级后其下内容也不再公开。创建结果丢失应先查询,不自动重复创建。

部署与边界

服务订阅现有顶层 postgres Registry 配置,启动时通过 TypeORM 同步 resource_projects、resource_categories、resource_entries。所有副本使用同一数据库;数据库配置变化需要协调重启。首次部署可先用一个副本完成建表,再扩容。

只提供内部 Micro 和 RSC 传输,由现有 Gateway 自动发现后公开 /resource/* 和 MCP 能力。Gateway、CLI 通用配置、共享 UI 不依赖此包。MCP 管理不存在 Browser JSON API。

保留当前仓库的 Hile/React/Ant Design 兼容版本;无需新增业务 YAML 配置。运行前使用现有 zlooks setup 配置 Registry 和 PostgreSQL,先构建 RSC:

pnpm --filter @zlooks.cn/resources-server build
pnpm --filter @zlooks.cn/resources-server start

单个 Project 最多 64 个分类;每页最多 100 条,页码最多 10000;资源支持 1–8 个入口,URL 限 HTTP(S) 且不含嵌入式账号密码。服务只保存链接,不下载图片或外部资源。列表按排序值、创建时间倒序和 UUID 稳定排序,分页属于实时读取。公开页面的分类、资源与计数使用一次 repeatable-read 快照。

验证

pnpm --filter @zlooks.cn/resources-server test
pnpm --filter @zlooks.cn/resources-server typecheck
pnpm --filter @zlooks.cn/resources-server verify:rsc
pnpm test:architecture

navigation.get-maintenance-guide 为 Dot 等只支持 Tools 的客户端提供同一维护引导,可从 {} 开始;参数与 navigation.maintain-project 相同。它经 canonical Micro 查询和 Model 校验返回指导,不执行写入;与 Prompt 一样同时要求 resources:read 和 resources:write,不扩大只读或仅写入身份的权限。

集成测试构建真实产物,通过 MCP HTTP 执行全部 16 个管理与引导操作,校验独立 read/write scopes、Micro 输入校验、动态 Resources、Prompt 目录和匿名 RSC 渲染。数据库测试使用 TypeORM + pg-mem,验证 SQL 和约束,不模拟 PostgreSQL 锁调度及快照隔离;真实 PostgreSQL 的并发与部署验证需在部署环境执行。