mcpField
S
Stripe Tax and Invoices API MCP Server

Stripe Tax and Invoices API MCP Server

ローカル
github.com/ghassansalloum金融データ081 週間前に更新

Stripe Tax and Invoices API MCP Server について

税務設定、税額計算、商品税コード、請求書データを管理するチーム向けの、Stripe Tax と Invoices API 用 MCP サーバーです。ツールに加え、リソースとプロンプトを通じて取得と変更を行えます。

主な機能

  1. 01税務設定の取得と更新
  2. 02税額計算の作成と取得
  3. 03計算明細の一覧表示
  4. 04商品税コードの取得と更新
  5. 05請求書の一覧と詳細取得
  6. 06税務・請求書のリソースとプロンプト

活用シーン

  1. 01Stripe の税務管轄設定の確認や変更
  2. 02顧客の明細項目に基づく税額計算
  3. 03Stripe 商品への税コードの関連付け
  4. 04請求書の検索と明細項目の確認

MCP 対応

ツールを通じて Stripe の税務・請求書操作を MCP クライアントに公開し、情報リソースとタスク用プロンプトも提供します。

設定

ローカルサーバーの設定はどのクライアントでも共通です。コピーしてクライアントの MCP 設定ファイルに貼り付けてください。

インストール方法は未掲載です

このサーバーのパッケージやリモートエンドポイントはまだ取得できていません。プロジェクトの README の手順に従ってください。

リポジトリ

ツール

ツール一覧はまだ取得されていません

ローカルサーバーのツールはマシン上で起動して初めて取得できます。メンテナーはまだツール一覧を提供していません。

詳細

Stripe Tax and Invoices API MCP サーバー

Stripe Tax and Invoices API と連携し、税設定、税計算、請求書データを取得および変更する Model Context Protocol(MCP)サーバーです。

インストール

前提条件
  • Node.js(v16 以降)
  • npm(v6 以降)
  • API アクセスが可能な Stripe アカウント
インストール手順
  1. リポジトリをクローンします。

    git clone <repository-url>
    cd stripe-tax-api-mcp-server
    
  2. 依存関係をインストールします。

    npm install
    

    (npm install @modelcontextprotocol/sdk も実行する必要がある場合があります)

  3. 環境変数を設定します。

    cp .env.example .env
    
  4. .env ファイルを編集し、Stripe API キーを追加します。

    STRIPE_API_KEY=sk_test_your_test_key_here
    

    ⚠️ 重要:サンプルファイルに含まれているテスト API キーは有効期限が切れています。Stripe アカウントから取得した有効な API キーを必ず指定してください。

  5. サーバーを起動します。

    npm start
    

設定オプション

サーバーは環境変数を使って設定できます。

  1. Stripe API キー:
    • .env ファイルで STRIPE_API_KEY として API キーを設定します
    • または、各ツールの呼び出し時に API キーを指定できます
    • 本番環境では、税関連の権限のみを持つ制限付き API キーを使用してください
    • 開発環境では、Stripe ダッシュボードから取得したテスト API キーを使用できます
Claude Desktop の特別なインストール手順
  • claude_desktop_config.json ファイルを編集します(Claude -> Settings -> Developer -> Edit Config)
  • 以下を貼り付けます:
"stripe-tax": {
      "command": "node",
      "args": [
        "/<PATH_TO_YOUR_CLONED>/stripe-tax-mcp-server"
      ],
      "env": {
        "STRIPE_API_KEY": "<YOUR_API_KEY>"
      }
    }

使用例

この MCP サーバーは、設定、税計算、商品税コードの関連付けを行うための Stripe Tax API 連携ツールを提供します。

ツール
1. getTaxSettings

Stripe から現在の税設定を取得します。

パラメーター:

  • apiKey(省略可):Stripe API キーです。指定しない場合は、環境変数の API キーが使用されます。

例:

{
  "name": "getTaxSettings",
  "arguments": {}
}

API キーを指定する例:

{
  "name": "getTaxSettings",
  "arguments": {
    "apiKey": "sk_test_your_stripe_key"
  }
}

レスポンス:

{
  "default_tax_jurisdiction": "US",
  "head_office": {
    "address": {
      "country": "US",
      "line1": "123 Main St",
      "city": "San Francisco",
      "state": "CA",
      "postal_code": "94105"
    }
  },
  "tax_id": {
    "type": "us_ein",
    "value": "12-3456789"
  },
  "status": {
    "active": true
  }
}
2. updateTaxSettings

