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

@cinnamobot/nic

v0.1.4

Published

Niigata Information Connector (NIC) — 新潟県の情報(気象・統計・観光・防災・オープンデータ)にアクセスする CLI / MCP ツールキット

Downloads

76

Readme

NIC — Niigata Information Connector (TypeScript)

新潟県の情報(気象・統計・観光・防災・オープンデータ)にアクセスする CLI / MCP ツールキット。 新潟県の公式データ源(気象庁・新潟県・新潟市・国土交通省)に直接アクセスし、 必要な情報だけを最小トークンで AI エージェントへ届ける。

本パッケージは Python 版(app-tech/nic)の TypeScript 移植版。 npx でインストールでき、AI エージェントのツールとしてそのまま使える。


インストール

# グローバル(またはプロジェクト)にインストール
npm install -g @cinnamobot/nic

# npx で直接実行(インストール不要)
npx -y @cinnamobot/nic weather --station 長岡

CLI(ngt)

ngt weather --station 長岡   # 気温・降水量(気象庁アメダス)
ngt snow --rank              # 積雪ランキング(冬季のみ)
ngt warning --level 市町村   # 警報・注意報(気象庁防災情報XML)
ngt tour --onsen             # 温泉スポット(新潟市オープンデータ)
ngt tour --irikomi           # 観光入込客数
ngt stats --population       # 人口(新潟県オープンデータ)
ngt search 湯沢              # 全データ横断検索

# 共通オプション
ngt weather --station 長岡 --json   # JSON 出力(AI 向け)
ngt weather --force                 # キャッシュ無視で再取得
  • 出力はプレーンな表形式(AI がパースしやすく、装飾なし)
  • --json で機械可読出力
  • エラー時は「なぜ失敗したか」をヒント付きで返す(例: 積雪データは冬季のみ提供)

MCP サーバー(ngt-mcp)

MCP(Model Context Protocol)対応クライアント(Claude Desktop / Cursor 等)から使える。 @cinnamobot/nic をインストールすると ngt-mcp バイナリが使えるようになる。

// claude_desktop_config.json
{
  "mcpServers": {
    "nic": {
      "command": "npx",
      "args": ["-y", "@cinnamobot/nic", "mcp"]
    }
  }
}

または ngt-mcp バイナリを直接指定(npm でインストール済みの場合):

{
  "mcpServers": {
    "nic": {
      "command": "ngt-mcp"
    }
  }
}

提供ツール(7 つ):

| ツール | 内容 | |---|---| | get_snow_info | 積雪情報(全 44 観測所 or 指定) | | get_weather_info | 最高・最低気温・1 時間降水量 | | get_warning_info | 警報・注意報(府県〜市町村 4 階層) | | get_tourist_spots | 観光スポット一覧(温泉・集客施設) | | get_tour_recommendation | 天気×おすすめ観光 | | get_niigata_stats | 統計・オープンデータ(人口・道の駅・データセット) | | search_niigata_data | 全データ横断検索 |

※ npx -y @cinnamobot/nic mcp はパッケージ内の ngt-mcp バイナリを起動する。 詳細は package.json の bin を参照(ngt / ngt-mcp)。


データ源とライセンス

| データ源 | 内容 | ライセンス / 利用条件 | |---|---|---| | 気象庁「最新の気象データ」CSV | アメダス(積雪・気温・降水量) | 気象庁ウェブサイト利用規約(出典表示必須) | | 気象庁防災情報XML配信 | 警報・注意報電文(VPWW53/VPWW54) | 公共データ利用規約 第1.0版 | | 新潟県オープンデータ | データセット一覧・人口・道の駅 | 新潟県オープンデータ利用規約(出典表示) | | 新潟市オープンデータ | 観光入込客数・温泉GIS・観光データセット | クリエイティブ・コモンズ 表示(CC-BY) | | 国土数値情報(国土交通省) | 集客施設 P33(2014年度版) | 国土数値情報利用約款(出典明記で無償利用可) |

  • 本ツール(NIC)自体は MIT License で公開。
  • 取得・表示するデータの権利は各データ源に帰属し、各利用条件に従う必要がある。
  • 本ツールの出力(CLI / MCP)には必ず出典が含まれており、各データ源の利用条件(出典表示)を満たすことを意図している。

開発

npm install
npm run build     # tsc で dist/ にビルド
npm test          # vitest(52 テスト)
npm run typecheck # 型チェックのみ

プロジェクト構成

src/
  core/           データ取得層(キャッシュ・エラー処理・出典管理を一元化)
    amedas.ts     気象庁アメダス(積雪・気温・降水量)
    warning.ts    気象庁防災情報XML(警報・注意報)
    opendata.ts   新潟県オープンデータ(統計・道の駅)
    tourism.ts    観光スポット(温泉・集客施設・入込客数・P33 Shapefile)
  cli/            CLI エントリポイント(commander)
  mcp/            MCP サーバーエントリポイント(@modelcontextprotocol/sdk)
  index.ts        ライブラリ公開エントリ

開発メモ

  • 新潟県 CKAN API(ckan.pref.niigata.lg.jp)は 2026-08 現在 DNS 解決不可のため、 公式サイトの CSV へ自動フォールバックする(実行時「注:」で通知)。
  • 積雪データは夏季(概ね 5〜9 月)提供休止のため、snow は 404 エラー + ヒントを返す。
  • 気象庁 CSV は Shift_JIS のため iconv-lite でデコードする。
  • P33 集客施設は Shapefile(DBF + SHP)を ZIP 内から直接パースする(依存なし・軽量)。