Build a Portfolio Automation Pipeline with AI: Stock Lists, Optimization, and Rebalancing via MCP
Most MCP servers give you read-only data. You can look up a stock price or pull a financial statement, but you can't do anything with it. Your AI agent is a viewer, not a manager.
With EvidInvest MCP's new portfolio management tools, that changes. You can now create stock lists, build watchlists, track portfolios, run MPT optimization, and check valuations — all in a single conversation with Claude. No spreadsheets. No switching between tabs. No UI at all.
This post walks through a real workflow: from an empty portfolio to a fully optimized, valuation-checked allocation — using nothing but natural language.
The Problem with Traditional Portfolio Management
Here's what a typical rebalancing workflow looks like without AI:
- Open your brokerage account, note current holdings
- Open a screener, check valuations for each position
- Open a spreadsheet, enter weights and prices
- Google "portfolio optimizer", find a website, paste in tickers
- Compare optimizer output to your current allocation
- Decide what to trim, what to add
- Repeat next quarter
That's 7 steps across 4 different tools, and most people skip steps 4-6 because it's too much friction. The result: portfolios drift, overweight positions go unchecked, and rebalancing happens based on gut feel instead of math.
The MCP Alternative: One Conversation, Full Pipeline
EvidInvest MCP gives your AI agent 6 portfolio management tools alongside 28 valuation and analysis tools. Together, they create a closed-loop pipeline:
Create a portfolio list and add your holdings. Analyze each position with DCF, fair value ranges, and growth rates. Optimize the portfolio using Modern Portfolio Theory. Compare your current allocation to the optimal weights. Rebalance by identifying overweight/underweight positions. Update your list as you make changes.
All of this happens in one MCP session. No context switching. No copy-pasting between tools.
Step 1: Create a Portfolio List
Start by telling Claude what you own:
Create a portfolio list called "My Portfolio" with these stocks:
AAPL, MSFT, NVDA, GOOGL, AMZN, JPM, JNJ, KO
Under the hood, Claude calls create_user_stock_list with the name, type "portfolio", and your symbols. The list is saved to your EvidInvest account — persistent across sessions, visible in the web UI, and accessible from any MCP client.
You can also create watchlists for stocks you're researching but don't own yet:
Create a watchlist called "Earnings Watch" with: AMD, CRM, NFLX, UBER
And regular lists for sector research, screening results, or any grouping you want:
Create a stock list called "Dividend Aristocrats" with: PG, KO, JNJ, MMM, PEP, CL, ABT
Step 2: Get Fair Values for Every Position
Now ask Claude to value each holding:
For every stock in my "My Portfolio" list, get the fair value range.
Which positions are overvalued vs. undervalued?
Claude calls list_user_stock_lists to find your portfolio, then runs get_fair_value_range for each symbol. You get back bear/base/bull fair value estimates combining DCF, sector PE, and PEG models — with a clear over/undervalued label for each position.
This is where the pipeline gets interesting: you're not just looking at prices, you're getting multi-model intrinsic value estimates that tell you whether each position is worth holding at current levels.
Step 3: Optimize with MPT
Run MPT Max Sharpe optimization on my "My Portfolio" stocks.
What weights does the math suggest?
Claude calls optimize_portfolio with your symbols. The optimizer uses 252 days of historical price data, computes a covariance matrix with Oracle Approximating Shrinkage (OAS), and finds the weight combination that maximizes the Sharpe ratio.
The output tells you:
- Optimal weight for each stock
- Expected annual return and volatility
- Sharpe ratio of the optimized portfolio
- Which stocks the optimizer excludes (sets to 0%) and why
Step 4: Compare and Find Rebalance Candidates
Here's where you bring it all together:
Compare my current equal-weight allocation to the MPT optimal weights.
For positions where I'm overweight vs. optimal, show the fair value assessment.
Should I trim positions that are both overweight AND overvalued?
Claude cross-references the optimizer output with the valuation data and gives you concrete recommendations:
- Trim: positions where you're overweight AND the stock is trading above fair value
- Hold: positions near optimal weight with fair valuations
- Add: positions where you're underweight AND the stock is undervalued
This is the kind of analysis that used to require a Bloomberg terminal, a spreadsheet, and an afternoon. With MCP, it's one prompt.
Step 5: Update Your List
As you make trades, update your portfolio list:
Remove JNJ from my "My Portfolio" list.
Add COST and TGT instead.
Claude calls remove_symbols_from_user_list and add_symbols_to_user_list. Your list stays current, and next time you ask for optimization or valuation, it uses the updated holdings.
Step 6: Risk Check
Before you execute any trades, run a risk decomposition:
Run portfolio risk decomposition on my "My Portfolio" stocks with optimal weights.
What's the portfolio VaR and CVaR?
Which positions contribute the most to risk?
Claude calls portfolio_risk_decomposition and breaks down:
- Value at Risk (VaR 95%): the worst daily loss you'd expect 95% of the time
- Conditional VaR (CVaR 95%): the average loss in the worst 5% of days
- Marginal Contribution to Risk (MCR) per position: which stocks are actually driving your portfolio's volatility
- Diversification ratio: how much diversification benefit you're getting
If one position dominates the risk budget, you know where to trim — even if the valuation says "hold."
The Watchlist-to-Portfolio Pipeline
One of the most powerful patterns is promoting stocks from a watchlist to a portfolio:
1. List my watchlists
2. For my "Earnings Watch" watchlist, compare all stocks on PE and fair value
3. The 3 cheapest — create a new portfolio list called "Q2 Picks" with those stocks
4. Run MPT optimization on Q2 Picks
5. What's the expected Sharpe ratio?
This turns your research pipeline into your portfolio pipeline. Stocks flow from watchlist to portfolio based on quantitative criteria, not gut feel.
Why This Matters
The traditional workflow has high friction at every step. Friction means people skip steps. Skipping steps means:
- Portfolios drift without rebalancing
- Overvalued positions get held too long
- Optimization never happens because it's "too complicated"
- Watchlists accumulate stocks that never get evaluated
The MCP pipeline removes that friction entirely. Every step is a natural language request. The AI agent handles the tool calls, the data fetching, and the cross-referencing. You just make decisions.
Tools Used in This Pipeline
| Tool | What it does |
|---|---|
create_user_stock_list | Create portfolio, watchlist, or custom list |
list_user_stock_lists | See all lists with symbols and counts |
add_symbols_to_user_list | Add stocks to any list |
remove_symbols_from_user_list | Remove stocks from any list |
set_user_list_watched | Toggle watchlist tracking |
delete_user_stock_list | Delete a list |
optimize_portfolio | MPT Max Sharpe / Min Variance optimization |
portfolio_risk_decomposition | VaR, CVaR, MCR per position |
get_fair_value_range | Bear/base/bull intrinsic value |
get_dcf_valuation | Full DCF with projections |
compare_stocks | Side-by-side valuation comparison |
get_cagr_matrix | Multi-period growth rates |
Get Started
- Get an API key at evidinvest.com/developers
- Connect to Claude Desktop — add EvidInvest MCP in your settings
- Start with: "Create a portfolio list with my holdings and optimize it"
That's it. Your AI agent is now your portfolio manager.
{
"mcpServers": {
"evidinvest": {
"type": "streamable-http",
"url": "https://mcp.evidinvest.com/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_KEY"
}
}
}
}
Get the next deep dive
Subscribe to EvidInvest updates and get future valuation breakdowns and portfolio research delivered to your inbox.