Stripe の税設定を更新します。

パラメーター:

  • apiKey(省略可):Stripe API キーです。指定しない場合は、環境変数の API キーが使用されます。
  • settings:更新する税設定を含むオブジェクトです
    • default_tax_jurisdiction:税計算のデフォルトの国
    • head_office:会社の住所情報
    • tax_id:納税者識別情報

環境変数の API キーを使用する例:

{
  "name": "updateTaxSettings",
  "arguments": {
    "settings": {
      "default_tax_jurisdiction": "CA",
      "tax_id": {
        "type": "ca_bn",
        "value": "123456789"
      }
    }
  }
}

明示的に API キーを指定する例:

{
  "name": "updateTaxSettings",
  "arguments": {
    "apiKey": "sk_test_your_stripe_key",
    "settings": {
      "default_tax_jurisdiction": "CA",
      "tax_id": {
        "type": "ca_bn",
        "value": "123456789"
      }
    }
  }
}
3. retrieveTaxCalculation

ID を指定して、Stripe から税計算を取得します。

パラメーター:

  • apiKey(省略可):Stripe API キーです。指定しない場合は、環境変数の API キーが使用されます。
  • calculationId:取得する税計算の ID です

環境変数の API キーを使用する例:

{
  "name": "retrieveTaxCalculation",
  "arguments": {
    "calculationId": "taxcalc_12345"
  }
}

明示的に API キーを指定する例:

{
  "name": "retrieveTaxCalculation",
  "arguments": {
    "apiKey": "sk_test_your_stripe_key",
    "calculationId": "taxcalc_12345"
  }
}

レスポンス:

{
  "id": "taxcalc_12345",
  "object": "tax.calculation",
  "amount_total": 1090,
  "currency": "usd",
  "customer_details": {
    "address": {
      "country": "US",
      "line1": "123 Main St",
      "city": "San Francisco",
      "state": "CA",
      "postal_code": "94105"
    },
    "address_source": "shipping",
    "tax_ids": []
  },
  "line_items_subtotal_amount": 1000,
  "shipping_cost_subtotal_amount": 0,
  "tax_amount_exclusive": 90,
  "tax_amount_inclusive": 0,
  "tax_breakdown": [
    {
      "amount": 60,
      "jurisdiction": "California",
      "sourcing": "destination",
      "tax_type": "sales_tax"
    },
    {
      "amount": 30,
      "jurisdiction": "San Francisco",
      "sourcing": "destination", 
      "tax_type": "local_tax"
    }
  ],
  "tax_date": "2023-01-15",
  "expires_at": 1673913600
}
4. createTaxCalculation

Stripe で新しい税計算を作成します。

パラメーター:

  • apiKey(省略可):Stripe API キーです。指定しない場合は、環境変数の API キーが使用されます。
  • params:税計算のパラメーターを含むオブジェクトです。
    • currency:計算に使用する通貨(例:'usd')
    • customer_details:住所および任意の税 ID を含む顧客情報
    • line_items:金額と任意の税コードを含む明細項目の配列

環境変数の API キーを使用する例:

{
  "name": "createTaxCalculation",
  "arguments": {
    "params": {
      "currency": "usd",
      "customer_details": {
        "address": {
          "country": "US",
          "line1": "123 Main St",
          "city": "San Francisco",
          "state": "CA",
          "postal_code": "94105"
        },
        "address_source": "shipping",
        "tax_ids": [
          {
            "type": "us_ein",
            "value": "12-3456789"
          }
        ]
      },
      "line_items": [
        {
          "amount": 1000,
          "reference": "product_123",
          "tax_code": "txcd_30060006",
          "tax_behavior": "exclusive"
        }
      ]
    }
  }
}

明示的に API キーを指定する例:

{
  "name": "createTaxCalculation",
  "arguments": {
    "apiKey": "sk_test_your_stripe_key",
    "params": {
      "currency": "usd",
      "customer_details": {
        "address": {
          "country": "US",
          "line1": "123 Main St",
          "city": "San Francisco",
          "state": "CA",
          "postal_code": "94105"
        },
        "address_source": "shipping",
        "tax_ids": [
          {
            "type": "us_ein",
            "value": "12-3456789"
          }
        ]
      },
      "line_items": [
        {
          "amount": 1000,
          "reference": "product_123",
          "tax_code": "txcd_30060006",
          "tax_behavior": "exclusive"
        }
      ]
    }
  }
}

レスポンス:

