Skip to main content
Glama
nta-invoice-mcp

nta-invoice-mcp

by koizumikento

nta-invoice-mcp

国税庁のインボイス公表情報を、MCP・CLI・Pythonから照会できます。取引日時点の登録状況を最大10件まとめて確認でき、登録番号ごとの公表履歴も取得できます。

MCP登録 · CLI · Pythonライブラリ

利用前に

uv と Git が必要です。Python 3.12以上に対応しています。国税庁への届出で発行されたインボイスWeb-API用のアプリケーションIDが必要です。下の例の YOUR_NTA_INVOICE_APP_ID を手元の設定で差し替えてください。

Related MCP server: jp-invoice-check

MCPクライアントに登録する

公開GitHubリポジトリから uvx で起動します。初回は依存関係の準備に時間がかかることがあります。

Codex

codex mcp add nta-invoice-mcp --env "NTA_INVOICE_APP_ID=YOUR_NTA_INVOICE_APP_ID" -- uvx --python 3.12 --from git+https://github.com/koizumikento/nta-invoice-mcp.git@main nta-invoice-mcp
codex mcp list

新しいセッションで /mcp を開くと、接続を確認できます。デスクトップ版では設定の「MCP servers」で、下のJSON例と同じコマンド・引数・環境変数を指定できます。Codexの公式設定ガイド

Claude Desktop / Cursor

  • Claude Desktop(Windows) %APPDATA%/Claude/claude_desktop_config.json

  • Claude Desktop(macOS) ~/Library/Application Support/Claude/claude_desktop_config.json

  • Cursor .cursor/mcp.json(プロジェクト内)

設定ファイルの mcpServers に項目を追加して、クライアントを再起動してください。uvx が見つからない場合は、実行ファイルの絶対パスを指定します。

{
  "mcpServers": {
    "nta-invoice-mcp": {
      "command": "uvx",
      "args": ["--python", "3.12", "--from", "git+https://github.com/koizumikento/nta-invoice-mcp.git@main", "nta-invoice-mcp"],
      "env": {"NTA_INVOICE_APP_ID": "YOUR_NTA_INVOICE_APP_ID"}
    }
  }
}

登録後の質問例

この取引先のインボイス登録番号について、2024年4月1日時点の公表上の登録状況と出典を確認して。

この取引先の登録履歴から、取消日や失効日が公表されているか確認して。

MCPツール

ツール

用途

引数

lookup_invoice_registration

1件の登録状況を指定日で確認する

registration_number, day

lookup_invoice_registrations

最大10件の登録状況を同じ日付で確認する

registration_numbers(配列), day

get_invoice_registration_history

1件の公表履歴を取得する

registration_number

登録番号は T と13桁の数字、日付は YYYY-MM-DD です。指定日の照会結果は status で確認できます。

値

意味

registered

指定日は登録期間内

not_registered

指定日は登録期間外

no_record

指定条件に合う公表情報がない

unknown

公表情報はあるが、登録日がないため判定できない

一括照会では、公表情報が見つからなかった番号も含めて入力順に返します。

履歴は古い順に返します。各行に名称・登録日・取消日・失効日・更新日があり、process_code で新規("01")、公表内容の変更("02")、失効("03")、取消("04")を確認できます。latest が "1" の行は最新、"0" は過去の履歴です。各ツールはデータの最終更新日と出典も返します。

CLIで使う

CLIやPythonを実行するシェルで環境変数を設定します。

$env:NTA_INVOICE_APP_ID = "YOUR_NTA_INVOICE_APP_ID"

macOSやLinuxのシェルでは export NTA_INVOICE_APP_ID="YOUR_NTA_INVOICE_APP_ID" を使います。

結果は標準出力にUTF-8のJSONで返ります。下の番号は形式例です。実際に照会したい登録番号に差し替えてください。

uvx --python 3.12 --from git+https://github.com/koizumikento/nta-invoice-mcp.git@main nta-invoice-mcp lookup-invoice-registration --registration-number T0000000000000 --day 2024-04-01
uvx --python 3.12 --from git+https://github.com/koizumikento/nta-invoice-mcp.git@main nta-invoice-mcp lookup-invoice-registrations --registration-numbers T0000000000000 T0000000000001 --day 2024-04-01
uvx --python 3.12 --from git+https://github.com/koizumikento/nta-invoice-mcp.git@main nta-invoice-mcp get-invoice-registration-history --registration-number T0000000000000

