@kimagure-dd/xirr-mcp
@kimagure-dd/xirr-mcp
**XIRR(拡張内部収益率)**を計算するためのMCPサーバーです。楽天証券の取引履歴CSVの読み込みを標準サポートしています。
Claude DesktopやClaude Codeに組み込み、証券会社からエクスポートしたCSVを渡して以下のように質問してください:
「この CSV と現在の評価額 ¥1,500,000 で、実績年利を計算して」
Claudeが不定期な入出金を考慮してXIRRを計算し、結果を解説します。
機能
🧮
calculate_xirr— 任意のキャッシュフローと現在の評価額からXIRRを計算📄
parse_rakuten_csv— 楽天証券の取引履歴CSVを正規化されたキャッシュフローに変換🔌 ネットワークアクセス不要の純粋なstdio MCPサーバー
📦 ランタイム設定不要、
npxコマンド一つで実行可能
Related MCP server: ibkr-mcp
インストールとセットアップ
Claude Desktop
~/Library/Application Support/Claude/claude_desktop_config.json (macOS) または %APPDATA%\Claude\claude_desktop_config.json (Windows) を編集します:
{
"mcpServers": {
"xirr": {
"command": "npx",
"args": ["-y", "@kimagure-dd/xirr-mcp"]
}
}
}Claude Desktopを再起動してください。calculate_xirr および parse_rakuten_csv ツールが表示されるはずです。
Claude Code
claude mcp add xirr -- npx -y @kimagure-dd/xirr-mcp使用例
直接計算
Claudeに以下のように尋ねます:
「以下のキャッシュフローで XIRR を計算して。2020-01-01 に 100万円投資、2022-01-01 に 50万円追加、現在(2025-01-01)の評価額 200万円」
Claudeは構造化された入力で calculate_xirr を呼び出し、以下を返します:
{
"annualRate": 12.34,
"annualRateFormatted": "12.34%",
"totalInvestment": 1500000,
"totalGain": 500000,
"gainRateFormatted": "33.33%",
"converged": true
}楽天証券のCSVから計算
楽天証券にログイン → 取引履歴 → CSV ダウンロード
(Shift_JIS でダウンロードされるため UTF-8 に変換してください)
Claude にファイル内容を渡して「これで実績年利を計算して。現在の評価額は ¥X」と依頼
Claudeは自動的にCSVを parse_rakuten_csv → calculate_xirr の順で処理します。
ツールリファレンス
calculate_xirr
日付付きキャッシュフローのリストと現在の評価額からXIRRを計算します。
入力:
フィールド | 型 | 説明 |
| array |
|
| number | 現在のポートフォリオ評価額。 |
| string | YYYY-MM-DD。 |
出力:
フィールド | 型 | 説明 |
| number | 年率換算された収益率(パーセント)。 |
| number | 月率(年率に複利換算)。 |
| number | 全キャッシュフローの合計。 |
| number |
|
| number | 投資額に対する合計利益率(パーセント)。 |
| boolean | 反復計算が収束した場合は true。 |
parse_rakuten_csv
楽天証券の取引履歴CSVを解析します。
入力:
フィールド | 型 | 説明 |
| string | 生のCSVテキスト(UTF-8デコード済み)。 |
必要なCSVヘッダー:
約定日, 取引, ファンド名, 受渡金額/(ポイント利用)[円]
動作:
買付行 → 正の金額(投資)その他の取引タイプ(例:
売却) → 負の金額(引き出し)無効な行は警告とともにスキップされます
計算方法
メインソルバーとしてニュートン・ラフソン法を使用
ニュートン法で収束しない場合は二分法にフォールバック
時間単位: 月(1ヶ月あたり 365.25 / 12 日を使用)
収束閾値: 1e-7
kimagure-dd.devのブラウザ版XIRR計算機 と同じロジックを使用しているため、結果は同一です。
免責事項
本ツールは情報提供のみを目的として投資パフォーマンスを計算します。 税金、取引手数料、為替換算は考慮されていません。 出力は投資助言を構成するものではありません。
開発
npm install
npm run build
npm test公開前にローカルでサーバーをテストするには:
npm pack
# Then point Claude Desktop to the .tgz pathライセンス
MIT © kimagure-dd
関連
🌐 kimagure-dd.dev — ブラウザベースの金融計算ツール
🐙 ソースコード
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityCmaintenanceA portfolio analysis MCP server that enables AI agents to manage investment portfolios, fetch financial data from Yahoo Finance and CoinGecko, and perform advanced analysis like weight optimization and Monte Carlo simulations. It utilizes reference-based caching to efficiently handle large datasets without bloating the LLM's context window.261MIT
- Flicense-qualityCmaintenanceAn MCP server that turns Interactive Brokers into a question-answering portfolio analyst.4
- AlicenseAqualityDmaintenanceAn MCP server that enables querying Easy Equities and Satrix investment accounts, including holdings, valuations, and transactions, via natural language.91MIT
- FlicenseAqualityBmaintenanceMCP server providing portfolio analytics tools: beta to a benchmark, sector correlation, and FIFO trade matching with realized/unrealized P&L using Yahoo Finance prices.3
Related MCP Connectors
MCP server exposing the Backtest360 engine API as tools for AI agents.
Open-source MCP server for Zerodha Kite Connect. Portfolio, market data, backtesting, alerts.
7-factor stock scoring MCP server. US/HK/CN, 74 stocks. Free + Premium (USDC/Base). x402 ready.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/kimagure-dd/xirr-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server