{
  "id": "taxcalc_12345",
  "object": "tax.calculation",
  "amount_total": 1090,
  "currency": "usd",
  "customer_details": {
    "address": {
      "country": "US",
      "line1": "123 Main St",
      "city": "San Francisco",
      "state": "CA",
      "postal_code": "94105"
    },
    "tax_ids": [
      {
        "type": "us_ein",
        "value": "12-3456789"
      }
    ]
  },
  "line_items_subtotal_amount": 1000,
  "shipping_cost_subtotal_amount": 0,
  "tax_amount_exclusive": 90,
  "tax_amount_inclusive": 0,
  "tax_breakdown": [
    {
      "amount": 60,
      "jurisdiction": "California",
      "sourcing": "destination",
      "tax_type": "sales_tax"
    },
    {
      "amount": 30,
      "jurisdiction": "San Francisco",
      "sourcing": "destination", 
      "tax_type": "local_tax"
    }
  ],
  "tax_date": "2023-01-15",
  "expires_at": 1673913600
}
5. listTaxCalculationLineItems

ID を指定して、Stripe から税計算の明細項目を取得します。

パラメーター:

  • apiKey(省略可):Stripe API キーです。指定しない場合は、環境変数の API キーが使用されます。
  • calculationId:明細項目を取得する税計算の ID
  • limit(省略可):返す明細項目の最大数
  • starting_after(省略可):前回のリストの続きから取得するためのページネーションカーソル
  • ending_before(省略可):この ID より前の結果を返すためのページネーションカーソル

環境変数の API キーを使用する例:

{
  "name": "listTaxCalculationLineItems",
  "arguments": {
    "calculationId": "taxcalc_12345",
    "limit": 3
  }
}

API キーを明示的に指定する例:

{
  "name": "listTaxCalculationLineItems",
  "arguments": {
    "apiKey": "sk_test_your_stripe_key",
    "calculationId": "taxcalc_12345",
    "limit": 3
  }
}

レスポンス:

{
  "object": "list",
  "url": "/v1/tax/calculations/taxcalc_12345/line_items",
  "has_more": false,
  "data": [
    {
      "id": "li_1NpJD42eZvKYlo2CxyzABC",
      "object": "tax.calculation_line_item",
      "amount": 1000,
      "amount_tax": 100,
      "livemode": false,
      "product": "prod_12345",
      "quantity": 1,
      "reference": "product_123",
      "tax_behavior": "exclusive",
      "tax_breakdown": [
        {
          "amount": 70,
          "jurisdiction": "California",
          "sourcing": "destination",
          "tax_rate_details": {
            "percentage_decimal": "0.07",
            "tax_type": "sales_tax"
          },
          "taxability_reason": "standard",
          "taxable_amount": 1000
        },
        {
          "amount": 30,
          "jurisdiction": "San Francisco",
          "sourcing": "destination",
          "tax_rate_details": {
            "percentage_decimal": "0.03",
            "tax_type": "local_tax"
          },
          "taxability_reason": "standard",
          "taxable_amount": 1000
        }
      ],
      "tax_code": "txcd_30060006",
      "taxable_amount": 1000
    }
  ]
}
6. updateProductTaxCode

Stripe の商品を更新し、税コードを関連付けます。

パラメーター:

  • apiKey(省略可):Stripe API キーです。指定しない場合は、環境変数の API キーが使用されます。
  • productId:更新する商品の ID
  • taxCode:商品に関連付ける税コード(例:'txcd_30060006')

環境変数の API キーを使用する例:

{
  "name": "updateProductTaxCode",
  "arguments": {
    "productId": "prod_123456",
    "taxCode": "txcd_30060006"
  }
}

API キーを明示的に指定する例:

{
  "name": "updateProductTaxCode",
  "arguments": {
    "apiKey": "sk_test_your_stripe_key",
    "productId": "prod_123456",
    "taxCode": "txcd_30060006"
  }
}

レスポンス:

{
  "id": "prod_123456",
  "object": "product",
  "active": true,
  "created": 1681234567,
  "description": "Premium Widget",
  "images": [],
  "tax_code": "txcd_30060006",
  "name": "Widget Pro",
  "updated": 1681234789
}
7. getProductTaxCode

Stripe から商品と、関連付けられた税コードを取得します。

パラメーター:

  • apiKey(省略可):Stripe API キーです。指定しない場合は、環境変数の API キーが使用されます。
  • productId:取得する商品の ID

環境変数の API キーを使用する例:

{
  "name": "getProductTaxCode",
  "arguments": {
    "productId": "prod_123456"
  }
}

