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

@smcphub/search-engine-indexing

v0.0.3

Published

A MCP Server for search engine indexing and URL submission to major search engines by SMCPHUB

Readme

Search Engine Indexing MCP Server

一个用于搜索引擎索引和 URL 提交的 MCP 服务器,支持百度、必应等主流搜索引擎。

功能特性

  • 支持百度搜索和必应搜索的 URL 提交
  • 自动从数据库查询未推送的 URL
  • 智能域名验证和格式化
  • 自动更新推送状态

安装依赖

npm install

环境变量配置

在项目根目录创建 .env 文件,配置以下环境变量:

# 百度站长平台 API Token
BAIDU_ACCESS_TOKEN=your_baidu_access_token

# 必应站长工具 API Key
BING_API_KEY=your_bing_api_key

# SMCPHUB API 配置
SMCPHUB_API_KEY=your_smcphub_api_key

后端服务要求

此服务需要连接到 SMCPHUB 后端 API,后端需要提供以下服务:

site-management 服务

提供网站管理相关功能:

get_unpushed_urls 方法

获取未推送的 URL 记录:

  • 参数:domain (域名), limit (限制条数,默认10)
  • 返回:未推送的 URL 列表,包含 idurl 字段

update_urls_push_status 方法

更新 URL 推送状态:

  • 参数:domain (域名), url_ids (URL ID 数组)
  • 功能:将指定 URL 的 pushed_to_search_engine 状态更新为 true

数据库表结构

后端需要维护以下数据表:

ai_sites 表

存储网站域名信息:

  • id: 主键
  • domain: 域名
  • user_id: 用户ID
  • created_at: 创建时间
  • updated_at: 更新时间

ai_site_urls 表

存储网站 URL 信息:

  • id: 主键
  • site_id: 关联的站点ID
  • url: URL地址
  • pushed_to_search_engine: 是否已推送到搜索引擎
  • created_at: 创建时间
  • updated_at: 更新时间

使用方法

1. 手动指定 URL 推送

{
  "search_engine": "baidu",
  "domain": "https://example.com",
  "urls": [
    "https://example.com/page1",
    "https://example.com/page2"
  ]
}

2. 自动查询未推送 URL

{
  "search_engine": "baidu",
  "domain": "https://example.com"
  // urls 参数为空时,会自动从数据库查询 10 条未推送的 URL
}

工作流程

  1. URL 获取:
    • 如果提供了 urls 参数,使用提供的 URL
    • 如果 urls 为空,调用后端 API 查询 10 条 pushed_to_search_engine=0 的记录
  2. 搜索引擎推送: 根据指定的搜索引擎执行 URL 推送
  3. 状态更新: 推送成功后,调用后端 API 更新对应 URL 的 pushed_to_search_engine 状态为 true

支持的搜索引擎

  • 百度 (baidu): 使用百度站长平台 API
  • 必应 (bing): 使用必应 IndexNow API

错误处理

  • 无未推送 URL:当自动查询模式且没有未推送 URL 时返回错误
  • API 调用失败:返回具体的错误信息
  • 后端服务不可用:返回连接错误信息
  • 认证失败:返回 API 密钥错误信息

开发说明

构建项目

npm run build

类型定义

项目使用 TypeScript,包含完整的类型定义。主要类型包括:

  • SearchEngine: 搜索引擎枚举
  • PushUrlsParams: 推送参数类型

注意事项

  1. 确保后端 API 服务正常运行
  2. 配置正确的 SMCPHUB API 密钥
  3. 确保后端已实现 site-management 服务的相关方法
  4. 域名和 URL 记录需要先在后端数据库中注册

许可证

Apache-2.0