All skills
freee avatar

/freee-api-skill

@f5d1212
by freeefreee/freee-mcp503 stars
58

freee-mcp / freee-sign-mcp と連携するスキル。会計・人事労務・請求書・工数管理・販売・IT管理・固定資産・業務委託管理・サーベイ・開業・人事評価・申告・サイン(電子契約)の詳細APIリファレンスと使い方ガイドを提供。freee の経費申請・取引登録・勤怠打刻・給与明細・見積書・試算表・仕訳・従業員管理・工数登録・売上管理・SaaSアカウント管理・備品管理・固定資産管理・業務委託先の企業ユーザー/部門管理・サーベイ企画/実施回の取得・開業申請用データの参照/更新・人事評価結果の取得・法人税申告データや帳票の参照・電子契約の文書管理などの操作やAPI仕様を調べたいときに使う。ユーザーが freee のデータ操作、会計処理、人事労務管理、請求・見積、プロジェクト工数管理、販売管理、IT管理、固定資産管理、業務委託管理、サーベイ、開業、人事評価、申告、電子契約について質問や操作を依頼してきた場合は、明示的に freee と言及していなくても、このスキルの利用を検討すること。サインは別途 freee-sign-mcp の設定が必要。

Use this Skill: https://skilld.dev/gh/freee/freee-mcp/freee-api-skill

This session only. Nothing lands on disk.

recipessign-document-operations.md

≈1.8k tokens on demand. Your agent reads this file only when SKILL.md points to it.

サイン文書の作成・アップロード

freee サイン(電子契約)で文書を作成し、署名依頼までつなげる操作ガイド。 MCP ツールのセットアップと認証は ../SIGN-GUIDE.md、API 仕様の詳細は ../sign-references/sign-documents.md を参照。

文書作成エンドポイントの選び方

目的によって使うエンドポイントが異なる。

  • テンプレートから文書を作成する: POST /v1/documents(作成中 draft)。template_id が必須のため、テンプレートが 1 件もない環境では使用できない。先に GET /v1/templates で有無を確認する
  • 手元のファイルから署名用の文書を作成する: POST /v1/documents/uploads(作成中 draft)。PDF/Word/Excel/PowerPoint、10MB 以下
  • 締結済みの PDF を保管用に取り込む: POST /v1/pdf_documents(完了 concluded)。PDF のみ、10MB 以下。作成される文書は署名フローには乗せられない。title パラメータがなく文書タイトルはアップロードファイル名になるため、変えたい場合はアップロード前にローカルでファイル名を変更する(実際に設定されたタイトルは作成後のレスポンスで確認する)

リファレンスの「APIクライアントを利用する場合は必須」という注記(creator_id・sender_id・user_id 等)は、アクセストークン発行 API(POST /v1/token)を使う「APIクライアント」向けのもの。freee-sign-mcp は OAuth 2.0 認証で接続するため、この注記の対象ではない。

uploader_id / creator_id / folder_id の取得

  • uploader_id(アップロード系)と creator_id(POST /v1/documents)には、GET /v1/users/me で取得できる自分のユーザー ID を指定する
  • 保存先の folder_id は GET /v1/folders で取得する。ホームフォルダも含まれる。保存先の指定がユーザーからない場合は、一覧を提示して選んでもらう

ファイルから文書を作成する

sign_file_upload ツールを使う(推奨)

sign_api_post の body に Base64 を直接渡す方法は、ファイルが数百 KB を超えると LLM がツール引数を生成しきれず失敗する。ローカルにあるファイルは専用ツール sign_file_upload を使う。ファイルの読み込みと Base64 変換はツール側で行われる。

sign_file_upload {
  "file_path": "/path/to/契約書.pdf",
  "folder_id": 123,
  "title": "業務委託契約書"
}

パラメータ:

  • file_path(必須): アップロードするファイルのローカルパス
  • folder_id(必須): 保存先フォルダのID(GET /v1/folders で取得)
  • uploader_id: アップロードするユーザーのID。省略時は GET /v1/users/me の id で自動解決
  • title: 文書のタイトル。省略時はファイル名から設定されるが、拡張子の扱いなど変換規則は文書化されていないため、確実にしたい場合は明示指定する。draft のみ有効で、concluded では反映されない
  • document_status: draft(既定)は署名依頼に使う「作成中」の文書を作成(POST /v1/documents/uploads を使用)、concluded は締結済み PDF を「完了」文書として保管(POST /v1/pdf_documents を使用)
  • signers_count: 相手方の署名者の人数(draft のみ有効、1〜20、省略時は 1)。1 社でも署名する人が 2 名なら 2。「相手は N 社」「先方の担当者」などの曖昧な人数表現から断定せず、実際に署名する人数をユーザーに確認する。送信時に to へ指定する送り先の数と一致させる
  • skip_approval: true で配付文書、false で署名・合意文書(draft のみ有効、省略時は false)

sign_api_post で直接送る(小さいファイルのみ)

Base64 文字列が小さい場合(目安: 数十 KB まで)は sign_api_post でも作成できる。body の形式は ../sign-references/sign-documents.md の POST /v1/documents/uploads を参照。

MCP 外から送る(curl でのデバッグ・直接呼び出し)

