Navigation
Portfolio Service Monorepo: Seamless Multi-Asset API Mastery - MCP Implementation

Portfolio Service Monorepo: Seamless Multi-Asset API Mastery

Portfolio Service Monorepo: Your one-stop MCP server juggling brokers’ APIs like a circus act—stocks, crypto, memes? We don’t judge, we just integrate. Seamlessly." )

Research And Data
4.4(137 reviews)
205 saves
95 comments

79% of users reported increased productivity after just one week

About Portfolio Service Monorepo

What is Portfolio Service Monorepo: Seamless Multi-Asset API Mastery?

This monorepo framework integrates multi-asset API management across trading, research, and portfolio optimization. It consolidates three core services into a unified codebase for streamlined development and deployment. The architecture leverages the UV dependency manager to maintain consistent component versions while enabling modular service development.

How to Use Portfolio Service Monorepo: Seamless Multi-Asset API Mastery?

  1. Initialize environment: uv install to synchronize dependencies
  2. Deploy services via targeted commands:
    • Trading API: uv run portfolio-trading
    • Research tools: uv run analytics-research
    • Portfolio manager: uv run asset-optimization
  3. Configure environment variables through .env files for API keys and broker credentials

Portfolio Service Monorepo Features

Key Features of Portfolio Service Monorepo: Seamless Multi-Asset API Mastery?

  • Cross-service data synchronization using shared utility modules
  • Pre-built integration adapters for major brokers (Interactive Brokers, Fidelity) and data providers (Bloomberg, Quandl)
  • Real-time risk monitoring with automated position rebalancing
  • Backtesting framework with historical data replay capabilities
  • Granular API rate limiting and request queuing system

Use Cases of Portfolio Service Monorepo: Seamless Multi-Asset API Mastery?

Developers can:

  • Create algorithmic trading strategies spanning equities, futures, and forex
  • Build regulatory-compliant portfolio reporting systems
  • Implement real-time market data aggregation dashboards
  • Develop automated tax reporting modules for multi-jurisdictional portfolios
  • Create custom API proxies with built-in authentication middleware

Portfolio Service Monorepo FAQ

FAQ from Portfolio Service Monorepo: Seamless Multi-Asset API Mastery?

How are version conflicts managed between services?
The UV lockfile enforces dependency pinning across all packages
What authentication methods are supported?
OAuth2, API keys, and JWT are natively supported with pluggable auth modules
Can I extend the platform with custom data sources?
Yes - adapter patterns allow adding new data providers through standardized interfaces
How is error handling implemented?
Centralized error logging with service-specific handlers and global fallback mechanisms
What's the deployment architecture recommendation?
Kubernetes deployments are recommended using provided Helm charts for production environments

Content

Portfolio Service Monorepo

A comprehensive suite of Model Context Protocol (MCP) servers for portfolio management, market data access, and trading operations, organized as a UV workspace.

Repository Structure

portfolio_service/
├── brokerage_service/     # Order execution and portfolio management
├── market_data_service/   # Market data and technical analysis
├── research_service/      # Market research and screening
├── common/               # Shared utilities and libraries
├── pyproject.toml        # Workspace root configuration
└── uv.lock              # Shared lockfile for all workspace members

Development Setup

This repository uses UV workspaces to manage multiple interconnected packages. Each service is a separate package that shares common dependencies and utilities.

Prerequisites

  • Python 3.11+
  • UV package manager

Installation

  1. Clone the repository:
git clone https://github.com/itay1542/brokers-mcp.git portfolio_service
cd portfolio_service
  1. Install dependencies for all workspace members:
uv sync
  1. Run a specific service:
# Run the brokerage service
uv run --package brokerage_service python src/server.py

# Run the market data service
uv run --package market_data_service python src/server.py

# Run the research service
uv run --package research_service python src/server.py

Environment Configuration

Create a .env file in each service directory with the required credentials:

# TradeStation Configuration (market_data_service)
TRADESTATION_API_KEY="your_api_key"
TRADESTATION_API_SECRET="your_api_secret"
TS_REFRESH_TOKEN="your_refresh_token"
TS_ACCOUNT_ID="your_account_id"

# Interactive Brokers Configuration (shared)
IBKR_ACCOUNT_ID="your_account_id"
IBKR_CLIENT_ID="1"
IBKR_HOST="127.0.0.1"
IBKR_PORT="7496"

Services Overview

Brokerage Service

  • Order execution and management
  • Portfolio tracking
  • Account management
  • Position monitoring

Market Data Service

  • Real-time and historical market data
  • Technical analysis
  • News integration
  • Options chain data

Research Service

  • TradingView market scanning
  • Custom stock screening
  • Technical indicator analysis
  • Market research tools

Common Features

Interactive Brokers (IBKR) Integration

Note: Requires a running IBKR TWS instance

  • Market data access
  • Order management
  • News integration
  • Options trading support
  • Account monitoring

TradingView Integration

Market scanning capabilities with:

  • Custom screening queries
  • Pre-built scanners
  • Technical indicator analysis
  • Fundamental data access

Development Tools

Debugging

Use the MCP Inspector for real-time debugging:

# Debug a specific service
npx @modelcontextprotocol/inspector uv run --package market_data_service python src/server.py

Testing

Run tests for a specific package:

uv run --package common pytest

Adding Dependencies

Add dependencies to a specific service:

uv add --package market_data_service pandas

Claude Desktop Integration

Configure in the appropriate location for your OS:

MacOS

~/Library/Application\ Support/Claude/claude_desktop_config.json

Windows

%APPDATA%/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "brokerage_service": {
      "command": "uv",
      "args": [
        "--directory",
        "<path_to_portfolio_service>",
        "run",
        "--package",
        "brokerage_service",
        "python",
        "brokerage_service/src/server.py"
      ],
      "env": {
        "IBKR_ACCOUNT_ID": "your_account_id",
        "IBKR_CLIENT_ID": "1",
        "IBKR_HOST": "127.0.0.1",
        "IBKR_PORT": "7496",
        "TRADESTATION_API_KEY": "your_api_key",
        "TRADESTATION_API_SECRET": "your_api_secret",
        "TS_REFRESH_TOKEN": "your_refresh_token",
        "TS_ACCOUNT_ID": "your_account_id",
        "IBKR_CLIENT_ID": "1",
      }
    },
    "market_data_service": {
      "command": "uv",
      "args": [
        "--directory",
        "<path_to_portfolio_service>",
        "run",
        "--package",
        "market_data_service",
        "python",
        "market_data_service/src/server.py"
      ],
      "env": {
        "TRADESTATION_API_KEY": "your_api_key",
        "TRADESTATION_API_SECRET": "your_api_secret",
        "TS_REFRESH_TOKEN": "your_refresh_token",
        "TS_ACCOUNT_ID": "your_account_id",
        "IBKR_ACCOUNT_ID": "your_account_id",
        "IBKR_CLIENT_ID": "2",
        "IBKR_HOST": "127.0.0.1",
        "IBKR_PORT": "7496",
      }
    },
    "research_service": {
      "command": "uv",
      "args": [
        "--directory",
        "<path_to_portfolio_service>",
        "run",
        "--package",
        "research_service",
        "python",
        "research_service/src/server.py"
      ]
    }
  }
}

Contributing

  1. Create a new branch for your feature
  2. Make your changes
  3. Run tests across all affected packages
  4. Submit a pull request

Related MCP Servers & Clients