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

xmo-data-mcp-server

v0.2.2

Published

MCP Server for xmo-data API

Readme

XMO Data MCP Server

MCP (Model Context Protocol) Server for xmo-data API,提供通过自然语言访问 xmo-data 数据集的能力。

安装

通过 npm

npm install -g xmo-data-mcp-server

通过 npx 直接使用

npx xmo-data-mcp-server

配置

环境变量

.env 文件中配置以下变量:

# 认证 Token(必需,三选一)
XMO_TOKEN=your_token_here
# 或
XMO_API_KEY=your_token_here
# 或用户 ID(平台内部调用)
XMO_USER_ID=your_user_id

# API 基础地址(可选,默认:https://dataset.xm-opt.com)
XMO_DATA_BASE_URL=https://dataset.xm-opt.com

Claude Code 配置

~/.config/claude/config.json~/.claude/config.json 中添加:

{
  "mcpServers": {
    "xmo-data": {
      "command": "npx",
      "args": ["xmo-data-mcp-server"],
      "env": {
        "XMO_API_KEY": "your_token_here"
      }
    }
  }
}

使用方法

列出所有数据集

list_datasets

返回数据集中的基本信息,包括 ID、名称、时间范围和同步状态。

查询数据集详情

get_dataset --name "数据集名称"

查询数据集数据

query_dataset_data \
  --dataset_name "数据集名称" \
  --start "2025-01-01 00:00:00" \
  --end "2025-01-02 00:00:00" \
  --interval 15

时间格式支持:

  • "YYYY-MM-DD HH:MM:SS" - 精确到秒
  • "YYYY-MM-DD" - 日期格式

采样间隔(interval)单位为分钟,默认为 15 分钟。

同步数据集

sync_dataset --dataset_name "数据集名称"

对于需要同步数据的列,必须先同步才能查询数据。

删除数据集

delete_dataset --dataset_name "数据集名称"

删除指定的数据集以及关联的所有数据。

下载数据集

download_dataset \
  --dataset_name "数据集名称" \
  --file_path "./data.csv" \
  --start "2025-01-01" \
  --end "2025-01-02" \
  --interval 15

将数据集数据下载为 CSV 文件。

列出数据列元数据

list_data_columns

列出所有可用的数据列元数据,包括系统列和用户自定义列。

可选参数:

  • --page_no - 页码,从 1 开始(默认:1)
  • --page_size - 每页数量(默认:10)
  • --type - 列类型,可选 SYSTEMUSER

创建数据集

create_dataset \
  --name "新数据集名称" \
  --start "2025-01-01 00:00:00" \
  --end "2025-01-02 00:00:00" \
  --columns '[
    {
      "meta_name": "列名称1",
      "alias": "别名1",
      "params": {}
    },
    {
      "meta_name": "列名称2",
      "params": {}
    }
  ]'

创建新的数据集,需要指定名称、时间范围和列配置。

示例

在 Claude Code 中使用

  1. 配置 MCP Server(见上文)

  2. 查询数据集列表:

请帮我查看有哪些可用的数据集

Claude 会自动调用 list_datasets 工具。

  1. 查询特定数据:
请帮我查询 "光伏功率数据" 从 2025-01-01 到 2025-01-02 的数据,每15分钟一个点

Claude 会自动调用 query_dataset_data 工具。

  1. 下载数据:
请将 "光伏功率数据" 从 2025-01-01 到 2025-01-02 的数据下载到 /tmp/solar.csv

Claude 会自动调用 download_dataset 工具。

开发

本地构建

npm install
npm run build

开发模式

npm run dev

手动运行

node build/index.js

支持的工具

  • list_datasets - 列出所有数据集
  • get_dataset - 查询数据集详情
  • query_dataset_data - 查询数据集数据
  • sync_dataset - 同步数据集
  • delete_dataset - 删除数据集
  • download_dataset - 下载数据集到CSV文件
  • list_data_columns - 列出数据列元数据
  • create_dataset - 创建新数据集

注意事项

  1. 某些数据列需要先同步才能查询数据
  2. 默认采样间隔为 15 分钟
  3. 大量数据查询可能需要较长时间
  4. 下载的数据为 CSV 格式

许可证

MIT