Enables users to create, manage, and analyze investment portfolios with real-time market data, personalized recommendations, and visual representations of asset allocation.
A Model Context Protocol (MCP) server that provides tools and resources for managing and analyzing investment portfolios.
Clone this repository:
git clone https://github.com/ikhyunAn/portfolio-manager-mcp.git cd portfolio-manager-mcp
Install the required dependencies:
pip install -r requirements.txt
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
You can run the server in two different modes:
Stdio Transport (default, for Claude Desktop integration):
python main.py # alternate commands: i.e.) python3, python3.11
SSE Transport (for HTTP-based clients):
python main.py --sse
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
Once the server is running and connected to Claude, you can interact with it using natural language:
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
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.
MIT
Discover shared experiences
Shared threads will appear here, showcasing real-world applications and insights from the community. Check back soon for updates!