Pythonライブラリとして使う

自分のPythonプロジェクト(pyproject.toml があるディレクトリ)で依存関係に追加します。CLIで使うと同様に、実行するシェルで NTA_INVOICE_APP_ID を設定してください。

uv add "git+https://github.com/koizumikento/nta-invoice-mcp.git@main"

次のコードを example.py に保存し、同じディレクトリで uv run python example.py を実行します。

import asyncio

from nta_invoice_mcp import (
    get_invoice_registration_history,
    lookup_invoice_registration,
    lookup_invoice_registrations,
)

number = "T0000000000000"
day = "2024-04-01"
print(asyncio.run(lookup_invoice_registration(number, day)))
print(asyncio.run(lookup_invoice_registrations([number, "T0000000000001"], day)))
print(asyncio.run(get_invoice_registration_history(number)))

すでにイベントループがある場合は、関数を直接 await してください。

出典と利用条件

コードはMIT Licenseです。照会結果を扱う場合は、個人事業者の情報を含め、国税庁の利用規約に従って管理してください。

照会には登録番号を指定します。期間を指定した全件差分の取得には対応していません。

このサービスは、適格請求書発行事業者公表システムWeb-API機能を利用して取得した情報をもとに作成しているが、サービスの内容は国税庁によって保証されたものではない。

公式API案内 · リクエスト・応答仕様 · Web-API利用規約

開発

uv sync --locked
uv run ruff check .
uv run ty check
uv run pytest
uv build

Available Tools

3 tools
get_invoice_registration_historyA
Read-onlyIdempotent

Read published registration, cancellation and expiry history for one number.

Inputs: registration_number (required). Returns: object

lookup_invoice_registrationB
Read-onlyIdempotent

Look up one Japanese invoice registration number on a specified date (YYYY-MM-DD).

Inputs: day (required), registration_number (required). Returns: object

lookup_invoice_registrationsB
Read-onlyIdempotent

Look up up to ten Japanese invoice registration numbers on one date (YYYY-MM-DD).

Inputs: day (required), registration_numbers (required). Returns: object

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 3 tools

    Disambiguation3/5

    lookup_invoice_registration and lookup_invoice_registrations differ only by a trailing 's', so an agent must read descriptions carefully to avoid selecting the wrong one; the batch variant's 'up to ten' limit is the only real discriminator. The history tool is clearly distinct. Boundaries are workable but the singular/plural pair invites misselection.

    Naming Consistency4/5

    All three follow a recognizable verb_noun pattern (lookup_*, get_*_history) with consistent snake_case. The only deviation is the near-identical singular/plural naming of the two lookup tools, which is consistent with convention but makes the pair harder to distinguish than ideal.

    Tool Count4/5

    Three tools for a narrow, single-purpose domain (Japanese invoice registration lookup) is well-scoped and each tool earns its place. One could argue the batch lookup could be folded into the single lookup, but the count itself is not excessive or thin.

    Completeness3/5

    The surface covers single lookup, batch lookup, and historical/status data for one number, but has notable gaps: no reverse lookup by registrant name or entity, no batch history retrieval, and no way to list or search registrations. Agents can handle the core validity check but will dead-end on discovery-style queries.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Enables AI assistants to access and compare Japanese public data from e-Stat, corporate registration, real estate, and invoice APIs, automatically converting codes into human-readable formats with sources and timestamps.
      14
      39 PyPI
      13
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables AI agents to validate a Japanese qualified invoice against the six required items, reduced-rate markings, per-rate totals, and once-per-invoice-per-rate tax rounding, while flagging the common line-by-line rounding mistake, and to normalize and verify T + 13-digit registration numbers. Read-only tools also compute expected consumption tax for a given amount, rate, price basis, and rounding method.
      3
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables AI assistants to identify Japanese companies by name, look up corporate numbers, addresses, and qualified invoice registration status, and batch-match company lists using read-only tools.
      4
      644 npm
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables lookup of any of Japan's 5.8M registered 13-digit corporate numbers for legal name, katakana/English name, address, corporate kind and merger/closure status, with check-digit validation and clear reasons for malformed or missing numbers. Also supports company search by Japanese or romanised name, corporate suffix, and prefecture, bridging to GLEIF LEI records when the tax agency published no English name.
      65 npm
      MIT