Skip to main content
Glama
quanttrucker

portfolio-analytics-mcp

by quanttrucker

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
PORTFOLIO_ANALYTICS_CACHENoOverrides the cache directory for price data. Defaults to ~/.cache/portfolio-analytics-mcp.

Capabilities

Features and capabilities supported by this server

CapabilityDetails
tools
{
  "listChanged": false
}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}
experimental
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
portfolio_betaA

Compute the beta of a portfolio you supply against a benchmark.

Use this to answer how sensitive a set of holdings is to a market index — "what is my portfolio's beta to the S&P", "is this book more or less volatile than the market". Beta is estimated from daily returns over the lookback window.

You must pass the holdings in; this tool has no access to any brokerage account and cannot look up what someone owns. Weights need not sum to 1. Non-US listings need an exchange code to resolve the right venue.

Returns the portfolio beta, each holding's individual beta, and — importantly — the number of overlapping observations and the date range actually used, which is usually shorter than the range requested because of holidays and listing dates. A beta computed on very few observations comes back with a note saying so, and comes back as null rather than a misleading number when there are too few to estimate at all.

sector_correlationA

Compute the correlation matrix between sectors of a portfolio you supply.

Use this to answer how diversified a book actually is — "are my sectors moving together", "where is the concentration risk". Each sector becomes a single weighted return series built from its members, and the tool correlates those series against each other.

Every holding needs a sector label; holdings without one are ignored. Weights are used to size members within their sector and default to equal weighting. As with every tool here, you supply the portfolio — nothing is looked up.

A correlation can legitimately come back null: if a sector's members offset each other exactly, its series has no variance and correlation against it is undefined rather than zero.

revalue_positionsA

Match buys and sells FIFO and compute realised and unrealised P&L.

Use this to turn a list of fills into a trade history — "what did I actually make on these trades", "which positions are still open", "what is my realised P&L". Fills are matched first-in-first-out per instrument: a sell consumes the oldest open lots first, and any excess opens a position in the opposite direction, so a sell of 150 against a long of 100 closes the 100 and leaves a short of 50. Longs and shorts are handled symmetrically.

Pass the executions in; this tool cannot fetch anyone's trade history. Realised P&L is converted to your reporting currency at the closing fill's FX rate, which is where the gain is crystallised.

Optionally pass marks (symbol to current price) to get unrealised P&L on whatever remains open. Symbols without a mark are reported with a null rather than being treated as flat.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

Latest Blog Posts

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/quanttrucker/portfolio-analytics-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server