API キーを明示的に指定する例:

{
  "name": "getProductTaxCode",
  "arguments": {
    "apiKey": "sk_test_your_stripe_key",
    "productId": "prod_123456"
  }
}

レスポンス:

{
  "product": {
    "id": "prod_123456",
    "object": "product",
    "active": true,
    "created": 1681234567,
    "description": "Premium Widget",
    "images": [],
    "tax_code": "txcd_30060006",
    "name": "Widget Pro",
    "updated": 1681234789
  },
  "tax_code": "txcd_30060006",
  "has_tax_code": true
}
8. listInvoices

Stripe から請求書のリストを取得します。

パラメーター:

  • apiKey(省略可):Stripe API キーです。指定しない場合は、環境変数の API キーが使用されます。
  • limit(省略可):返す請求書の最大数
  • customer(省略可):絞り込みに使用する顧客 ID
  • status(省略可):絞り込みに使用する請求書のステータス('draft'、'open'、'paid'、'uncollectible'、'void')
  • starting_after(省略可):前回のリストの続きから取得するためのページネーションカーソル
  • ending_before(省略可):この ID より前の結果を返すためのページネーションカーソル

環境変数の API キーを使用する例:

{
  "name": "listInvoices",
  "arguments": {
    "limit": 5,
    "customer": "cus_123456"
  }
}

API キーを明示的に指定する例:

{
  "name": "listInvoices",
  "arguments": {
    "apiKey": "sk_test_your_stripe_key",
    "limit": 5,
    "status": "paid"
  }
}

レスポンス:

{
  "object": "list",
  "url": "/v1/invoices",
  "has_more": true,
  "data": [
    {
      "id": "in_1234567890",
      "object": "invoice",
      "account_country": "US",
      "account_name": "Your Company",
      "amount_due": 10000,
      "amount_paid": 10000,
      "amount_remaining": 0,
      "customer": "cus_123456",
      "currency": "usd",
      "status": "paid",
      "total": 10000,
      "subtotal": 9500,
      "tax": 500
    },
    {
      "id": "in_0987654321",
      "object": "invoice",
      "account_country": "US",
      "account_name": "Your Company",
      "amount_due": 5000,
      "amount_paid": 5000,
      "amount_remaining": 0,
      "customer": "cus_123456",
      "currency": "usd",
      "status": "paid",
      "total": 5000,
      "subtotal": 4750,
      "tax": 250
    }
  ]
}
9. retrieveInvoice

ID を指定して、Stripe から特定の請求書を取得します。

パラメーター:

  • apiKey(省略可):Stripe API キーです。指定しない場合は、環境変数の API キーが使用されます。
  • invoiceId:取得する請求書の ID

環境変数の API キーを使用する例:

{
  "name": "retrieveInvoice",
  "arguments": {
    "invoiceId": "in_1234567890"
  }
}

API キーを明示的に指定する例:

{
  "name": "retrieveInvoice",
  "arguments": {
    "apiKey": "sk_test_your_stripe_key",
    "invoiceId": "in_1234567890"
  }
}

レスポンス:

{
  "id": "in_1234567890",
  "object": "invoice",
  "account_country": "US",
  "account_name": "Your Company",
  "amount_due": 10000,
  "amount_paid": 10000,
  "amount_remaining": 0,
  "customer": "cus_123456",
  "currency": "usd",
  "status": "paid",
  "total": 10000,
  "subtotal": 9500,
  "tax": 500,
  "lines": {
    "object": "list",
    "data": [
      {
        "id": "il_1234567890",
        "object": "line_item",
        "amount": 9500,
        "currency": "usd",
        "description": "Premium Plan",
        "quantity": 1,
        "tax_amounts": [
          {
            "amount": 500,
            "inclusive": false,
            "tax_rate": "txr_1234567890"
          }
        ]
      }
    ],
    "has_more": false,
    "url": "/v1/invoices/in_1234567890/lines"
  }
}
10. retrieveInvoiceLineItems

Stripe から請求書の明細項目を取得します。

パラメーター:

  • apiKey(省略可):Stripe API キーです。指定しない場合は、環境変数の API キーが使用されます。
  • invoiceId:明細項目を取得する請求書の ID
  • limit(省略可):返す明細項目の最大数
  • starting_after(省略可):前回のリストの続きから取得するためのページネーションカーソル
  • ending_before(省略可):この ID より前の結果を返すためのページネーションカーソル

環境変数の API キーを使用する例:

