MCP Trader Server
A Model Context Protocol (MCP) server for stock traders.
Features
Tools
The server provides the following tools for stock analysis and trading:
- analyze-stock: Performs technical analysis on a given stock symbol
- relative-strength: Calculates a stock's relative strength compared to a benchmark
- volume-profile: Analyzes volume distribution by price
- detect-patterns: Identifies chart patterns in price data
- position-size: Calculates optimal position size based on risk parameters
- suggest-stops: Suggests stop loss levels based on technical analysis
Technical Analysis Capabilities
The server leverages several specialized analysis modules:
- TechnicalAnalysis: Core technical indicators and trend analysis
- RelativeStrength: Comparative performance analysis
- VolumeProfile: Advanced volume analysis
- PatternRecognition: Chart pattern detection
- RiskAnalysis: Position sizing and risk management
Data Sources
The server uses the
Tiingo API for market data:
- Historical daily OHLCV data
- Adjusted prices for accurate backtesting
- Up to 1 year of historical data by default
Setup
Prerequisites
Environment Variables
Create a .env
file:
Installing via Smithery
To install Trader for Claude Desktop automatically via
Smithery:
This will:
- Install the MCP Trader server
- Configure it with your Tiingo API key
- Set up the Claude Desktop integration
Smithery Configuration
The server includes a smithery.yaml
configuration file that defines:
- Required configuration parameters (Tiingo API key)
- Command function to start the MCP server
- Integration with Claude Desktop
You can customize the Smithery configuration by editing the smithery.yaml
file.
Installation
Docker Deployment
The project includes a Dockerfile for containerized deployment:
To run the container in HTTP server mode:
Configuration
Claude Desktop App
On MacOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%/Claude/claude_desktop_config.json
Development Configuration:
Development
Build and Run
HTTP Server Mode
The server can also run as a standalone HTTP server for testing or integration with other applications:
This starts an HTTP server on
http://localhost:8000 with the following endpoints:
- GET /list-tools: Returns a list of available tools and their schemas
- POST /call-tool: Executes a tool with the provided arguments
Debugging
Use the MCP Inspector for debugging:
Example Usage
In Claude Desktop:
The server will return a technical analysis summary including trend status, momentum indicators, and key metrics.
NVDA Technical Analysis
Dependencies
See pyproject.toml for full dependency list:
Contributing
Contributions to MCP Trader are welcome! Here are some ways you can contribute:
- Add new tools: Implement additional technical analysis tools or trading strategies
- Improve existing tools: Enhance the accuracy or performance of current tools
- Add data sources: Integrate additional market data providers
- Documentation: Improve the documentation or add examples
- Bug fixes: Fix issues or improve error handling
Development Workflow
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
)
- Commit your changes (
git commit -m 'Add some amazing feature'
)
- Push to the branch (
git push origin feature/amazing-feature
)
- Open a Pull Request
Future Plans
The MCP Trader project has several planned enhancements:
- Portfolio Analysis: Tools for analyzing and optimizing portfolios
- Backtesting: Capabilities to test trading strategies on historical data
- Sentiment Analysis: Integration with news and social media sentiment data
- Options Analysis: Tools for analyzing options strategies and pricing
- Real-time Data: Support for real-time market data feeds
- Custom Strategies: Framework for implementing and testing custom trading strategies
- Alerts: Notification system for price and technical indicator alerts
Further Reading
Learn more about this project through these detailed blog posts:
MCP Trader Server
A Model Context Protocol (MCP) server for stock traders.
Features
Tools
The server provides the following tools for stock analysis and trading:
- analyze-stock: Performs technical analysis on a given stock symbol
- relative-strength: Calculates a stock's relative strength compared to a benchmark
- volume-profile: Analyzes volume distribution by price
- detect-patterns: Identifies chart patterns in price data
- position-size: Calculates optimal position size based on risk parameters
- suggest-stops: Suggests stop loss levels based on technical analysis
Technical Analysis Capabilities
The server leverages several specialized analysis modules:
- TechnicalAnalysis: Core technical indicators and trend analysis
- RelativeStrength: Comparative performance analysis
- VolumeProfile: Advanced volume analysis
- PatternRecognition: Chart pattern detection
- RiskAnalysis: Position sizing and risk management
Data Sources
The server uses the
Tiingo API for market data:
- Historical daily OHLCV data
- Adjusted prices for accurate backtesting
- Up to 1 year of historical data by default
Setup
Prerequisites
Environment Variables
Create a .env
file:
Installing via Smithery
To install Trader for Claude Desktop automatically via
Smithery:
This will:
- Install the MCP Trader server
- Configure it with your Tiingo API key
- Set up the Claude Desktop integration
Smithery Configuration
The server includes a smithery.yaml
configuration file that defines:
- Required configuration parameters (Tiingo API key)
- Command function to start the MCP server
- Integration with Claude Desktop
You can customize the Smithery configuration by editing the smithery.yaml
file.
Installation
Docker Deployment
The project includes a Dockerfile for containerized deployment:
To run the container in HTTP server mode:
Configuration
Claude Desktop App
On MacOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%/Claude/claude_desktop_config.json
Development Configuration:
Development
Build and Run
HTTP Server Mode
The server can also run as a standalone HTTP server for testing or integration with other applications:
This starts an HTTP server on
http://localhost:8000 with the following endpoints:
- GET /list-tools: Returns a list of available tools and their schemas
- POST /call-tool: Executes a tool with the provided arguments
Debugging
Use the MCP Inspector for debugging:
Example Usage
In Claude Desktop:
The server will return a technical analysis summary including trend status, momentum indicators, and key metrics.
NVDA Technical Analysis
Dependencies
See pyproject.toml for full dependency list:
Contributing
Contributions to MCP Trader are welcome! Here are some ways you can contribute:
- Add new tools: Implement additional technical analysis tools or trading strategies
- Improve existing tools: Enhance the accuracy or performance of current tools
- Add data sources: Integrate additional market data providers
- Documentation: Improve the documentation or add examples
- Bug fixes: Fix issues or improve error handling
Development Workflow
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
)
- Commit your changes (
git commit -m 'Add some amazing feature'
)
- Push to the branch (
git push origin feature/amazing-feature
)
- Open a Pull Request
Future Plans
The MCP Trader project has several planned enhancements:
- Portfolio Analysis: Tools for analyzing and optimizing portfolios
- Backtesting: Capabilities to test trading strategies on historical data
- Sentiment Analysis: Integration with news and social media sentiment data
- Options Analysis: Tools for analyzing options strategies and pricing
- Real-time Data: Support for real-time market data feeds
- Custom Strategies: Framework for implementing and testing custom trading strategies
- Alerts: Notification system for price and technical indicator alerts
Further Reading
Learn more about this project through these detailed blog posts: