Skip to main content
Glama
genvjacobc

lightspeed-x

by genvjacobc

lightspeed-x-mcp

Model Context Protocol サーバーであり、Lightspeed X(旧Vendとして知られるプラットフォーム、Lightspeed Retail POS)向けです。Claudeやその他のMCPクライアントに、店舗の売上、在庫、商品、顧客への読み取り専用アクセスも提供し、集約も行います。売上、数量、COGS、粗利益、マージン、割引、平均バスケット金額、バスケットサイズを、指定した任意の次元でグループ化して返します。

構造上、読み取り専用です。 すべてのツールはGETリクエストを発行します。このサーバーには、アカウント内に何かを作成・更新・削除できるコードパスがありません。そのため、稼働中の小売店を視野に入れて接続できます。

"What sold best yesterday?"                → lightspeed_sales_report
"Revenue by store last week"               → lightspeed_sales_report, group_by: outlet
"Which SKUs need reordering?"              → lightspeed_inventory_report, status: reorder_needed
"What are our busiest hours?"              → lightspeed_sales_report, group_by: hour
"Margin by brand this month"               → lightspeed_sales_report, group_by: brand
"Pull up invoice 162220"                   → lightspeed_list_sales

なぜこれが存在するのか

Lightspeed X APIはVend時代の生き残りであり、単純だクライアントを遅くしたり、静かに間違った結果に導いたりする鋭いエッジがあります。このサーバーはそれらを処理するので、モデルが同じことをする必要はありません:

現実

このサーバーが行うこと

/sales は date_from と date_to を受け付けながら、 それらを静かに無視します 。どの日付を指定しても、すべての結果が返ってきます。

バージョンシーケンスを二分探索して日付範囲を特定し、その後ローカルでフィルタリングします。パラメータを信頼する素朴なクライアントは、完全な自信を持って誤った答えを返します。

ページネーションはカーソルベースではなく、 バージョンベースです。 cursor キーはありません。レスポンスには version: {min, max} が含まれ、?after=<version> を使ってページングします。

クライアントの paginate ヘルパーが透過的に処理します。

ドキュメント上の最大 page_size は 200 ですが、APIは実際には 最大5000 まで提供します。

一括スキャンは5000を使用します(売上は完全な明細項目を持つため、1000を使用します)。12万6,000行の在庫スキャンが630リクエストではなく26リクエストで完了します。

売上の明細項目には product.id しか含まれていません。名前もSKUもカテゴリもありません。

キャッシュされた商品カタログに結合するため、すべてのレポートが人が読める形式になります。

店の1日はUTCの0時には始まりません。そのため、単純な分割では夜の売上が間違った日に計上されます。

日・月・曜日・時刻のバケットは、店舗自身のIANAタイムゾーンで解決されます。

返品はマイナス数量・マイナスの合計数を持つ明細項目として記録されます。

特別な処理をしなくても、すべての指標で正しく相殺されます。

/product_categories は、他のすべてのエンドポイントとはまったく異なる形状のエンベロープを返します。

独立したケースとして処理されます。

レート制限は 5分間で 300 x registers + 50 で、429には信頼できる Retry-After がありません。

429 と 5xx で指数バックオフとリトライを実施します。

売上計算の導出方法

連続した200件の実売上データで検証されています。すべてがその売上自体の totals.price に2セント以内で一致しました:

line revenue excl tax = line_items[].pricing.total        (net of discount, already x quantity)
line COGS             = line_items[].pricing.cost_total
line discount given   = line_items[].pricing.discount_total
line tax              = line_items[].tax.total

さらに、実データでの3つの検証も完全一致です:

  • 1週間の1日ごとの売上の合計が、その週の総計と一致する。

  • group_by: outlet レポートの店舗の行が、その店舗のサーバーサイドフィルタで再実行した同じレポートと一致する。

  • 支払い種別ごとの支払い額の合計が、税込み売上と一致する。


Related MCP server: mcp-pdv-demo

インストール

オプション1: Claude Codeプラグインとして(推奨)

わずか3つのコマンドで、クローン不要、ビルド不要、編集するパスも不要です:

/plugin marketplace add genvjacobc/lightspeed-x-mcp
/plugin install lightspeed-x@lightspeed-x-mcp
/lightspeed-x:setup

3つ目のコマンドは、同梱されたセットアップスキルを実行します。このスキルは、トークンの取得を支援し、正しい場所に書き込み、ライブアカウントとの接続を検証してから、動作したことを通知します。

また、プラグインにはreports スキルも含まれているため、Claudeはどのツールがどのような小売関連の質問に解答するか、取得した数値をどう読むか理解できます。

認証情報は ${CLAUDE_PLUGIN_DATA}/credentials.env に保存され、このディレクトリはユーザーごとの領域で、プラグインの更新後も残ります。マシン間やチームメンバー間で共有されるものはありません。

尚、/plugin uninstall はこのディレクトリを削除するため、アンインストールして再インストールする操作はセットアップの再実行を意味します。トークン自体はLightspeed上で有効なままなので、使い終わったらそこで生成してください。

オプション2: スタンドアロンのMCPサーバーとして

git clone https://github.com/genvjacobc/lightspeed-x-mcp.git
cd lightspeed-x-mcp
npm install
npm run build

Node 18 以降が必要です。

APIトークンを取得する

Lightspeed X バックオフィスで: Setup → Personal Tokens → Add Personal Token。ダイアログを閉じる前にコピーしてください。一度だけ表示されます。

ロールアウトを計画する前に知っておくべき2つの制限があります:

  • 管理者ユーザーのみがパーソナルトークンを作成でき、Lightspeedはこの機能をPlusプランに限定しています。 Setupの下にPersonal Tokensが表示されない場合、管理者アクセス権を持つ誰かがあなたの代わりにトークンを作成する必要があります。

  • Lightspeedは読み取り専用トークンを提供していません。 トークンは、作成したユーザーのすべての権限保持します。このサーバーは常に GET のみを発行しますが、トークン自体は汎用のvinfidential情報です。そのため、パスワードのように密に取り扱い、漏洩した場合は同じ画面で失効させてください。

動作確認

npm run doctor

これにより、資格情報の検証、ライブAPIの呼応、失敗の正確な原因を特定します。ストアドメインとトークンの誤りはどちらもLightspeedからHTTP 401を返すため、診断ツールは推測ではなく、その両方の可能性を報告します。

設定

.env.example を .env にコピーして、ストア情報を入力してください:

LIGHTSPEED_DOMAIN=mystore
LIGHTSPEED_TOKEN=your_personal_token

LIGHTSPEED_DOMAIN は、単純なプレフィックス (mystore)、ホスト名 (mystore.retail.lightspeed.app)、または完全なURLを受け入れます。3つともすべて同じ場所に解決されます。

複数のストア。 LIGHTSPEED_<NAME>_DOMAIN と LIGHTSPEED_<NAME>_TOKEN の行が組で、小文字の <name> という名前のアカウントを定義します。ツールはさらにオプションの account 引数を受け取ります:

LIGHTSPEED_NORTH_DOMAIN=northstore
LIGHTSPEED_NORTH_TOKEN=token_for_north
LIGHTSPEED_SOUTH_DOMAIN=southstore
LIGHTSPEED_SOUTH_TOKEN=token_for_south
LIGHTSPEED_DEFAULT_ACCOUNT=north

環境内に既に存在する値は常に .env ファイルより優先されるため、認証情報を直接注入する環境が優先されます。

Claude Codeとの登録(スタンドアロン経路で人)

プラグインをインストールしている場合は、この手順を省略できます。プラグインはサーバー自身を登録します。

claude mcp add lightspeed-x -s user -- node /absolute/path/to/lightspeed-x-mcp/dist/index.js

または、手動で設定に追加することもできます:

{
  "mcpServers": {
    "lightspeed-x": {
      "command": "node",
      "args": ["/absolute/path/to/lightspeed-x-mcp/dist/index.js"],
      "env": {
        "LIGHTSPEED_DOMAIN": "mystore",
        "LIGHTSPEED_TOKEN": "your_personal_token"
      }
    }
  }
}

Claude Desktop の場合は、同じブロックを claude_desktop_config.json に配置します。

MCP Inspectorでローカルに検証します:

npm run inspect

ツール

lightspeed_sales_report

メインのツール。日付範囲を集計し、グループ化します。

引数

説明

date_from, date_to

YYYY-MM-DD、両端を含み、レポートタイムゾーンで解決します

group_by

product (デフォルト)、sku、category、brand、supplier、tag、outlet、register、salesperson、customer、day、month、weekday、hour、payment_type、none

metrics

revenue、revenue_incl_tax、units、sale_count、cogs、gross_profit、margin_pct、discount、tax、basket_value、basket_size、customer_count

sort_by, sort_direction, limit

ランキングの制御

outlet_id

サーバーサイドで適用されるため、非常に高速です

state

デフォルトは closed。レポートが意味するのはこの状態です

timezone

日次境界のためのIANATゾーンオーバーライド

| Outlet          |   Revenue | Units | Sales | Basket value | Gross profit | Margin |
| --------------- | --------: | ----: | ----: | -----------: | -----------: | -----: |
| South Lincoln   | $3,401.60 |   193 |    91 |       $37.38 |    $2,342.35 |  68.9% |
| York            | $3,222.86 | 159.2 |    73 |       $44.15 |    $2,238.77 |  69.5% |

lightspeed_list_sales

個別の取引を新しい順に返し(オプションで行アイテムを展開)、1件のレシートへのド派ノ、合計の監査、返品の確認に使用します。outlet_id、customer_id、min_total でフィルタリングします。

lightspeed_inventory_report

手持ち在庫を、商品名と店舗名に結合し、棚にあるものの小売価値と原価価値を表示します。

重要になるのは status 引数です:

status

意味

low_stock

まだ販売可能ただし再注文点以下。少なくなっているもの。

reorder_needed

再注文点以下。2024ゼロやマイナスを含む。完全な仕入先リスト。

out_of_stock

正確にゼロ。

negative

ゼロ未満、つまり在庫数の誤りを示します。

in_stock / all

ゼロより多い / すべて。

group_by は product、outlet、category、brand、supplier に展開できます。これにより、「各カテゴリにどれくらいの在庫価値があるか」という質問に答えます。

lightspeed_search_products

名前、バリアント名、SKU、ハンドルを対象にしたフリーテキスト検索で、ブランド / サプライヤ / カテゴリ / タグのフィルタが付いています。APIの検索エンドポイントは検索品質が低いため、キャッシュされたカタログに対してローカルで正確な部分文字列一致を行います。

lightspeed_get_product

IDまたは完全一致のSKUで、1つの商品の詳細を返します。店舗ごとの在庫と起算済みマージンさあらため含みます。

lightspeed_search_customers / lightspeed_get_customer

メールアドレス(APIに送信)、または名前・電話番号・顧客コード(問い合わせコード)で顧客を検索します。販売ツールが customer_id フィルタとして受け取るUUIDを返します。このツールは個人データを返します。それに応じて取り扱ってください。

lightspeed_list_outlets / lightspeed_list_registers / lightspeed_list_accounts

ストア名を、レポートフィルたが受け取る店舗UUIDに変換します。POSレーンを(eコマースレジスタ含む)一覧表示し、サーバーが到達できるアカウントを確認します。lightspeed_list_accounts がトークンを返すことはありません。

lightspeed_list_reference_data

brands、suppliers、product_categories、tags、customer_groups、payment_types、promotions、taxes、users をまとめて扱う 1 つのツールです。レポートを絞り込む前に、ブランドやカテゴリの正確なスペルを確認するために使用します。

lightspeed_api_get

専用ツールがない任意のエンドポイントのための脱出ハッチです: /consignments、/price_books、/serial_numbers など。送信されるのは GET のみです。


パフォーマンスと制限

売上はサーバー側で日付によるフィルタリングができないため、レポートはその影響を受けます。

クエリ

一般的なコールドタイム

1 日分、全店舗 (~900 件の売上)

初回は 15〜20 秒、その後は約 2 秒

1 週間分 (~5,900 件の売上)

約 20 秒

在庫全体のスキャン (~126,000 行)

初回は約 25 秒、その後は即時

商品 / 店舗 / リファレンスの検索

初回以降は 1 秒未満

初回呼び出しの大部分は、日付範囲を特定するための約 30 回の単一行プローブです。このプローブはアカウントごとに記憶されるため、セッション内の 2 回目以降のレポートでは通常不要です。カタログ、店舗、レジ、ユーザー、在庫のスキャンは 15 分間キャッシュされます。

高速に保つには: 1 つの店舗だけを対象にする場合は outlet_id を渡し、日付範囲は狭めにしてください。LIGHTSPEED_MAX_SALES(デフォルト 200,000)は 1 回の呼び出しの上限を設定し、ツールは結果を切り詰めた場合、黙って不完全な回答を返すのではなく、その旨を明確に伝えます。

正直な注意点。 日付範囲はバージョンによって特定されるため、範囲より前に作成され、範囲より後に編集された売上は見落とされる可能性があります。LIGHTSPEED_SEEK_MARGIN_DAYS(デフォルト 1)は、検索が範囲より前のどのあたりを目標にするかを設定します。この値を上げると、より多くのレコードをスキャンするコストと引き換えに、安全網を広げられます。これは日付で絞り込めない API に本来備わる特性であり、ここで手を抜いたわけではありません。


設定リファレンス

変数

デフォルト

用途

LIGHTSPEED_DOMAIN

必須

ストアのプレフィックス、ホスト、または URL

LIGHTSPEED_TOKEN

必須

パーソナルトークン

LIGHTSPEED_<NAME>_DOMAIN / _TOKEN

省略可

追加の名前付きアカウント

LIGHTSPEED_DEFAULT_ACCOUNT

最初のアカウント

ツールが account を省略したときに使用されるアカウント

LIGHTSPEED_API_VERSION

2026-01

API バージョンのパスセグメント

LIGHTSPEED_MAX_SALES

200000

販売呼び出しごとの安全上限

LIGHTSPEED_SEEK_MARGIN_DAYS

1

バージョンアンカーを探すときの余裕日数

LIGHTSPEED_ENV_FILE

省略可

資格情報ファイルの明示的なパス。プラグインはこれを ${CLAUDE_PLUGIN_DATA}/credentials.env に設定します


開発

npm run dev      # run from source with tsx
npm run build    # compile to dist/
npm run inspect  # MCP Inspector against the built server
npm run doctor   # credentials + live connectivity check
npm run validate-plugin  # validate the plugin manifests
src/
  index.ts            entry point, env loading, tool registration
  config.ts           account discovery from the environment
  lib/
    client.ts         HTTP client, retry, version pagination
    version-seek.ts   date to version binary search
    sales.ts          sale fetching and metric aggregation
    catalog.ts        cached product, outlet, register, inventory lookups
    time.ts           timezone-aware day boundaries
    format.ts         Markdown table rendering, tool results
  tools/              one file per tool group

ツールは未焼成の JSON ではなく Markdown テーブルを返します。モデルは深く入れ子になった JSON のブロックよりも、整理されたテーブルの方が確実に読み取れ、トークン消費も抑えられます。基になる数値は、プログラムから呼び出す向利用者向けに structuredContent にも格納されます。

貢献する際に守る価値のある 2 つの慣習があります:

  • ツールハンドラーから例外を投げない。 失敗は isError の結果として返します。guard() のラッパーがこれを強制します。

  • console.log を発行しない。 標準出力は JSON-RPC フレームを伝送します。診断情報は console.error に出力します。


リポジトリ構成

.claude-plugin/     plugin + marketplace manifests
.mcp.json           MCP server declaration used by the plugin path
skills/setup/       guided connection walkthrough
skills/reports/     how to answer retail questions with these tools
src/                TypeScript source
dist/               compiled output, committed so plugin installs need no build

