Serwer MCP (Model Context Protocol) udostępniający dane portfela inwestycyjnego z myFund.pl jako narzędzia dla Claude Desktop.
| Narzędzie | Co zwraca |
|---|---|
get_portfolio |
Podsumowanie portfela: wartość, zysk, stopy zwrotu za okresy (1T / 1M / 3M / 1R / 5R…) |
get_positions |
Lista pozycji posortowana wg wartości (ticker, typ, sektor, konto, zysk) |
get_allocation |
Alokacja wg typu aktywów i wg walorów z kolorami |
get_portfolio_timeseries |
Szereg czasowy: wartość / zysk / wkład / benchmark / stopa zwrotu |
Po podpięciu serwera możesz zadawać Claude pytania w naturalnym języku:
Podsumowanie i wyniki:
„Pokaż podsumowanie portfela Inwestycje” „Jaki jest mój całkowity zysk i stopa zwrotu od początku roku?” „Jak zmieniała się wartość portfela przez ostatnie 12 miesięcy?”
Pozycje i selekcja:
„Które 5 pozycji przyniosło największy zysk?” „Pokaż wszystkie pozycje na koncie IKE” „Jakie ETF-y mam w portfelu i ile każdy z nich waży?”
Alokacja:
„Jak wygląda podział portfela wg typu aktywów?” „Które walory mają największy udział w portfelu?” „Czy jestem zdywersyfikowany sektorowo?”
Analiza w czasie:
„Porównaj stopę zwrotu portfela z benchmarkiem WIG w tym roku” „Kiedy portfel osiągnął najwyższą wartość?” „Pokaż dzienny zysk/stratę za ostatni miesiąc”
Pobierz plik myfund_mcp_server.py i przenieś go do wybranego folderu, np.:
mkdir -p ~/mcp-servers
mv ~/Downloads/myfund_mcp_server.py ~/mcp-servers/
macOS:
brew install python@3.12
Windows: pobierz instalator z python.org.
macOS / Linux:
/opt/homebrew/bin/python3.12 -m venv ~/mcp-servers/venv
~/mcp-servers/venv/bin/python -m pip install "mcp" httpx
Windows:
python -m venv %USERPROFILE%\mcp-servers\venv
%USERPROFILE%\mcp-servers\venv\Scripts\python -m pip install "mcp" httpx
Zaloguj się → Menu → Konto → Ustawienia konta → Klucz API → wygeneruj i skopiuj.
⚠️ Wygenerowanie nowego klucza natychmiast unieważnia poprzedni.
Otwórz: Settings → Developer → Edit Config
Lokalizacja pliku konfiguracyjnego:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.json~/.config/Claude/claude_desktop_config.jsonWklej do sekcji "mcpServers":
{
"mcpServers": {
"myfund": {
"command": "/Users/TWOJA_NAZWA/mcp-servers/venv/bin/python",
"args": ["/Users/TWOJA_NAZWA/mcp-servers/myfund_mcp_server.py"],
"env": {
"MYFUND_API_KEY": "TWOJ_KLUCZ_API"
}
}
}
}
Podmień:
TWOJA_NAZWA → nazwa użytkownika systemowego (na macOS: wynik whoami w Terminalu)TWOJ_KLUCZ_API → klucz z kroku 4Ważne:
commandmusi wskazywać na Pythona z venv — tego, do którego zainstalowanomcp.
Cmd+Q (macOS) lub całkowite zamknięcie, potem uruchom ponownie.
W nowym czacie napisz:
Pokaż podsumowanie portfela „Nazwa Twojego Portfela”
No module named 'mcp'Przyczyna: Claude uruchamia Pythona systemowego zamiast tego z venv.
Rozwiązanie: Upewnij się, że command w configu wskazuje na ~/mcp-servers/venv/bin/python, a nie na systemowy python3.
Odpowiedź nie jest poprawnym JSON-emPrzyczyna: Niepoprawny klucz API lub brak dostępu do bety myFund.pl. Rozwiązanie: Sprawdź klucz w Menu → Konto → Ustawienia konta → Klucz API. Jeśli klucz jest świeży a błąd pozostaje — API myFund.pl jest w fazie beta i dostęp może być ograniczony do wybranych kont.
Portfel nie znaleziony (status 7)Przyczyna: Nazwa portfela nie zgadza się dokładnie z nazwą na koncie. Rozwiązanie: Sprawdź dokładną nazwę portfela na myFund.pl (wielkość liter, spacje). Nazwa musi być identyczna co do znaku.
Przyczyna: Błąd przy starcie serwera lub niepoprawna składnia JSON w configu. Rozwiązanie: Wejdź w Settings → Developer — tam widoczny jest status każdego serwera i log błędów. Najczęściej: literówka w ścieżce lub brakujący przecinek w JSON.
Przyczyna: API myFund.pl cache’uje odpowiedzi przez 5 minut. Rozwiązanie: Odczekaj 5 minut od ostatniej zmiany w portfelu i zapytaj ponownie.
| Zmienna | Wymagana | Opis |
|---|---|---|
MYFUND_API_KEY |
✅ tak | Klucz API z ustawień konta myFund.pl |
MYFUND_BASE_URL |
❌ nie | Nadpisuje base URL (domyślnie https://myfund.pl/API/v1) |
+ — serwer parsuje defensywniestatus.code mimo HTTP 200 ("0" = sukces, "1" = błąd, "7" = portfel nie znaleziony)MIT
An MCP (Model Context Protocol) server that exposes your myFund.pl investment portfolio data as tools for Claude Desktop.
| Tool | Returns |
|---|---|
get_portfolio |
Portfolio summary: value, profit, returns for periods (1W / 1M / 3M / 1Y / 5Y…) |
get_positions |
List of holdings sorted by value (ticker, type, sector, account, profit) |
get_allocation |
Allocation by asset type and by security, with hex colours |
get_portfolio_timeseries |
Time series: value / profit / contribution / benchmark / return |
Once connected, you can ask Claude questions in plain language:
Summary & performance:
“Show me a summary of my Investments portfolio” “What is my total profit and year-to-date return?” “How has my portfolio value changed over the last 12 months?”
Holdings & selection:
“Which 5 positions have generated the most profit?” “Show all positions held in my IKE account” “What ETFs do I hold and what is each one’s weight in the portfolio?”
Allocation:
“How is my portfolio split by asset type?” “Which securities have the largest share of the portfolio?” “Am I well diversified across sectors?”
Time series analysis:
“Compare my portfolio return against the WIG benchmark this year” “When did my portfolio reach its peak value?” “Show daily profit/loss for the last month”
Download myfund_mcp_server.py and move it to a permanent location, e.g.:
mkdir -p ~/mcp-servers
mv ~/Downloads/myfund_mcp_server.py ~/mcp-servers/
macOS:
brew install python@3.12
Windows: download the installer from python.org.
macOS / Linux:
/opt/homebrew/bin/python3.12 -m venv ~/mcp-servers/venv
~/mcp-servers/venv/bin/python -m pip install "mcp" httpx
Windows:
python -m venv %USERPROFILE%\mcp-servers\venv
%USERPROFILE%\mcp-servers\venv\Scripts\python -m pip install "mcp" httpx
Log in → Menu → Account → Account Settings → API Key → generate and copy.
⚠️ Generating a new key immediately invalidates the previous one.
Open: Settings → Developer → Edit Config
Config file location:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.json~/.config/Claude/claude_desktop_config.jsonAdd the following block inside "mcpServers":
{
"mcpServers": {
"myfund": {
"command": "/Users/YOUR_USERNAME/mcp-servers/venv/bin/python",
"args": ["/Users/YOUR_USERNAME/mcp-servers/myfund_mcp_server.py"],
"env": {
"MYFUND_API_KEY": "YOUR_API_KEY"
}
}
}
}
Replace:
YOUR_USERNAME → your system username (on macOS: run whoami in Terminal)YOUR_API_KEY → the key from step 4Important:
commandmust point to the Python binary inside the venv — the one wheremcpwas installed.
Cmd+Q (macOS) or fully close the app, then relaunch.
In a new chat, type:
Show me a summary of my portfolio “Your Portfolio Name”
No module named 'mcp'Cause: Claude is launching the system Python instead of the venv one.
Fix: Make sure command in the config points to ~/mcp-servers/venv/bin/python, not the system python3.
Response is not valid JSONCause: Invalid API key or no access to the myFund.pl beta. Fix: Check your key at Menu → Account → Account Settings → API Key. If the key is fresh and the error persists, the myFund.pl API is in beta and access may be restricted to selected accounts.
Portfolio not found (status 7)Cause: Portfolio name doesn’t exactly match the name on your account. Fix: Check the exact portfolio name on myFund.pl (case-sensitive, watch for trailing spaces). The name must match character for character.
Cause: Server failed to start, or invalid JSON syntax in the config file. Fix: Go to Settings → Developer — each server’s status and error log is shown there. Most common causes: typo in a file path, or a missing comma in the JSON.
Cause: myFund.pl API caches responses for 5 minutes. Fix: Wait 5 minutes after making changes to your portfolio, then ask again.
| Variable | Required | Description |
|---|---|---|
MYFUND_API_KEY |
✅ yes | API key from myFund.pl account settings |
MYFUND_BASE_URL |
❌ no | Overrides base URL (default: https://myfund.pl/API/v1) |
+ prefix — the server parses them defensivelystatus.code despite HTTP 200 ("0" = success, "1" = error, "7" = portfolio not found)MIT