# tamasPetki/HeadlessTracker [Health: Active]

**Category:** 💰 Finance & Fintech  
**Repository:** https://github.com/tamasPetki/HeadlessTracker  
**GitHub Stars:** 6  
**npm Downloads (last month):** 3097  
**Views:** 3  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/tamaspetki-headlesstracker

## Description
Local-first crypto portfolio aggregation across exchanges (Bybit, Binance), EVM and Solana wallets, and Polymarket. Read-only credentials stored in your OS keychain, no hosted service. Data aggregation only, not financial advice. Install with npx headless-tracker.

## Tools
Capabilities this server exposes over MCP:

- **get_holdings** — Returns current portfolio holdings across all connected accounts. Use this when the user asks: 'what do I own', 'show my portfolio', 'current positions', 'what's my balance', 'show my holdings', 'how much BTC do I have', or wants any snapshot of crypto/stock/prediction-market positions. For Polymarket-specific questions (which markets, outcomes, resolution or redeemable status), prefer get_polymarket_positions. For a ranked split / biggest positions, prefer get_allocations.  Each holding includes: symbol, asset class (crypto / stock / prediction / cash), quantity, current price, USD value, and connector-specific metadata (e.g. chain for EVM, market title for Polymarket, accountType for Bybit).  Inputs (all optional):   - account_id: scope to one account, e.g. 'metamask:0xabc123...' or 'bybit:UNIFIED'.     Omit to query ALL configured accounts.   - asset_class: scope to one of 'crypto' / 'stock' / 'prediction' / 'cash'.     'prediction' = Polymarket conditional tokens; 'cash' = stablecoins (USDC/USDT) + fiat. Omit for all classes.   - currency: 'USD' | 'EUR' | 'GBP' | 'HUF'. Default 'USD'. When set to anything     other than USD, value/currentPrice/avgCost are converted via live FX rates     (free API + fallback). The conversion source and fetchedAt are surfaced in     `meta.fx`. Underlying connector data is unchanged — this is a display-layer     convenience for users thinking in EUR/HUF/GBP.  Results are cached per-connector (crypto wallets 60s, exchanges 120s, Polymarket 30s). Use 'refresh_data' tool first if the user explicitly asks for fresh / latest data. Returns position data only. Not financial advice.
- **refresh_data** — Invalidates the PORTFOLIO TRACKER cache (Bybit/Binance/MetaMask/Polymarket/Solana/Hyperliquid holdings + transactions) and forces a fresh fetch from upstream APIs on the next call. Use this when the user asks: 'refresh my portfolio', 'update my holdings', 'get the latest portfolio prices', 'fetch fresh portfolio data', 'check current crypto prices', 'my balances look stale', 'force an update', 'my data is outdated', or implies real-time freshness is required FOR THE TRACKER.  Optionally scope to a single connector (bybit, binance, metamask, polymarket, solana, hyperliquid). Without a scope, invalidates everything tracker-related.  DO NOT call this tool when the user means: refreshing a webpage, refreshing an OAuth token, refreshing browser cache, refreshing data from a non-tracker MCP server. It only invalidates the headless-tracker SQLite cache.  After calling this, follow up with get_holdings or another data tool to actually fetch the fresh data — refresh_data only marks the cache as stale, it does not trigger fetches on its own.
- **get_pnl** — Returns aggregate profit/loss across all configured accounts. Use this when the user asks: 'how am I doing', 'what's my P&L', 'am I up or down', 'show profit', 'show losses', or wants any portfolio performance summary.  Returned fields per account and across the total:   - currentValue (USD) — current portfolio value   - costBasis (USD)    — sum of avgCost * quantity (where the connector tracks it)   - unrealizedPnl (USD) — currentValue - costBasis (for positions still held)   - realizedPnl (USD)   — already-closed P&L from connector metadata   - notes               — caveats per connector (e.g. MetaMask doesn't track cost basis)  Inputs (optional):   - account_id: scope to one account.   - timeframe: '24h' | '7d' | '30d' | 'ytd' | 'all'. When set to anything other     than 'all', the result includes a `windowDelta` block computed from CoinGecko     historical prices. APPROXIMATION CAVEAT: it values your CURRENT basket at     historical prices vs current prices — it does NOT account for trades within     the window. Communicate this honestly to the user. Polymarket positions and     tokens without a CoinGecko mapping are skipped (counted in `skippedSymbols`).     CoinGecko free-tier historical is daily granularity, so '24h' = 'yesterday's close'.   - include_history (boolean, default false): also pulls transactions and runs     a cost-basis ledger over them, returning `realizedFromHistory` per     account + total. Costs an extra round-trip per account but unlocks honest     realized PnL on tokens born on-chain (LP rewards, swaps, native airdrops).     Tokens that arrived via wallet transfer-in (no price) get `unknownSalesCount`     not inflated knownRealized — explicit honesty about what cost basis we know.     POLYMARKET-SPECIFIC: when include_history=true, the Polymarket account's     realizedPnl is replaced by the cost-basis-from-/trades number. Default mode leaves     Polymarket realizedPnl null because the connector's cashPnl mixes realized     + unrealized — set include_history=true to get the real realized number.   - method ('fifo' | 'average', default 'fifo'): cost basis method used when     include_history=true. FIFO consumes oldest lot first per sell; Average Cost     pools all priced acquisitions and sells out at the running average. If the     user mentions 'average cost' / 'avg cost' / 'weighted', use 'average'.     Both methods preserve the 'honest unknown' rule: any sell drawing from an     unpriced deposit/transfer returns realizedPnl=null, NOT a fabricated number.     Has NO effect when include_history=false.   - currency ('USD' | 'EUR' | 'GBP' | 'HUF', default 'USD'): when set to anything     other than USD, ALL numeric fields (currentValue, costBasis, realizedPnl,     unrealizedPnl, windowDelta numbers, realizedFromHistory.knownRealized) are     converted via live FX rates. The fx.source + fetchedAt are surfaced in `meta.fx`.     Use this for currency-consistent rendering when the user asked their dashboard     to be in HUF/EUR/GBP — otherwise per-tab currencies will mismatch. Returns position data only. Not financial advice.
- **get_polymarket_positions** — Returns Polymarket prediction-market positions, grouped by event when possible. Use this when the user asks about their Polymarket bets specifically:   'show my Polymarket positions', 'how am I doing on Polymarket', 'what bets do I have',   'show my prediction market positions', 'election bets', 'sports bets', etc.  For general portfolio queries that mention Polymarket alongside crypto/stocks, prefer get_holdings (with optional asset_class='prediction' filter).  Each position includes:   - market title (human-readable question, e.g. 'Will X win the 2024 election?')   - outcome ('Yes' / 'No' / specific candidate name)   - quantity (conditional tokens held, each worth 0-1 USDC)   - currentPrice (0-1, market's current implied probability)   - currentValue (USD), avgCost (USD per token), cashPnl (realized + unrealized)   - redeemable (true if market resolved and you can claim payout)   - mergeable (true if you can merge Yes+No tokens for guaranteed USDC)   - endDate (when the market resolves)  Inputs (optional):   - account_id: scope to one Polymarket account (if you have multiple).   - group_by_event: 'true' (default) groups Yes+No outcomes for the same market;     'false' returns one row per asset.   - resolved_only: 'true' returns only redeemable positions (markets that have resolved).     Default 'false' returns everything. Returns position data only. Not financial advice.
- **get_transactions** — Returns transaction history (trades, deposits, withdrawals, fees, ERC-20 token transfers) across configured accounts. Use this when the user asks: 'what trades did I make', 'show my transactions', 'transaction history', 'recent buys', 'recent sells', 'show my deposits', 'when did I buy X', 'what did I do this week', etc.  Each transaction includes:   - type: trade / buy / sell / deposit / withdraw / fee / interest / reward / transfer / resolve   - symbol, quantity, price (per-unit at time of transaction)   - fee + feeCurrency   - timestamp (ISO 8601)   - metadata (connector-specific: chain, hash, market, etc.)  Inputs (optional):   - account_id: scope to one account.   - since: shorthand ('24h', '7d', '30d', '90d') OR epoch ms (e.g. 1700000000000).     Default: ~last 50 transactions per account regardless of date.  Coverage caveats (V0):   - Bybit: full transaction log   - MetaMask: native chain transfers + ERC-20 token transfers (USDC, USDT, etc.)   - Polymarket: BUY/SELL trades from the /trades endpoint (up to ~1000 most recent). Returns transaction data only. Not financial advice.
- **get_allocations** — Returns portfolio allocation breakdown — current USD value grouped by a chosen dimension. Use this when the user asks: 'how is my portfolio split', 'allocation breakdown', 'what % is in crypto', 'chain breakdown', 'show my biggest position', 'concentration'.  Groups available:   - 'asset_class' (default): crypto / stock / prediction / cash (cash = stablecoins like USDC/USDT + fiat)   - 'connector':            bybit / metamask / polymarket   - 'account':              one row per configured account   - 'chain':                EVM chain (Ethereum / Polygon / etc.) — only meaningful for MetaMask holdings   - 'symbol':               BTC / ETH / individual market — best for top-N concentration analysis  Each group row includes: label, currentValue (USD), percentOfTotal, holdingCount. Sorted descending by currentValue.  Inputs:   - by: which dimension to group by (see above). Default 'asset_class'.   - top: limit to top N rows (e.g. top: 10 for biggest positions). Default no limit. Returns position data only. Not financial advice.
- **list_accounts** — Lists configured PORTFOLIO TRACKER accounts (Bybit exchange / Binance exchange / MetaMask wallets / Polymarket / Solana wallets / Hyperliquid) without exposing credentials. Use when the user asks: 'what tracker accounts are configured', 'show my portfolio accounts', 'list my exchange connections', 'which crypto exchanges are linked', 'which wallets am I tracking', 'what addresses am I tracking'. Returns: id, connectorId (bybit | binance | metamask | polymarket | solana | hyperliquid), label, createdAt, and connector-specific public metadata (e.g. chainIds and addresses for MetaMask, accountType for Bybit, address for Solana/Hyperliquid, key fingerprint for Binance). Credentials are NEVER returned — they stay in the OS keychain. DO NOT call this tool when the user means: email accounts, social media accounts, GitHub accounts, cloud accounts, OS user accounts, or any 'accounts' from a different domain or MCP server. It's specifically the headless-tracker exchange/wallet connections.
- **setup_connector** — Creates a new account by writing READ-ONLY credentials to the OS keychain. Use when the user asks: 'add a Bybit account', 'connect Binance', 'connect my MetaMask wallet', 'set up Polymarket', 'connect my Solana wallet', 'track my Hyperliquid', 'add my Hyperliquid wallet', 'add new exchange'.  BEHAVIOR CONTRACT FOR YOU (the LLM): - After this tool succeeds, confirm ONLY the account label and account_id back to the user. - NEVER echo, log, paraphrase, or repeat the credential values (apiKey, apiSecret, etherscanApiKey) in your response. - If the user pastes credentials inline in chat, suggest they use the Settings UI (render_settings tool) form instead — the form keeps secrets out of the conversation transcript.  Credentials are validated against the upstream API before they're persisted; if validation fails, nothing is written. Storage: OS keychain (macOS Keychain / Linux Secret Service / Windows Credential Vault) via @napi-rs/keyring. Same path as the CLI setup flow.  All six connectors use READ-ONLY credentials by design (Bybit 'Read' only, Binance 'Enable Reading' only, Etherscan is a public-data rate-limit token, Polymarket proxy wallet is already public, Solana/Hyperliquid addresses are public on-chain identifiers — Hyperliquid needs no key or signature at all).  Inputs (one of bybit / binance / metamask / polymarket / solana / hyperliquid required):   - connector: 'bybit' | 'binance' | 'metamask' | 'polymarket' | 'solana' | 'hyperliquid'   - bybit: { apiKey, apiSecret, accountType: 'UNIFIED'|'CONTRACT'|'SPOT'|'FUND' (primary, also the account ID), accountTypes?: array of additional types to fan out across (e.g. ['FUND'] alongside UNIFIED so funding-wallet balances are tracked too) }   - binance: { apiKey, apiSecret, includeFutures (optional bool, default false), recvWindow (optional ms) }   - metamask: { address, etherscanApiKey, chainIds (number[]), trackCommonTokens (bool), hasEtherscanPro (bool) }   - polymarket: { proxyWallet (0x...), sizeThreshold (default 0.01) }   - solana: { address (base58), rpcUrl (optional premium RPC), dustThresholdUsd (optional, default 0.5) }   - hyperliquid: { address (0x... EVM address you trade from), dustThresholdUsd (optional, default 0.5). No API key — public address only. Tracks perp account equity + open positions + spot balances. }
- **add_wallet_address** — Adds an additional wallet address to an existing MetaMask or Solana account. Use when the user asks: 'add another wallet', 'track a second address', 'add MetaMask address', 'add Solana address'. The new address shares the parent account's settings (Etherscan key + chains for MetaMask; RPC URL for Solana). Wallet addresses are public on-chain identifiers — NO new secrets are stored. Just updates the keychain entry's `addresses[]` field. Inputs:   - account_id: id of the existing account (e.g. 'metamask:0xabc...' or 'solana:Abc...')   - address: EVM 0x-hex address (40 hex chars) for MetaMask accounts, or base58 (32-44 chars) for Solana accounts
- **remove_account** — Deletes an account from the AccountStore AND its credentials from the OS keychain. ONE-WAY operation. The Settings UI requires explicit user confirmation before calling this. Use when the user asks: 'remove the Bybit account', 'disconnect Polymarket', 'forget that wallet'. Inputs:   - account_id: id of the account to remove (e.g. 'bybit:UNIFIED', 'metamask:0xabc...'). Returns: ok, removedAccountId; or error if the account was not found.
- **add_custom_token** — Adds a project-specific ERC-20 token to a MetaMask account's tracked-tokens list. The bundled common tokens (USDC, USDT, WETH, WBTC, LINK, DAI) are tracked by default; this is for additional tokens like project / governance tokens. Use when the user asks: 'track ARB token', 'add UNI to my wallet', 'monitor a custom ERC-20'. Token data is PUBLIC on-chain (contract + symbol + decimals) — NO secrets, NO keychain involved. Inputs:   - account_id: target MetaMask account (e.g. 'metamask:0xabc...')   - chain_id: numeric (1=Ethereum, 137=Polygon, 56=BSC, 8453=Base, 42161=Arbitrum, 10=Optimism)   - contract: 0x-prefixed contract address (40 hex)   - symbol: 1-20 chars   - decimals: 0-36 integer
- **remove_custom_token** — Removes a custom ERC-20 token from a MetaMask account's tracked-tokens list. Public on-chain data, no keychain involvement. Use when the user asks: 'stop tracking ARB', 'remove that token from MetaMask', 'untrack a project token'. Inputs:   - account_id: target MetaMask account (e.g. 'metamask:0xabc...')   - chain_id: numeric (1=Ethereum, 137=Polygon, 56=BSC, 8453=Base, 42161=Arbitrum, 10=Optimism)   - contract: 0x-prefixed contract address (40 hex) Returns ok or a not_found error if the token wasn't tracked under that account+chain.
- **list_custom_tokens** — Lists custom ERC-20 tokens tracked by MetaMask accounts. Public data; no secrets involved. Use when the user asks: 'which custom tokens am I tracking', 'show my project tokens'. Inputs (optional): account_id to filter to one account.
- **render_dashboard** — Render an interactive PORTFOLIO TRACKER dashboard as an MCP App (live UI panel) — for crypto holdings, P&L, prediction markets, on-chain wallets. Use this when the user asks: 'show my portfolio dashboard', 'open my dashboard', 'render the portfolio panel', or wants a live interactive view of holdings / weekly portfolio review / risk audit. Three tabs (Portfolio / Weekly / Risk) with currency switcher (USD/EUR/GBP/HUF) and refresh button. The iframe makes its own tool calls (get_holdings / get_pnl / get_allocations / get_transactions / get_polymarket_positions / refresh_data) as the user clicks tabs and refresh — no extra prompting from you needed once it's open. If the host doesn't render MCP Apps, the tool still returns a textual confirmation but the user won't get the live UI.  DO NOT call this tool when the user means a different kind of dashboard (Vercel deploys, Sentry errors, Grafana metrics, GitHub activity, analytics events, etc.). It's specifically the headless-tracker portfolio dashboard. If the request is ambiguous, ask the user to clarify which dashboard they mean.  Inputs (both optional):   - currency: 'USD' | 'EUR' | 'GBP' | 'HUF'. Initial display currency. User can switch live.   - tab: 'portfolio' | 'weekly' | 'risk'. Initial active tab. User can switch live.
- **render_settings** — Render the PORTFOLIO TRACKER Settings panel as an MCP App (live UI panel) — the GUI alternative to the CLI setup flow for headless-tracker (Bybit / MetaMask / Polymarket connections). Use when the user asks: 'open my portfolio settings', 'add a Bybit account', 'connect my MetaMask wallet to the tracker', 'show my tracker accounts', 'remove this exchange connection', 'add a custom ERC-20 token', 'add another wallet address to track'. Four tabs:   - Accounts: read-only list of configured tracker accounts with Remove buttons (one-way confirm dialog).   - Add Account: forms for Bybit / MetaMask / Polymarket with explicit security disclosure.   - Wallets: add an additional wallet address to an existing MetaMask tracker account.   - Custom Tokens: list + add/remove ERC-20 tokens per chain.  DO NOT call this tool when the user means: app settings (Claude Desktop / VS Code / browser), system preferences, OS settings, account settings on websites, profile settings, notification settings, theme/appearance, or any settings UI from a different MCP server. It's specifically the headless-tracker portfolio-tracker setup panel. If the request is ambiguous (just 'open settings'), ask which settings.  BEHAVIOR CONTRACT FOR YOU (the LLM): If the user pastes credentials directly in chat, prefer pointing them at this Settings UI rather than calling setup_connector with the inline values — the form keeps secrets out of the conversation transcript. After the user uses the form, the tool result is cosmetic confirmation; do NOT echo or paraphrase any credential values that may appear in the conversation.  Inputs (optional):   - tab: 'accounts' | 'add-account' | 'wallets' | 'tokens' — initial active tab.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "headlesstracker": {
    "command": "npx",
    "args": ["-y","headless-tracker"]
  }
}
```

## Documentation

## What tamasPetki/HeadlessTracker MCP server does

tamasPetki/HeadlessTracker MCP server provides a local-first data layer for viewing portfolio information from multiple account types. Supported connectors include Bybit, Binance Spot and Futures, MetaMask-compatible EVM wallets, Solana wallets, Hyperliquid, and Polymarket.

The server exposes normalized data for holdings, transaction history, profit and loss, allocation breakdowns, and Polymarket positions. Holdings can be filtered by account or asset class and displayed in USD, EUR, GBP, or HUF. Allocation results can group positions by asset class, connector, account, chain, or symbol. The server is read-only: its tools do not place orders, withdraw funds, or transfer assets.

## How it works

Accounts are configured locally, and connector data is fetched from upstream exchange APIs and public blockchain or market data sources. Read-only credentials are stored in the OS keychain through the platform's credential storage, while public wallet addresses can be used without private credentials. Credentials are not returned by the account-listing tools.

Responses are cached separately by connector. Use `refresh_data` when the user explicitly needs fresh tracker data, then call a data tool such as `get_holdings`; refreshing only invalidates the SQLite cache and does not fetch results by itself. Non-USD display conversions use live foreign-exchange rates, with the source and retrieval time included in response metadata.

P&L supports account filters, time windows, and optional transaction-history analysis. FIFO and average-cost methods are available when history is included. Time-window comparisons are approximations based on the current basket and historical prices, and some connectors or tokens may be excluded when mappings or cost basis data are unavailable.

## Setup and configuration

Run the server with `npx headless-tracker`. A demo command can show sample portfolio data without accounts, keys, or wallet addresses. The CLI can also be used to configure connectors and query holdings, P&L, or transactions without an MCP host.

The `setup_connector` tool supports Bybit, Binance, MetaMask, Polymarket, Solana, and Hyperliquid. Bybit and Binance use read-only API credentials. MetaMask setup uses a public address, selected chains, and an Etherscan API key for chain data. Polymarket uses a public proxy wallet, while Solana and Hyperliquid use public addresses; Hyperliquid requires no API key. Additional MetaMask or Solana addresses can be added later.

The server also supports custom ERC-20 tracking for MetaMask accounts. The dashboard and settings panels provide interactive MCP App interfaces for portfolio viewing, account management, wallet addresses, and custom tokens. If an MCP host does not render MCP Apps, the corresponding tool returns textual confirmation instead.

## Tools and capabilities

- Retrieve cross-account holdings with `get_holdings`.
- Refresh connector caches with `refresh_data`.
- Calculate aggregate or historical P&L with `get_pnl`.
- Inspect grouped Polymarket positions with `get_polymarket_positions`.
- Query trades, transfers, deposits, withdrawals, fees, and other transactions with `get_transactions`.
- Compare portfolio concentration using `get_allocations`.
- List, add, or remove configured accounts and wallet addresses.
- Add, remove, and list custom ERC-20 tokens.
- Render portfolio and settings MCP App panels.

## Limitations and notes

tamasPetki/HeadlessTracker MCP server supplies portfolio data only and is not financial advice. It does not execute trades or move funds. Connector coverage differs: for example, transaction history includes full Bybit logs, MetaMask native and selected ERC-20 transfers, and recent Polymarket trades. MetaMask may not provide cost basis, and unknown transfer-in costs are not fabricated.

Cached results can be stale until refreshed. Historical P&L windows use daily free-tier price data, so a 24-hour comparison represents the prior day's close rather than a precise intraday calculation. Polymarket positions and tokens without supported price mappings may be skipped from some calculations.

_Full upstream README: https://allmcps.com/mcp/tamaspetki-headlesstracker/readme_

