Investment Portfolio Manager

by ikhyunan

2 stars
402 downloads
Not rated
GitHub

About

Reads in JSON-formatted Investment portfolio and performs web searches and stock price searches to provide meaningful evaluations and recommendations.

Details

Author
ikhyunan
Repository
ikhyunAn/MCP_InvestmentPortfolio
GitHub stars
2
Downloads
402
Categories
Productivity, Developer Tools, Design, File Management, Search, API, Finance
Tags
#web, #visualization

- Create and update investment portfolios with stocks and bonds
- Fetch real-time stock prices and relevant news
- Generate comprehensive portfolio reports and performance analysis
- Provide personalized investment recommendations based on portfolio composition
- Create visual representations of portfolio allocation

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Investment Portfolio Manager
    Command (node, npx, python, etc.) python
    Arguments
    • Argument 1 /path/to/portfolio-manager-mcp/main.py
    Environment
    • NEWS_API_KEY your_key_here
    • ALPHA_VANTAGE_API_KEY your_key_here

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Clone the repository, install dependencies with pip install -r requirements.txt, and optionally set ALPHA_VANTAGE_API_KEY and NEWS_API_KEY environment variables. Run the server with python main.py (stdio mode for Claude Desktop) or python main.py --sse (for HTTP clients). Add the server to your Claude Desktop configuration file under mcpServers, then interact through natural language queries.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

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

Linux

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

Macos

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

Windows

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

Portfolio Manager MCP Server

<p align="center"> Project Logo </p>

<p align="center">
<a href="https://mseep.ai/app/ikhyunan-mcp-investmentportfolio">
MseeP.ai Security Assessment Badge
</a>
</p>

A Model Context Protocol (MCP) server that provides tools and resources for managing and analyzing investment portfolios.

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

Installation

1. Clone this repository:

   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):

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

Alternatively, create a .env file in the root of the directory and store the API keys

Usage

Running the Server

You can run the server in two different modes:

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

   python main.py   # alternate commands: i.e.) python3, python3.11

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

   python main.py --sse

Integration with Claude Desktop

Add the server to your Claude Desktop configuration file:

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

If you choose to run your server in a virtual environment, then your configuration file will look like:

{
  "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"
      }
    }
  }
}

To run it in 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

Or use the MCP CLI for easier installation:

mcp install main.py

Example Queries

Once the server is running and connected to Claude, you can interact with it using natural language:

- "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"

Project Structure

portfolio-manager/
├── main.py                      # Entry point
├── portfolio_server/            # Main package
│   ├── api/                     # External API clients
│   │   ├── alpha_vantage.py     # Stock market data API
│   │   └── news_api.py          # News API
│   ├── data/                    # Data management
│   │   ├── portfolio.py         # Portfolio models
│   │   └── storage.py           # Data persistence
│   ├── resources/               # MCP resources
│   │   └── portfolio_resources.py # Portfolio resource definitions
│   ├── tools/                   # MCP tools
│   │   ├── analysis_tools.py    # Portfolio analysis
│   │   ├── portfolio_tools.py   # Portfolio management
│   │   ├── stock_tools.py       # Stock data and news
│   │   └── visualization_tools.py # Visualization tools
│   └── server.py                # MCP server setup
└── requirements.txt             # Dependencies

Future Work

As of now, the MCP program uses manually created JSON file which keeps track of each user's investment portfolio.

This should be fixed so that it reads in the portfolio data from actual banking applications.

Tasks

- [ ] Extract JSON from a Finance or Banking Application which the user uses
- [ ] Enable modifying the investment portfolio by the client
- [ ] Implement automated portfolio rebalancing
- [ ] Add support for cryptocurrency assets
- [ ] Develop mobile application integration

License

MIT

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.