freee-mcp
CLAUDE.md516 starsChanged 5 months agoApache-2.0View on GitHub
MCP server that exposes freee API endpoints as MCP tools: Run freee-mcp configure to set up configuration interactively: After running freee-mcp configure: Configuration is automatically loaded from ~/.config/freee-mcp/config.json. Development mode: Use "command": "bun", "args": ["run", "src/index.ts"] with "cwd": "/path/to/freee-mcp" Sign development mode: Use "command": "bun", "args": ["run", "src/sign/index.ts"] with "cwd": "/path/to/freee-mcp" 環境変数 FREEE_API_BASE_URL_{SERVICE} でAPIの向き先を変更できる(src/openapi/schema-loader.ts の resolveBaseUrl で処理)。
1 other project uses a version of this.
Adopted by
Most recently taken up by
- him0/freee-mcpword for word, first seen Oct 8, 2026
Other versions1 project uses a version of this.
Word for word · 1
- him0/freee-mcp★ 516100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository2 other files it gives its agents.
- .github/CLAUDE.mdCLAUDE.md
- freee-api-skillSkill
The file
We split this CLAUDE.md into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 44
Run freee-mcp configure to set up configuration interactively:
- Distinctive: line 115
Always run before creating a PR:
- Very specific: line 177
Do not use markdown bold syntax (``) in any files
≈ “Common” is an estimate: at least 1 in 5 of the 27,641 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Commands
bun run build- Build the project (uses Bun.build)bun run typecheck- TypeScript type checkingbun run lint- Run Biome linterbun run format- Run Biome formatterbun run check- Run Biome lint + format (recommended before PR)bun run test:run- Run tests (vitest)bun run dev- Start development serverbun run inspector- MCP inspector for debugging toolsbun run changeset- Create a new changeset for version bumpsbun run version- Apply changesets to update versions and CHANGELOGbun run release- Build and publish to npmbun run count:apis- Count operations/paths per OpenAPI schema (--jsonfor machine-readable output)
Architecture
MCP server that exposes freee API endpoints as MCP tools:
- Schema: Multiple OpenAPI schemas in
openapi/directoryaccounting-api-schema.json- 会計API (https://api.freee.co.jp)hr-api-schema.json- 人事労務API (https://api.freee.co.jp/hr)invoice-api-schema.json- 請求書API (https://api.freee.co.jp/iv)pm-api-schema.json- 工数管理API (https://api.freee.co.jp/pm)sm-api-schema.json- 販売API (https://api.freee.co.jp/sm)it-management-api-schema.json- IT管理API (https://api.freee.co.jp、パスに/hub/it_management/プレフィックス)partner-management-api-schema.json- 業務委託管理API (https://api.freee.co.jp、パスに/hub/partner_management/プレフィックス)mcponly-api-schema.json- mcp-only(freee-mcp リモート版限定)区分のエンドポイント集約スキーマ (https://api.freee.co.jp)。複数ドメインが同居する(サーベイ / 開業 / 人事評価。パスは/hub/<domain>/プレフィックス)sign-api-schema.json- サイン(電子契約)API (https://ninja-sign.com)
- Schema Loader:
src/openapi/schema-loader.tsloads and manages all API schemas - Tool Generation:
generateClientModeTool()insrc/openapi/client-mode.tscreates method-specific tools- Tools:
freee_api_get,freee_api_post,freee_api_put,freee_api_delete,freee_api_patch,freee_api_list_paths - Automatically detects API type from path and uses correct base URL
- Validates paths against all OpenAPI schemas before execution
- Supports all 5 freee APIs seamlessly
- Tools:
- Requests:
makeApiRequest()insrc/api/client.tshandles API calls with auto-auth and company_id injection
Configuration
Run freee-mcp configure to set up configuration interactively:
- Creates
~/.config/freee-mcp/config.jsonwith OAuth credentials and company settings - More secure (file permissions 0600)
CLI Subcommands
freee-mcp- Start MCP serverfreee-mcp configure- Interactive configuration setupfreee-sign-mcp- Start Sign MCP serverfreee-sign-mcp configure- Sign interactive configuration setup
MCP Configuration
After running freee-mcp configure:
{
"mcpServers": {
"freee": {
"command": "npx",
"args": ["freee-mcp"]
}
}
}Configuration is automatically loaded from ~/.config/freee-mcp/config.json.
Development mode: Use "command": "bun", "args": ["run", "src/index.ts"] with "cwd": "/path/to/freee-mcp"
Sign development mode: Use "command": "bun", "args": ["run", "src/sign/index.ts"] with "cwd": "/path/to/freee-mcp"
API Base URL の上書き(開発用)
環境変数 FREEE_API_BASE_URL_{SERVICE} でAPIの向き先を変更できる(src/openapi/schema-loader.ts の resolveBaseUrl で処理)。
FREEE_API_BASE_URL- freee public APIのベースURLFREEE_API_BASE_URL_ACCOUNTING- 会計APIFREEE_API_BASE_URL_HR- 人事労務APIFREEE_API_BASE_URL_INVOICE- 請求書APIFREEE_API_BASE_URL_PM- 工数管理APIFREEE_API_BASE_URL_SM- 販売APIFREEE_API_BASE_URL_IT_MANAGEMENT- IT管理APIFREEE_API_BASE_URL_PARTNER_MANAGEMENT- 業務委託管理APIFREEE_API_BASE_URL_SURVEY- サーベイAPIFREEE_API_BASE_URL_LAUNCH- 開業APIFREEE_API_BASE_URL_EMPLOYEE_EVALUATION- 人事評価APIFREEE_API_BASE_URL_TAX_RETURN- 申告APIFREEE_API_BASE_URL_FIXED_ASSET_MANAGEMENT- 固定資産APIFREEE_SIGN_API_URL- サインAPI(src/sign/config.tsで処理)
Remote モードのロギング (canonical log line)
Remote モードは「1 HTTP リクエスト = 1 ログ行 = 1 trace」パターン。ペイロード形状は CanonicalLogPayload (src/server/request-context.ts)、emit は src/telemetry/middleware.ts の res.on('finish')。
読み落としやすい注意点:
- synthetic error (validation 失敗、routing 404 等) は
makeErrorChain(name, message)経由で登録すること。素の[{ name, message }]リテラルはscrubErrorMessage()を通らず privacy 漏洩の原因になる http.statusは MCP クライアントへの最終応答、api_calls[].status_codeは freee API からの応答。freee API 500 でも MCP 応答は 200 で wrap する場合があり、両方を見る必要がある
Datadog 検索例:
@http.status:500— MCP サーバー自体の 5xx@api_calls.error_type:timeout— 外部 API タイムアウト@http.status:200 @errors:*— 見かけ上は成功だが内部的に失敗@request_id:<uuid>— 特定リクエストの全情報@user_agent:ClaudeDesktop*— MCP クライアント種別でフィルタ
PR Creation Pre-flight Checklist
Always run before creating a PR:
bun run typecheck && bun run lint && bun run test:run && bun run buildChangeset requirement (必須):
- コミット時に changeset ファイルを必ず作成すること(忘れやすいので注意)
bun run changesetが対話モードで使えない場合は.changeset/<短い説明>.mdを直接作成する- フォーマット: frontmatter に
"freee-mcp": patch|minor|major、本文に変更内容の説明(日本語) - bump type:
patch(バグ修正)、minor(新機能)、major(破壊的変更)
Changeset の書き方:
- 1 行サマリ+必要に応じて短い箇条書き(2〜5 項目)に留める。実装詳細・内部モジュール名・facet 名等は PR 説明に書き、CHANGELOG には残さない
- BREAKING や運用影響(ダッシュボード移行など)の警告だけは要約として明示する
- サブセクション(
## 〇〇)を切る粒度の長文は避ける
Contributor の追加:
- Issue を起票してくれた人を README.md の Contributors セクション(
<!-- CONTRIBUTORS-START -->~<!-- CONTRIBUTORS-END -->の間)に追加する - 既存のフォーマットに合わせて
<a href="https://github.com/{username}"><img src="https://github.com/{username}.png" width="40" height="40" alt="@{username}"></a>を末尾に追記する
Common issues:
- Mock function return types (ensure
idfields are strings) - Missing return type annotations on exported functions
- Undefined environment variables in tests
Skill について
skills/freee-api-skill/内のVERSION.mdは npm publish 時に自動生成されるため、開発環境(ローカル)には存在しない- 開発環境では
freee_server_infoのバージョンがdevと返る(正常動作)。実際のバージョンはpackage.jsonのversionを参照する - Skill の更新(レシピ・リファレンスの追加・修正など)は changeset で
patchバージョンとする skills/freee-api-skill/references/INDEX.mdはscripts/generate-references.tsが自動生成する(手編集しないこと)。新しいドメインを追加する場合は同スクリプトのSERVICE_LABELSにも prefix を足すREADME.mdの「対応操作数」は<!-- API-STATS-TOTAL-START -->~<!-- API-STATS-TOTAL-END -->の間を同スクリプトがAPI_CONFIGSの全スキーマから再計算して埋める(手編集しないこと)。スキーマを更新したらbun run fetch:schemas→bun run generate:referencesで自動的に追従するSKILL.mdは実行時に毎回読まれるので、セットアップ手順(SETUP.md)や配色定義(COLORS.md)のように条件が揃ったときだけ必要な情報は別ファイルに置き、SKILL.mdからは参照条件だけ書く
Skill レシピの書き方
- レシピ(
skills/*/recipes/)は操作の流れと注意点に集中し、APIの仕様詳細(パス一覧・パラメータ・レスポンス・制約等)はリファレンス(references/)へのパス参照に留める - レシピにリファレンスと同じ情報を重複して書かない
mcp-only(freee-mcp リモート版限定)エンドポイントについて
一部のエンドポイントは freee-mcp(リモート版)でのみ利用でき、ローカル(stdio)モードでは使えない。この区分は公開スキーマの配信元で mcp-only として指定され、必ず単一ファイル mcponly.yml に集約される。freee-mcp 側はこれを「出自(provenance)」として扱い、エンドポイント個別のフラグや手動リストは持たない。
仕組み:
scripts/fetch-schemas.tsがmcponly.ymlを1ソースとして取得し、openapi/mcponly-api-schema.jsonとopenapi/minimal/mcponly.jsonを生成するscripts/generate-references.tsはmcponly-api-schema.jsonの全パスを mcp-only 集合として読み込み、該当タグのリファレンス冒頭に「⚠ freee-mcp(リモート版) 限定」バナーを自動挿入する(手編集は不要・不可)src/openapi/schema-loader.tsのisMcpOnlyPath()が同じ集合で判定し、src/openapi/client-mode.tsが stdio モードでの呼び出しを API に到達させず弾く
新しく mcp-only 区分のエンドポイントがリリースされたとき:
- それは必ず
mcponly.ymlに入るため、bun run fetch:schemas→bun run generate:referencesを流すだけでバナーと stdio ゲートは自動で反映される - 新しいドメインを
serviceとして増やす場合のみ、通常のドメイン追加と同様にschema-loader.ts(ApiType / SERVICE_METADATA)・client-mode.ts(enum / hint)・tag-mappings.jsonを配線する。バナーとゲートは provenance で自動 mcponly.jsonは複数ドメインが同居するため、SERVICE_METADATAの各エントリにpathPrefix(/hub/<domain>/)を必ず指定する。指定漏れはschema-loader.test.tsの「mcponly schema source coverage」が検出する
Writing Style
- Do not use markdown bold syntax (
**) in any files - PR の説明・コミットメッセージ・CHANGELOG・ドキュメント等の公開される文章には、freee organization 以外のリポジトリ(フォーク含む)への参照や、Jira などの社内ツールの URL を書かない
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

