@kimagure-dd/xirr-mcp
Provides tools for parsing Rakuten Securities transaction CSV and calculating XIRR (Extended Internal Rate of Return) from cash flows, enabling automated investment performance analysis.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@@kimagure-dd/xirr-mcp calculate XIRR from my Rakuten CSV with current value ¥1,500,000"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
@kimagure-dd/xirr-mcp
MCP server for XIRR (Extended Internal Rate of Return) calculation, with built-in support for Rakuten Securities (楽天証券) transaction CSV.
Plug it into Claude Desktop or Claude Code, hand it a CSV exported from your brokerage, and ask:
「この CSV と現在の評価額 ¥1,500,000 で、実績年利を計算して」
Claude will compute the XIRR for you — accounting for irregular contributions and withdrawals — and explain the result.
Features
🧮
calculate_xirr— XIRR from arbitrary cash flow series + current valuation📄
parse_rakuten_csv— Parse Rakuten Securities transaction CSV (取引履歴) into normalized cash flows🔌 Pure stdio MCP server, no network access required
📦 Zero runtime config, single
npxcommand
Related MCP server: ibkr-mcp
Installation & Setup
Claude Desktop
Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"xirr": {
"command": "npx",
"args": ["-y", "@kimagure-dd/xirr-mcp"]
}
}
}Restart Claude Desktop. The calculate_xirr and parse_rakuten_csv tools should appear.
Claude Code
claude mcp add xirr -- npx -y @kimagure-dd/xirr-mcpUsage Examples
Direct calculation
Ask Claude:
「以下のキャッシュフローで XIRR を計算して。2020-01-01 に 100万円投資、2022-01-01 に 50万円追加、現在(2025-01-01)の評価額 200万円」
Claude will call calculate_xirr with structured input and return:
{
"annualRate": 12.34,
"annualRateFormatted": "12.34%",
"totalInvestment": 1500000,
"totalGain": 500000,
"gainRateFormatted": "33.33%",
"converged": true
}From Rakuten Securities CSV
楽天証券にログイン → 取引履歴 → CSV ダウンロード
(Shift_JIS でダウンロードされるため UTF-8 に変換)
Claude にファイル内容を渡して「これで実績年利を計算して。現在の評価額は ¥X」と依頼
Claude will pipe the CSV through parse_rakuten_csv → calculate_xirr automatically.
Tool Reference
calculate_xirr
Calculates XIRR from a list of dated cash flows and a current valuation.
Input:
Field | Type | Description |
| array | List of |
| number | Current portfolio valuation. |
| string | YYYY-MM-DD. Date of |
Output:
Field | Type | Description |
| number | Annualized return as a percentage. |
| number | Monthly rate (compounded to annual). |
| number | Sum of all cash flows. |
| number |
|
| number | Total gain as a percentage of investment. |
| boolean | True if the iterative solver converged. |
parse_rakuten_csv
Parses a Rakuten Securities transaction CSV.
Input:
Field | Type | Description |
| string | Raw CSV text (UTF-8 decoded). |
Required CSV headers:
約定日, 取引, ファンド名, 受渡金額/(ポイント利用)[円]
Behavior:
買付rows → positive amount (investment)Other transaction types (e.g.
売却) → negative amount (withdrawal)Invalid rows are skipped with warnings
Calculation Method
Newton-Raphson iteration as the primary solver
Bisection fallback when Newton fails to converge
Time unit: months (using 365.25 / 12 days per month)
Convergence threshold: 1e-7
The same logic is used in the browser-based XIRR calculator on kimagure-dd.dev, so results are identical.
Disclaimer
This tool computes investment performance for informational purposes only. Taxes, transaction fees, and currency conversion are not considered. The output does not constitute investment advice.
Development
npm install
npm run build
npm testTo test the server locally before publishing:
npm pack
# Then point Claude Desktop to the .tgz pathLicense
MIT © kimagure-dd
Related
🌐 kimagure-dd.dev — Browser-based financial calculators
Available Tools
2 toolscalculate_xirrA
Calculate XIRR (Extended Internal Rate of Return) from a series of dated cash flows and a current portfolio valuation. Returns annualized rate, monthly rate, total gain, and convergence status. Useful for measuring actual investment performance accounting for irregular contributions and withdrawals.
Inputs: cashFlows (required), currentValue (required), valuationDate (required).
parse_rakuten_csvA
Parse a Rakuten Securities transaction CSV (取引履歴) and convert it into a normalized cash flow list. Handles 買付/売却 transaction types automatically. The output can be fed directly into calculate_xirr.
Inputs: csvContent (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
The two tools have clearly distinct purposes: parse_rakuten_csv converts a specific CSV into cash flows, and calculate_xirr performs the actual rate calculation. No overlap exists.
Both tools follow a consistent verb_noun pattern using snake_case: parse_rakuten_csv and calculate_xirr. Perfectly consistent.
With only 2 tools, the server is very focused but appropriately scoped for the specific use case of Rakuten CSV processing and XIRR calculation. A slightly broader tool count could be argued, but it's reasonable.
For the domain of computing XIRR from Rakuten CSV data, the server is complete. The parse-then-calculate workflow covers all necessary steps without missing functionality.
Maintenance
Related MCP Connectors
MCP server for VC pitch-deck scoring, thesis-fit matching, and deal-flow management.
Official Intrinio MCP server. US stock prices, options and fundamentals for AI agents.
MCP server for Financial Modeling Prep API with 250+ financial data tools
Research-only MCP server: your AI as a quant research desk. 90 tools, no trades, no brokers.
Related MCP Servers
- AlicenseAqualityDmaintenanceA 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
- FlicenseNot gradedqualityBmaintenanceAn 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
- FlicenseAqualityDmaintenanceMCP 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-