Portfolio Tracker MCP Server
by Gouliath1
README.md
# Portfolio Tracker MCP Server
A Model Context Protocol (MCP) server that exposes portfolio tracking tools for AI clients.
## Features
- **Get Portfolio Positions**: Retrieve all current positions
- **Get Portfolio P&L**: Calculate profit/loss with optional price refresh
- **Refresh Portfolio Data**: Force refresh of all price data from Yahoo Finance
- **Get Position Details**: Get specific position information
## Setup
1. Install dependencies:
```bash
npm install
```
2. Build the project:
```bash
npm run build
```
3. Start the server:
```bash
npm start
```
## Development
For development with auto-reload:
```bash
npm run dev
```
## MCP Client Configuration
### Claude Desktop
Add to your Claude Desktop configuration:
```json
{
"mcpServers": {
"portfolio-tracker": {
"command": "node",
"args": ["/Users/goul/Development/portfolio-tracker-mcp-server/build/index.js"],
"env": {
"PORTFOLIO_API_URL": "http://localhost:3000"
}
}
}
}
```
### Environment Variables
- `PORTFOLIO_API_URL`: Base URL for the portfolio tracker API (default: http://localhost:3000)
- `DEBUG`: Set to "true" for verbose logging
## Available Tools
1. **get_portfolio_positions**
- Get all current portfolio positions
- No parameters required
2. **get_portfolio_pnl**
- Get profit/loss analysis
- Parameters: `refresh` (boolean, optional) - force refresh prices
3. **refresh_portfolio_data**
- Force refresh all price data
- No parameters required
4. **get_position_details**
- Get details for specific positions
- Parameters: `tickers` (string array) - specific tickers to query
## Usage Examples
Once connected to an AI client, you can ask:
- "What's my current portfolio performance?"
- "Show me my positions"
- "Refresh my portfolio data and show the P&L"
- "How is my NVDA position performing?"
TDQS
A3.8/5.0
Scored across 4 tools
Disambiguation5/5
Each tool has a clearly distinct purpose: P&L analysis, position listing, detailed position info, and data refresh. No overlap or ambiguity.
Naming Consistency4/5
Three tools use 'get_' prefix consistently; the fourth uses 'refresh_' which is a different verb but maintains the same snake_case style. Minor deviation, but pattern is clear.
Tool Count5/5
Four tools are well-scoped for a portfolio tracker, covering essential read operations and a data refresh command. Not too few or too many.
Completeness4/5
The tool set covers reading portfolio data (positions, details, P&L) and refreshing prices. Missing write operations like adding/removing positions, but for a read-only tracker this is appropriate.
Maintenance
ActivityInactive
ResponsivenessNo issues