Thank you for your interest in contributing to TradingViewMCPServer! This document provides guidelines for contributions.
- Be respectful and inclusive
- Focus on constructive feedback
- Help maintain a welcoming environment
- Support fellow contributors
- Fork the repository
- Clone your fork:
git clone https://github.com/YOUR_USERNAME/TradingViewMCPServer.git - Create a branch:
git checkout -b feature/your-feature-name - Make your changes
- Test thoroughly
- Submit a pull request
# Clone the repository
git clone https://github.com/YOUR_USERNAME/TradingViewMCPServer.git
cd TradingViewMCPServer
# Create virtual environment
python3 -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install in development mode
pip install -e .
# Create .env file with your Alpha Vantage API key
echo "ALPHA_VANTAGE_API_KEY=your_key_here" > .envTradingViewMCPServer/
├── tradingview_mcp/
│ ├── __init__.py
│ └── server.py # Main MCP server with all tools
├── .env # API credentials (not in repo)
├── .gitignore
├── LICENSE
├── README.md
├── CONTRIBUTING.md
└── pyproject.toml
- Follow PEP 8 conventions
- Use type hints where applicable
- Add docstrings to all functions
- Keep functions focused and modular
- Use descriptive variable names
When adding a new technical indicator:
- Add the indicator calculation function
- Register it as an MCP tool in
server.py - Include proper error handling
- Add documentation in the tool description
- Test with multiple assets and timeframes
Example structure:
def calculate_indicator(data, params):
"""
Calculate technical indicator.
Args:
data: Price data
params: Indicator parameters
Returns:
Calculated values
"""
# Implementation here
passTo add support for new asset types:
- Update the asset validation logic
- Add new symbols to supported lists
- Update documentation
- Test data fetching for new asset type
- Test with real API calls (use your own API key)
- Verify all timeframes work correctly
- Test error handling (invalid symbols, API failures)
- Check rate limit handling
- Validate output formats
- Respect Alpha Vantage rate limits (5 calls/minute for free tier)
- Include appropriate delays between requests
- Handle API errors gracefully
- Cache results when possible
- Document any new API endpoints used
- Update README.md for user-facing changes
- Add code comments for complex logic
- Update tool descriptions in server.py
- Include usage examples for new features
- Document any new dependencies
- Ensure your code follows the style guidelines
- Update documentation as needed
- Test your changes thoroughly
- Reference related issues in your PR description
- Wait for review and address feedback
- Keep your PR focused on a single feature/fix
Use the bug report template and include:
- Python version
- OS and version
- Steps to reproduce
- Expected vs actual behavior
- Error logs
- Asset/symbol being tested
Use the feature request template and ensure the feature:
- Adds value to trading analysis
- Aligns with project goals
- Is technically feasible
- Doesn't violate Alpha Vantage terms
We welcome:
- New technical indicators
- Performance improvements
- Bug fixes
- Documentation improvements
- Error handling enhancements
- Test coverage
- API optimization
- Trading bots or automated trading features
- Features requiring paid API tiers without alternatives
- Breaking changes without migration path
- Code that violates Alpha Vantage terms of service
- Proprietary/closed-source indicators without permission
def get_technical_indicator(
symbol: str,
interval: str,
period: int
) -> dict:
"""
Calculate technical indicator for given symbol.
Args:
symbol: Trading symbol (e.g., 'AAPL', 'EURUSD')
interval: Time interval ('5m', '1h', '1d')
period: Lookback period for calculation
Returns:
Dictionary containing indicator values and metadata
Raises:
ValueError: If symbol or interval is invalid
APIError: If API request fails
"""
passtry:
result = fetch_data(symbol)
except requests.RequestException as e:
return {
"error": "API request failed",
"details": str(e),
"suggestion": "Check your API key and network connection"
}@server.call_tool()
async def call_tool(name: str, arguments: dict) -> list[TextContent]:
"""Handle tool calls with proper error handling."""
try:
if name == "your_tool":
result = your_function(**arguments)
return [TextContent(
type="text",
text=json.dumps(result, indent=2)
)]
except Exception as e:
logger.error(f"Error in {name}: {str(e)}")
return [TextContent(
type="text",
text=json.dumps({"error": str(e)}, indent=2)
)]- Test with forex pair (e.g., EURUSD)
- Test with stock symbol (e.g., AAPL)
- Test with cryptocurrency (e.g., BTC)
- Test all supported timeframes
- Test error handling (invalid symbol)
- Verify output format is valid JSON
- Check rate limiting doesn't cause errors
- Test with Claude Desktop integration
# Test the server directly
python tradingview_mcp/server.py stdio
# Test via Claude Desktop
# Ask Claude: "What's the current price of AAPL?"We use semantic versioning (MAJOR.MINOR.PATCH):
- MAJOR: Breaking changes
- MINOR: New features (backward compatible)
- PATCH: Bug fixes
- Open an issue with the "question" label
- Check existing issues and discussions
- Review the README and documentation
- Check Alpha Vantage documentation for API questions
Contributors will be:
- Listed in release notes
- Mentioned in significant feature additions
- Credited in documentation for major contributions
By contributing, you agree that your contributions will be licensed under the MIT License.
Open an issue with the label "question" or reach out via GitHub Discussions.
Thank you for contributing to TradingViewMCPServer!