Investment Portfolio Manager MCP server

Reads in JSON-formatted Investment portfolio and performs web searches and stock price searches to provide meaningful evaluations and recommendations.
Back to servers
Setup instructions
Provider
Ikhyun An
Release date
Apr 06, 2025
Language
Python
Stats
5 stars

The Portfolio Manager MCP server provides tools and resources for managing and analyzing investment portfolios. It offers real-time stock data, portfolio analysis, personalized recommendations, and visualization capabilities through a Model Context Protocol (MCP) server that integrates with Claude.

Installation

Prerequisites

Before installing, you'll need:

  • Python installed on your system
  • Git for cloning the repository
  • API keys from Alpha Vantage and News API (optional but recommended for full functionality)

Step-by-Step Installation

  1. Clone the repository and navigate to the directory:

    git clone https://github.com/ikhyunAn/portfolio-manager-mcp.git
    cd portfolio-manager-mcp
    
  2. Install the required dependencies:

    pip install -r requirements.txt
    
  3. Set up API keys (optional but recommended for full functionality):

    export ALPHA_VANTAGE_API_KEY="your_key_here"
    export NEWS_API_KEY="your_key_here"
    

    Alternatively, create a .env file in the root directory to store your API keys.

Usage

Running the Server

The server can be run in two different modes:

  1. Stdio Transport (default mode for Claude Desktop integration):

    python main.py
    
  2. SSE Transport (for HTTP-based clients):

    python main.py --sse
    

Integrating with Claude Desktop

To integrate the server with Claude Desktop:

  1. Add the server to your Claude Desktop configuration file:

    {
      "mcpServers": {
        "portfolio-manager": {
          "command": "python",
          "args": ["/path/to/portfolio-manager-mcp/main.py"],
          "env": {
            "ALPHA_VANTAGE_API_KEY": "your_key_here",
            "NEWS_API_KEY": "your_key_here"
          }
        }
      }
    }
    
  2. If using a virtual environment:

    {
      "mcpServers": {
        "portfolio-manager": {
          "command": "/path/to/portfolio-manager-mcp/venv/bin/python",
          "args": ["/path/to/portfolio-manager-mcp/main.py"],
          "env": {
            "PYTHONPATH": "/path/to/portfolio-manager-mcp",
            "ALPHA_VANTAGE_API_KEY": "your_key_here",
            "NEWS_API_KEY": "your_key_here"
          }
        }
      }
    }
    

Using a Virtual Environment

For a cleaner installation, you can use a virtual environment:

# Create a virtual environment
python3 -m venv venv

# Activate the virtual environment
source venv/bin/activate  # On macOS/Linux
# or
# venv\Scripts\activate   # On Windows

# Install dependencies
pip install -r requirements.txt

# Run the server
python3 main.py

Using MCP CLI

For easier installation, you can use the MCP CLI:

mcp install main.py

Interacting with the Portfolio Manager

Once the server is running and connected to Claude, you can interact using natural language queries such as:

  • "Create a portfolio with 30% AAPL, 20% MSFT, 15% AMZN, and 35% US Treasury bonds with user Id <User_ID>"
  • "What's the recent performance of my portfolio?"
  • "Show me news about the stocks in my portfolio"
  • "Generate investment recommendations for my current portfolio"
  • "Visualize my current asset allocation"

Features

The Portfolio Manager MCP server offers several key features:

  • Portfolio Management: Create and update investment portfolios with stocks and bonds
  • Market Data: Fetch real-time stock price information and relevant news
  • Analysis: Generate comprehensive portfolio reports and performance analysis
  • Recommendations: Get personalized investment recommendations based on portfolio composition
  • Visualization: Create visual representations of portfolio allocation

Currently, the MCP program uses manually created JSON files to track each user's investment portfolio, with plans to integrate with actual banking applications in the future.

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "portfolio-manager" '{"command":"python","args":["/path/to/portfolio-manager-mcp/main.py"],"env":{"ALPHA_VANTAGE_API_KEY":"your_key_here","NEWS_API_KEY":"your_key_here"}}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "portfolio-manager": {
            "command": "python",
            "args": [
                "/path/to/portfolio-manager-mcp/main.py"
            ],
            "env": {
                "ALPHA_VANTAGE_API_KEY": "your_key_here",
                "NEWS_API_KEY": "your_key_here"
            }
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "portfolio-manager": {
            "command": "python",
            "args": [
                "/path/to/portfolio-manager-mcp/main.py"
            ],
            "env": {
                "ALPHA_VANTAGE_API_KEY": "your_key_here",
                "NEWS_API_KEY": "your_key_here"
            }
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later