dist/ は意図的に git で追跡されています。Claude Code プラグインのインストールではビルドステップが実行されず、コンパイル済みサーバーをリポジトリに同梱して提供する必要があるためです。ソースの変更をコミットする前に npm run build を実行し、リリース時には package.json、.claude-plugin/plugin.json、.claude-plugin/marketplace.json の version をまとめて更新してください。

ライセンス

MIT。ライセンスは ライセンス を参照してください。

Lightspeed Commerce とは提携していませんし、その推奨も受けていません。

Available Tools

1 tool
lightspeed_setup_statusLightspeed setup statusA
Read-only

Report whether this server has working Lightspeed credentials, and if not, the exact file path to create and what to put in it. Call this first when any Lightspeed tool fails with a credential error, when the user says Lightspeed is not connected, or when setting the server up for the first time. Safe to call at any time and never returns the token itself.

NameRequiredDescriptionDefault

No parameters

TDQS

A4.7/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already mark readOnlyHint=true and openWorldHint=true, so the description need not restate safety labels. It adds valuable context: the tool never returns the token itself, and it reports the exact file path and content to create when credentials are absent. This is a useful disclosure beyond the structured hints, warranting a 4.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences, front-loaded with the core purpose, then usage conditions, then a safety note. Every word earns its place; there is no fluff or repeated information. Ideal conciseness for a tool of this simplicity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool is simple (no parameters, no output schema) and the description covers everything an agent needs to call it correctly: the exact condition to invoke it, what it reveals (success or failure plus remediation info), and its non-sensitive nature. Nothing is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With zero parameters, the schema is trivially covered at 100%, and the rubric sets a baseline of 4 for this case. The description adds no parameter-specific meaning, but nothing is missing—there is nothing to document. The baseline score is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a precise statement of what the tool does: report whether the server has working Lightspeed credentials and, if not, provide the exact file path and content to fix it. This is a specific verb-resource pair that leaves no doubt about the tool's role, and it stands alone clearly even without siblings.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives explicit, actionable usage guidance: call this first when a Lightspeed tool fails with a credential error, when the user reports Lightspeed is not connected, or during initial setup. It also notes the tool is safe to call at any time, covering both when to use and the absence of constraints.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 1 tool updatev1.2.0
    • First observedlightspeed_setup_status

TDQS

A4.2/5.0

Scored across 1 tool

Disambiguation5/5

With only one tool, there is no possibility of confusion or overlap between tool purposes. The tool's role as a credential/setup status check is clearly defined.

Naming Consistency5/5

A single tool name cannot exhibit inconsistency. 'lightspeed_setup_status' is descriptive, snake_case, and follows a predictable pattern for this server.

Tool Count1/5

A single setup/status tool is an extreme mismatch for a server named 'lightspeed-x'. The tool explicitly references other Lightspeed tools that do not exist, making the surface feel incomplete and unbalanced.

Completeness1/5

The server provides no actual Lightspeed operations—only a credential status check. This is severely incomplete for a Lightspeed integration domain and leaves agents with no way to perform real tasks.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    C
    quality
    B
    maintenance
    Enables Claude or any MCP client to query a Toast POS using plain English, with 55 read-only tools covering orders, sales, labor, employees, menus, inventory, customers, and cash.
    55
    2
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables AI assistants to query a retail and food-service point-of-sale database through predefined business tools for sales summaries, top products, margins, stagnant inventory, cash reconciliation, and optional stock adjustments, returning formatted markdown answers.
    MIT
  • A
    license
    B
    quality
    A
    maintenance
    Enables Claude and other MCP clients to read and write a Loyverse point-of-sale account, covering catalogue items, inventory levels, loyalty customers, receipts and refunds through natural language. Includes a one-call sales summary that aggregates any date range into totals and ranked breakdowns by day, item, category, payment type, employee or store.
    41
    MIT
  • A
    license
    C
    quality
    C
    maintenance
    Enables asking questions in plain language about a Lightspeed Retail store's sales, revenue, stock, products, customers, promotions, and purchase orders, with local-time date handling and readable summaries. It is read-only by construction, so it can retrieve data but never write to the account.
    35
    MIT