MCP を経由せず API を直接呼び出す場合のベース URL は https://ninja-sign.com(`../SIGN-GUIDE.md` 参照)。アクセストークンは ~/.config/freee-mcp/sign-tokens.json の access_token を使用する。

base64 -w0 契約書.pdf > content.b64
jq -n --arg name "契約書.pdf" --rawfile content content.b64 \
  '{file: {name: $name, content: $content}, uploader_id: 42, folder_id: 123}' \
  | curl -X POST https://ninja-sign.com/v1/documents/uploads \
      -H "Authorization: Bearer $ACCESS_TOKEN" \
      -H "Content-Type: application/json" \
      -d @-

保管用の POST /v1/pdf_documents に送る場合は、body のキーが file ではなく pdf_file になる(title パラメータはない)。

アップロード後の流れ(署名依頼まで)

  1. 文書を作成(上記いずれか)し、レスポンスの document.id を控える
  2. 相手に入力させる欄(押印欄・テキスト欄など)が必要な場合のみ入力項目を付与: GET /v1/items で item_id を確認し、POST /v1/documents/{document_id}/document_items を呼ぶ(order は 0 が送信者、1 以降が n 番目の受領者)。合意・署名だけを求める場合、この手順は不要
  3. 送信前にユーザーが内容を確認する場合はここで止める。確認は freee サイン Web UI で文書を開いてもらう。PDF を API で取得する方法(GET /v1/documents/{document_id} に Accept: application/pdf)は sign_api_get がヘッダー指定に対応していないため MCP 経由では実行できず、curl 等の直接呼び出しが必要(PDF 作成処理中はエラーになるため時間を置いて再実行)
  4. 文書を送信: POST /v1/documents/{document_id}/confirmations(メール / SMS / 署名者用 URL 発行)

送信(メールの場合)の例:

sign_api_post {
  "path": "/v1/documents/123/confirmations",
  "body": {
    "notification_type": "email",
    "to": [{ "email": "signer@example.com" }],
    "es_type": "timestamp_only"
  }
}

to はオブジェクトではなく送り先の配列で、リファレンスでは内部構造が展開されていないため注意。

  • メール送信: 相手方の署名者の人数分(signers_count と同数)を過不足なく指定する。要素に指定できるフィールドは email のほかは転送・本人確認関連のフラグ(forwarding_required・verification_file_required・telephone_number_verification_required、いずれも省略時 false)のみで、宛先名は指定できない
  • SMS 送信: [{ "telephone_number": "080xxxxxxxx" }]
  • 署名者用 URL 発行(notification_type: "url"): [{}] を 1 件だけ指定する

es_type は timestamp_only(電子サイン、既定)/ esign(電子署名、送信ごとに料金が発生)。その他のパラメータ(message・cc・password・有効期限など)は ../sign-references/sign-documents.md の POST /v1/documents/{document_id}/confirmations を参照。

Source: SKILL.md on GitHub

1 warningtoday5 checks · Risk SAFE
  • Gen Agent Trust Hubtoday

    This skill provides a comprehensive interface for AI agents to interact with the freee suite of APIs (Accounting, HR, Invoices, IT Management, etc.) via the Model Context Protocol (MCP). It includes exhaustive documentation, usage recipes, and security-conscious guidelines that instruct the agent to treat all retrieved financial and tax data as information rather than executable commands.

  • Sockettoday

    No alerts

  • Snyktoday

    Risk: MEDIUM · 1 issue

  • Runlayer6mo

    3/83 files flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at f5d1212. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 days ago.

Activeupdated 3 weeks ago
metadata
{
  "author": "freee_jp",
  "homepage": "https://github.com/freee/freee-mcp"
}
  • API
  • MCP
  • freee
  • accounting
  • hr
  • invoicing
  • project-management
  • expense-tracking
  • payroll

README badge

README badge for freee/freee-mcp

Provides detailed API reference and usage guides for freee's accounting, HR, invoicing, project management, sales, and IT management services through the freee-mcp MCP server. Use this skill when you need to query or perform operations on freee data like expense reports, transactions, employee records, timesheets, invoices, or project hours.

Generated from the current SKILL.md.

Does this skill work with both Remote MCP and local setup?
Yes. The skill supports Remote MCP (recommended, auto-authenticated via browser) and local MCP server setup (requires running `npx freee-mcp configure`). Use `freee_server_info` to check which transport mode is active.
Which freee products does this skill cover?
The skill covers accounting, HR/payroll, invoicing, project time tracking, sales management, IT management, and expense applications. Signing (electronic contracts) requires a separate `freee-sign-mcp` setup.
Do I need to specify a company ID for API calls?
Yes. You must first fetch the current company ID using `freee_get_current_company`, and it must match the company you want to operate on. Use `freee_set_current_company` to switch between companies before making API calls.
What should I do if I get an authentication error?
For Remote MCP, the client will prompt for re-authentication; if that fails, remove and re-add the custom connector. For local mode, use `freee_auth_status` to check status, then run `freee_clear_auth` followed by `freee_authenticate`.
Where do I find API details and usage examples?
The skill includes `recipes/` for common workflows (expense applications, deals, payroll, invoicing, etc.) and `references/` with detailed API parameters and response specs. Start with relevant recipes before consulting references.

Generated from the current SKILL.md. These answers refresh after source changes.