Package Exports
- alphabots-mcp-server
- alphabots-mcp-server/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (alphabots-mcp-server) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Alphabots MCP Server
A self-contained Model Context Protocol (MCP) server for Alphabots trading platform integration with advanced Indian market support.
Features
- Portfolio Insights: Get comprehensive portfolio holdings and financial insights
- Real-time Data: Fetch live trading data from Alphabots platform with Yahoo Finance integration
- Enhanced Symbol Processing: Support for exchange prefixes (NSE:, BSE:) and complex symbol formats
- Weekly Expiry Support: Advanced parsing for weekly options with YYMDD format
- Options Analysis: Intelligent detection and analysis of CE/PE options contracts
- Indian Market Focus: Optimized for NSE, BSE, and Indian derivatives
- MCP Compatible: Fully compliant with Model Context Protocol stdio transport
- Self-contained: No external file dependencies, runs as standalone package
- Docker Ready: Easy deployment with Docker and Docker Compose
Quick Start
Using npx (Recommended)
# Set your MCP token
export MCP_TOKEN=your_mcp_token_here
# Run the server
npx alphabots-mcp-server
Using Docker
- Build and run with Docker Compose:
# Set your MCP token in environment
export MCP_TOKEN=your_mcp_token_here
# Build and start the container
docker-compose up --build
- Or build and run manually:
# Build the image
docker build -t alphabots-mcp-server .
# Run the container
docker run -e MCP_TOKEN=your_mcp_token_here alphabots-mcp-server
Local Development
# Clone and install dependencies
npm install
# Set environment variable
export MCP_TOKEN=your_mcp_token_here
# Start the server
npm start
Environment Variables
Variable | Required | Description |
---|---|---|
MCP_TOKEN |
Yes | Your Alphabots MCP authentication token |
Available Tools
get_user_broker_insights
Retrieves comprehensive portfolio data including:
- Total invested amount
- Current portfolio value
- Total profit/loss
- Top gaining and losing positions
- Detailed holdings with individual P&L
Usage:
{
"name": "get_user_broker_insights",
"arguments": {}
}
get_advanced_portfolio_analysis
Provides advanced portfolio analysis with enhanced features:
- Options Analysis: Detailed analysis of CE/PE options contracts
- Real-time Pricing: Live market data integration via Yahoo Finance
- Symbol Intelligence: Advanced symbol mapping and normalization
- Weekly Expiry Support: Parsing for weekly options (YYMDD format)
- Exchange Prefix Handling: Support for NSE:, BSE: prefixed symbols
- Enhanced Insights: Comprehensive market data and analytics
Usage:
{
"name": "get_advanced_portfolio_analysis",
"arguments": {}
}
refresh_broker_insights
Triggers a refresh of broker insights data from the Alphabots platform. This tool should be used when:
- User specifically requests a data refresh
- Holdings data is stale (more than 1 day old)
- Real-time data synchronization is needed
Important Notes:
- Refresh operation can take up to 10 seconds to complete
- Use sparingly to avoid unnecessary API load
- Prefer user-initiated refresh requests
Usage:
{
"name": "refresh_broker_insights",
"arguments": {}
}
Supported Symbol Formats
The server intelligently handles various Indian market symbol formats:
Stock Symbols
RELIANCE
- Direct stock symbolsNSE:RELIANCE
- Exchange prefixed symbolsBSE:RELIANCE
- BSE exchange symbols
Options Contracts
NIFTY24JAN17000CE
- Monthly expiry optionsNIFTY24125CE
- Weekly expiry options (YYMDD format)BANKNIFTY24FEB45000PE
- Bank Nifty optionsNSE:SENSEX24125CE
- Exchange prefixed options
Index Symbols
NIFTY
,BANKNIFTY
,SENSEX
,FINNIFTY
- Automatic mapping to Yahoo Finance format (^NSEI, etc.)
Docker Deployment
Production Deployment
- Create environment file:
echo "MCP_TOKEN=your_actual_token_here" > .env
- Deploy with Docker Compose:
docker-compose up -d
- Check logs:
docker-compose logs -f
Docker Commands
# Build image
docker build -t alphabots-mcp-server .
# Run container
docker run -d --name mcp-server -e MCP_TOKEN=your_token alphabots-mcp-server
# View logs
docker logs mcp-server
# Stop container
docker stop mcp-server
# Remove container
docker rm mcp-server
Configuration
The server validates the MCP token on startup. Ensure your token:
- Starts with
mcp_
- Is longer than 10 characters
- Has valid Alphabots API access
Troubleshooting
Common Issues
Invalid Token Error:
- Verify your MCP_TOKEN is correctly set
- Ensure token starts with
mcp_
and is valid
API Connection Issues:
- Check network connectivity
- Verify token has proper API permissions
Docker Issues:
- Ensure Docker is running
- Check environment variables are properly set
Logs
The server provides detailed logging:
- Startup information
- API request/response details
- Error messages with context
Security
- Runs as non-root user in Docker
- Environment variables for sensitive data
- No hardcoded credentials
- Minimal attack surface
Requirements
- Node.js 18+ (for local development)
- Docker (for containerized deployment)
- Valid Alphabots MCP token
Repository
- GitHub: https://github.com/adminalphabots/alphabots_public/tree/main/alphabots-mcp-server
- Issues: https://github.com/adminalphabots/alphabots_public/issues
License
MIT License