TA-Lib MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@TA-Lib MCP Server calculate the 14-day RSI for AAPL's closing prices over the last month"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
TA-Lib MCP Server
Technical analysis indicators MCP server and HTTP API for the Model Context Protocol.
Quick Start
# Install dependencies
uv sync --dev
# Copy logging configuration
cp logging.conf.example logging.conf
# Run MCP server with STDIO transport (default)
uv run python -m mcp_talib.cli --mode mcp --transport stdio
# Run MCP server with HTTP transport
uv run python -m mcp_talib.cli --mode mcp --transport http --port 8000
# Run HTTP API server only
uv run python -m mcp_talib.cli --mode api --port 8001
# Run CLI tools directly
uv run python -m mcp_talib.cli_tools list
uv run python -m mcp_talib.cli_tools call sma --close '[1,2,3,4,5]' --timeperiod 3Related MCP server: mcp-tradingview-server
Architecture
This project provides three independent access methods:
1. MCP Server (--mode mcp)
Pure MCP protocol implementation exposing all TA-Lib indicators as MCP tools
Supports both STDIO and HTTP transports
For use with MCP clients (Claude Desktop, MCP Inspector, MCP.js, etc.)
No REST endpoints
Run with STDIO (for Claude Desktop):
uv run python -m mcp_talib.cli --mode mcp --transport stdioRun with HTTP (for MCP Inspector or web clients):
uv run python -m mcp_talib.cli --mode mcp --transport http --port 8000
# Then connect MCP Inspector to http://localhost:8000/mcp2. HTTP API Server (--mode api)
Pure REST API with
/api/tools/*JSON endpointsFor programmatic HTTP access to indicators
No MCP protocol, just clean REST
Run HTTP API:
uv run python -m mcp_talib.cli --mode api --port 8001Example request:
curl -X POST http://localhost:8001/api/tools/sma \
-H 'Content-Type: application/json' \
-d '{"close": [1,2,3,4,5], "timeperiod": 3}'3. CLI Tools
Direct command-line access to all indicators via Typer:
uv run python -m mcp_talib.cli_tools list
uv run python -m mcp_talib.cli_tools call sma --close '[1,2,3,4,5]' --timeperiod 3Features
All TA-Lib Overlap Studies: BBANDS, DEMA, EMA, HT_TRENDLINE, KAMA, MA, MAMA, MAVP, MIDPOINT, MIDPRICE, SAR, SAREXT, SMA, T3, TEMA, TRIMA, WMA
Three Access Methods: MCP, HTTP REST, CLI
Dual Transport: STDIO and HTTP for MCP
Cross-platform: Works on Linux, macOS, Windows
Comprehensive Testing: 26+ unit and integration tests
Error Handling: Detailed error messages and validation
Logging Configuration
The server requires a logging.conf file for configuration. Copy the example:
cp logging.conf.example logging.confCustomize logging levels, format, and output file in logging.conf. The server logs to console.log to maintain MCP protocol compliance.
Client Configuration
Claude Desktop Integration
Create a configuration file at
~/Library/Application Support/Claude/claude_desktop_config.json(macOS) or appropriate location for your OS.Add the MCP server configuration:
{
"mcpServers": {
"talib": {
"command": "uv",
"args": [
"run",
"python",
"-m",
"mcp_talib.cli",
"--mode",
"mcp",
"--transport",
"stdio"
],
"cwd": "/path/to/mcp-talib"
}
}
}Restart Claude Desktop to load the TA-Lib server.
Verify installation by asking Claude: "What technical analysis tools do you have?"
MCP Inspector (HTTP)
For HTTP transport, configure MCP Inspector to connect to:
http://localhost:8000/mcpRun the MCP server with HTTP:
uv run python -m mcp_talib.cli --mode mcp --transport http --port 8000Important: The HTTP transport includes CORS middleware to support browser-based MCP clients like MCP Inspector. If you're behind a reverse proxy or need to restrict access, update the allow_origins setting in transport/http.py.
MCP.js Client Example
import { MCPServerClient } from '@modelcontextprotocol/client';
const client = new MCPServerClient({
name: 'talib',
command: 'uv',
args: ['run', 'python', '-m', 'mcp_talib.cli', '--mode', 'mcp', '--transport', 'stdio'],
cwd: process.cwd()
});
// List available tools
const tools = await client.listTools();
console.log('Available tools:', tools.map(t => t.name));
// Calculate SMA
const smaResult = await client.callTool('calculate_sma', {
close_prices: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
timeperiod: 5
});
console.log('SMA result:', smaResult);HTTP API Client (Python)
import requests
# List available tools
response = requests.get('http://localhost:8001/api/tools')
tools = response.json()['tools']
print('Available tools:', tools)
# Calculate SMA
payload = {
'close': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
'timeperiod': 5
}
response = requests.post('http://localhost:8001/api/tools/sma', json=payload)
result = response.json()
print('SMA result:', result['values'])Available Tools
The server provides MCP tools and HTTP endpoints for all TA-Lib overlap studies:
calculate_sma- Simple Moving Averagecalculate_ema- Exponential Moving Averagecalculate_rsi- Relative Strength Indexcalculate_bbands- Bollinger Bandscalculate_dema- Double Exponential Moving Averagecalculate_ht_trendline- Hilbert Transform Trendlinecalculate_kama- Kaufman Adaptive Moving Averagecalculate_ma- Moving Average (with matype)calculate_mama- MESA Adaptive Moving Averagecalculate_mavp- Moving Average Variable Periodcalculate_midpoint- Midpointcalculate_midprice- Midpoint Pricecalculate_sar- Parabolic SARcalculate_sarext- Parabolic SAR Extendedcalculate_t3- T3 Moving Averagecalculate_tema- Triple Exponential Moving Averagecalculate_trima- Triangular Moving Averagecalculate_wma- Weighted Moving Average
Development
# Run all tests
uv run pytest
# Run specific test file
uv run pytest tests/unit/test_sma.py -v
# Run with coverage
uv run pytest --cov=src/mcp_talib
# Format code
uv run black src/ tests/
uv run isort src/ tests/
# Lint code
uv run ruff check src/ tests/TA-Lib Platform Requirements
This project uses the ta-lib Python bindings which require the native TA-Lib C library. On CI or developer machines, you must install the system TA-Lib library before installing Python dependencies.
Links and notes:
TA-Lib (C library): https://ta-lib.org/ (download and build instructions)
ta-lib-python (Python bindings): https://github.com/TA-Lib/ta-lib-python
Example (Ubuntu) CI steps:
# Install build dependencies
sudo apt-get update && sudo apt-get install -y build-essential wget
# Download and build TA-Lib C library
wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz
tar -xzf ta-lib-0.4.0-src.tar.gz
cd ta-lib
./configure --prefix=/usr
make
sudo make install
# Then install Python package
pip install TA-LibIf you prefer not to build the C library, use pre-built wheels where available or run tests in an environment that provides TA-Lib (e.g., manylinux CI images).
HTTP API & CLI
This project exposes the same MCP tools as both HTTP JSON endpoints and a Typed CLI (Typer).
HTTP Endpoint
POST /api/tools/{tool_name}
Request JSON: { "close": [..], ...params } (e.g., timeperiod)
Response JSON: { "success": true, "values": [...], "metadata": {...} }
Example:
curl -X POST http://localhost:8000/api/tools/sma \
-H 'Content-Type: application/json' \
-d '{"close": [1,2,3,4,5], "timeperiod": 3}'MCP Endpoint
The MCP endpoint remains at /mcp for MCP clients (MCP Inspector, MCP.js, etc.). The HTTP API mounts the MCP app so both APIs coexist.
CLI (Typer)
Access tools from the command line via src/mcp_talib/cli_tools.py:
List available tools:
uv run python -m mcp_talib.cli_tools listCall a tool:
uv run python -m mcp_talib.cli_tools call sma --close '[1,2,3,4,5]' --timeperiod 3Implementation Notes
Requests are validated using Pydantic
The underlying indicator implementations are the single source of truth (registered in the MCP registry)
HTTP API and CLI call the same code so results match exactly
For browser clients, CORS is enabled and
mcp-session-idis exposed in responses
License
MIT
Available Tools
18 toolscalculate_bbandsD
Calculate Bollinger Bands (BBANDS).
Inputs: kwargs (required). Returns: result
calculate_demaC
Calculate Double Exponential Moving Average (DEMA).
Inputs: kwargs (required). Returns: result
calculate_emaC
Calculate Exponential Moving Average (EMA).
Inputs: kwargs (required). Returns: result
calculate_ht_trendlineD
Calculate Hilbert Transform Trendline.
Inputs: kwargs (required). Returns: result
calculate_kamaC
Calculate Kaufman Adaptive Moving Average (KAMA).
Inputs: kwargs (required). Returns: result
calculate_maD
Calculate Moving Average (MA).
Inputs: kwargs (required). Returns: result
calculate_mamaC
Calculate MESA Adaptive Moving Average (MAMA).
Inputs: kwargs (required). Returns: result
calculate_mavpD
Calculate Moving Average Variable Period (MAVP).
Inputs: kwargs (required). Returns: result
calculate_midpointD
Calculate Midpoint (MIDPOINT).
Inputs: kwargs (required). Returns: result
calculate_midpriceD
Calculate Midpoint Price (MIDPRICE).
Inputs: kwargs (required). Returns: result
calculate_rsiC
Calculate Relative Strength Index (RSI).
Inputs: kwargs (required). Returns: result
calculate_sarD
Calculate Parabolic SAR.
Inputs: kwargs (required). Returns: result
calculate_sarextD
Calculate Parabolic SAR Extended (SAREXT).
Inputs: kwargs (required). Returns: result
calculate_smaC
Calculate Simple Moving Average (SMA).
Inputs: kwargs (required). Returns: result
calculate_t3D
Calculate T3 Moving Average.
Inputs: kwargs (required). Returns: result
calculate_temaC
Calculate Triple Exponential Moving Average (TEMA).
Inputs: kwargs (required). Returns: result
calculate_trimaC
Calculate Triangular Moving Average (TRIMA).
Inputs: kwargs (required). Returns: result
calculate_wmaC
Calculate Weighted Moving Average (WMA).
Inputs: kwargs (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 18 tools
Every tool has a clearly distinct purpose, each calculating a specific technical indicator or moving average type with no overlap. The descriptions explicitly name the unique algorithm (e.g., BBANDS, DEMA, RSI), making it impossible to confuse one tool for another.
All tools follow a perfect verb_noun pattern with 'calculate_' as the consistent prefix, followed by the indicator acronym or name in snake_case. There are no deviations in naming style or structure across the entire set.
With 18 tools, the count is slightly high but reasonable for a technical analysis library covering various moving averages and indicators. It aligns well with the domain's scope, though it might feel heavy compared to simpler servers.
The tool set provides comprehensive coverage for calculating technical indicators, including multiple moving average types (e.g., SMA, EMA, WMA) and key indicators like RSI and Bollinger Bands. There are no obvious gaps for a TA-Lib server, as it covers the core functionality expected in this domain.
Maintenance
Related MCP Connectors
> TradingMCP puts a market analyst inside your AI assistant. Paste one URL into Claude, ChatGPT, Cursor, VS Code or any MCP client and ask in plain language: screen for breakouts, run a multi-timeframe analysis, backtest a strategy with walk-forward validation, scan for smart-money and volume signals, or get a one-prompt morning market brief. In clients that support MCP Apps, price charts and the Markets panel are drawn right in the chat. > 40+ tools covering crypto (real-time), stocks, ETFs, FX, futures and commodities across major global exchanges. > Hosted, nothing to install: Pro $9/month (2,500 tool calls) or Pro+ $29/month (10,000). Paid upfront with a 14-day money-back guarantee; your API key arrives right after checkout. > Built on the open-source tradingview-mcp core (MIT, ~5k GitHub stars): self-host it free, or use the hosted version with zero ops. > For research and education, not financial advice. Not affiliated with TradingView
Crypto market signals, technical indicators, and sentiment analysis for AI agents.
Calculate SMA, EMA, RSI, MACD, Bollinger Bands, ATR, stochastic and VWAP over a price series.
Crypto market & research MCP for AI agents: prices, derivatives, options, on-chain, sentiment, news.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceProvides stock market data and computes technical indicators like EMA, MACD, and RSI across multiple timeframes using the LongPort API and TA-Lib. It enables users to perform detailed financial analysis and multi-timeframe market reviews through standard MCP tools.-
- FlicenseNot gradedqualityDmaintenanceExposes TradingView technical indicators and OHLCV data through MCP tools for Claude Desktop or any MCP-aware client.26-
- AlicenseNot gradedqualityDmaintenanceProvides comprehensive stock market data and technical analysis tools via the MCP protocol, enabling real-time quotes, historical data, and professional indicators like RSI and MACD for Claude Desktop and other clients.5Apache 2.0
- AlicenseBqualityDmaintenanceProvides real-time market data, technical analysis, screeners, and backtesting for stocks, crypto, forex, and futures to AI assistants via MCP.371MIT