{
  "name": "retrieveInvoiceLineItems",
  "arguments": {
    "invoiceId": "in_1234567890",
    "limit": 10
  }
}

API キーを明示的に指定する例:

{
  "name": "retrieveInvoiceLineItems",
  "arguments": {
    "apiKey": "sk_test_your_stripe_key",
    "invoiceId": "in_1234567890",
    "limit": 10
  }
}

レスポンス:

{
  "object": "list",
  "url": "/v1/invoices/in_1234567890/lines",
  "has_more": false,
  "data": [
    {
      "id": "il_1234567890",
      "object": "line_item",
      "amount": 9500,
      "currency": "usd",
      "description": "Premium Plan",
      "quantity": 1,
      "tax_amounts": [
        {
          "amount": 500,
          "inclusive": false,
          "tax_rate": "txr_1234567890"
        }
      ]
    }
  ]
}
リソース

サーバーは以下のリソースを提供します。

  1. stripe-tax://info:Stripe Tax に関する一般情報
  2. stripe-tax://documentation:Stripe Tax のドキュメントおよび Stripe Invoices のドキュメントへの参照
プロンプト

サーバーでは、次のプロンプトを利用できます。

  1. get-tax-settings:税設定を取得するためのプロンプト
  2. update-tax-settings:税設定を更新するためのプロンプト
  3. retrieve-tax-calculation:ID を指定して税計算を取得するためのプロンプト
  4. create-tax-calculation:新しい税計算を作成するためのプロンプト
  5. list-tax-calculation-line-items:ID を指定して税計算の明細項目を取得するためのプロンプト
  6. update-product-tax-code:税コードを指定して商品を更新するためのプロンプト
  7. get-product-tax-code:商品の税コードを取得するためのプロンプト
  8. list-invoices:任意のフィルターを指定して請求書の一覧を取得するためのプロンプト
  9. retrieve-invoice:ID を指定して特定の請求書を取得するためのプロンプト
  10. retrieve-invoice-line-items:特定の請求書の明細項目を取得するためのプロンプト

よくあるトラブルシューティング

API 認証の問題

問題:ツールの使用時に「Authentication failed」エラーが発生します。

解決策:

  • API キーが有効で、正しい形式であることを確認します
  • API キーに必要な権限があるか確認します
  • 制限付きキーの場合、税関連のエンドポイントにアクセスできることを確認します
レート制限

問題:レート制限エラーにより API リクエストが拒否されます。

解決策:

  • リトライ処理に指数バックオフを実装します
  • API 呼び出しの頻度を減らします
  • より高い制限が必要な場合は、Stripe アカウントのアップグレードを検討します
データ検証エラー

問題:サーバーが税設定の更新を拒否します。

解決策:

  • 必須フィールドがすべて正しい形式で指定されていることを確認します
  • 国コードが有効な ISO コード(例:「US」、「CA」、「GB」)であることを確認します
  • 税 ID の種類が、該当する管轄区域で想定される形式と一致していることを確認します
API キーの問題

問題:「No API key provided」というエラーメッセージが表示されます。

解決策:

  • STRIPE_API_KEY を設定した .env ファイルを作成したことを確認します
  • または、メソッドの呼び出し時に API キーを直接指定します
  • API キーに Stripe Tax の操作に必要な権限があることを確認します
接続の問題

問題:MCP サーバーに接続できません。

解決策:

  • サーバーが実行中であることを確認します(コンソール出力を確認してください)
  • クライアントが MCP プロトコルを正しく実装していることを確認します
  • 接続のデバッグには MCP Inspector ツールをお試しください
  • claude_desktop_config.json 内のパスが正しいことを確認します

セキュリティに関する考慮事項

  • Stripe API キーをコードに決してハードコードしないでください
  • API キーの保存には .env ファイル経由の環境変数を使用します
  • 本番環境では、必要な権限のみを持つ制限付き API キーを使用します
  • セキュリティ強化のため、API キーのローテーションを検討します
  • API キーを誤ってコミットしないよう、.env を .gitignore ファイルに追加します

コメント

MCP は初めてですか?

プロトコルの概要から最初のサーバーの導入まで、よくある疑問にまとめて答えます。

AI アプリケーションが外部のツールやデータソースに統一的な方法で接続するためのオープンなプロトコルです。クライアントはモデルとの対話を担い、MCP サーバーはツール・リソース・プロンプトテンプレートを提供します。標準メッセージでやり取りするため、1 つのサーバーを複数のクライアントで再利用できます。