PineScript
A Model Context Protocol (MCP) server for working with TradingView PineScript
What is PineScript?
PineScript is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to model context protocol (mcp) server for working with tradingview pinescript
A Model Context Protocol (MCP) server for working with TradingView PineScript
This server falls under the Finance & Fintech category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- A Model Context Protocol (MCP) server for working with Tradi
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx pinescriptConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use PineScript
The PineScript MCP server brings TradingView PineScript development directly into AI-assisted workflows, letting you create, edit, backtest, and optimize trading indicators and strategies through natural language conversation with Claude or other MCP-compatible assistants. Instead of switching between editors and documentation tabs, you can describe a trading idea in plain English and receive working PineScript v5 code ready to paste into TradingView. The server also includes a web UI for strategy management and supports market data access for realistic backtesting.
Prerequisites
- Node.js 18 or later installed on your system
- npm 8 or later available in your terminal
- A TradingView account to test generated PineScript indicators and strategies
- Claude Desktop or another MCP-compatible AI client
- Git to clone the repository for local development mode
Clone the PineScript MCP server repository
Clone the repository to your local machine so you have access to the full source, configuration examples, and the web UI.
git clone https://github.com/cklose2000/pinescript-mcp-server.git
cd pinescript-mcp-serverInstall dependencies and build the server
Install all npm dependencies and compile the TypeScript source. The build step is required before the server can be launched or connected to Claude Desktop.
npm install
npm run buildCopy and configure environment variables
Copy the provided example env file and fill in any required values, such as market data API credentials if you want live data access.
cp .env.example .env
# Edit .env with your preferred text editorAdd the server to your MCP client configuration
Open your Claude Desktop config file and add the PineScript server. Use the absolute path to the built index.js in the dist/ directory.
{
"mcpServers": {
"pinescript": {
"command": "node",
"args": ["/absolute/path/to/pinescript-mcp-server/dist/index.js"]
}
}
}Restart Claude Desktop and verify the connection
Fully quit and reopen Claude Desktop. Ask Claude to generate a simple moving average crossover strategy in PineScript to confirm the server tools are available.
(Optional) Launch the web UI for strategy management
Run the included Next.js web interface to visually browse, edit, and manage your saved PineScript strategies at http://localhost:3001.
npm run uiPineScript Examples
Client configuration
Add this to your claude_desktop_config.json. Replace the path with the actual absolute path to the built server on your machine.
{
"mcpServers": {
"pinescript": {
"command": "node",
"args": ["/Users/yourname/pinescript-mcp-server/dist/index.js"]
}
}
}Prompts to try
These prompts show how to leverage the PineScript MCP server for algorithmic trading development.
- "Write a PineScript v5 indicator that plots a 20-period EMA and 50-period EMA with a crossover alert."
- "Create a RSI divergence strategy in PineScript that goes long when RSI makes higher lows while price makes lower lows."
- "Convert this PineScript v4 script to v5 and fix any deprecated functions."
- "Add a trailing stop loss to my existing strategy and include position sizing based on ATR."
- "Backtest a Bollinger Band mean-reversion strategy on daily data and show the key performance metrics."
- "Generate a multi-timeframe momentum strategy that checks the weekly trend before taking daily entries."Troubleshooting PineScript
The server fails to start with 'Cannot find module' errors
Ensure you ran 'npm run build' after 'npm install'. The dist/ directory must exist and contain the compiled JavaScript. Double-check the path in your MCP config points to dist/index.js, not the TypeScript source.
Generated PineScript code has compilation errors in TradingView
Specify the PineScript version explicitly in your prompt, e.g. 'Write a PineScript v5 indicator...'. PineScript v4 and v5 have significant syntax differences, and v5 is the current TradingView standard.
Port conflict when starting the web UI
If port 3001 is already in use, run 'npm run ui:clean' which includes automatic port cleanup, or set the PORT environment variable to an available port before running 'npm run ui'.
Frequently Asked Questions about PineScript
What is PineScript?
PineScript is a Model Context Protocol (MCP) server that model context protocol (mcp) server for working with tradingview pinescript It connects AI assistants to external tools and data sources through a standardized interface.
How do I install PineScript?
Follow the installation instructions on the PineScript GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with PineScript?
PineScript works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is PineScript free to use?
Yes, PineScript is open source and available under the MIT license. You can use it freely in both personal and commercial projects.
PineScript Alternatives — Similar Finance & Fintech Servers
Looking for alternatives to PineScript? Here are other popular finance & fintech servers you can use with Claude, Cursor, and VS Code.
ValueCell
★ 10.7kValueCell is a community-driven, multi-agent platform for financial applications.
Vibe Trading
★ 8.1k'Vibe-Trading: Your Personal Trading Agent'
Quantdinger
★ 6.2kAI quantitative trading platform for crypto, stocks, and forex with backtesting, live trading, market data, and multi-agent research.vibe-trading ,trading-agents,ai-trader,ai-trading
TradingView
★ 2.8kReal-time crypto & stock screening, advanced technical indicators, Bollinger Bands intelligence, candlestick patterns + native Claude Desktop integration. Multi-exchange (Binance, KuCoin, Bybit+). Open-source AI trading infrastructure.
Financial Datasets
★ 2.1kProvides access to comprehensive financial data including income statements, balance sheets, cash flow statements, stock prices, company news, SEC filings, and cryptocurrency information with built-in financial ratio analysis.
Stripe
★ 1.6kThe Stripe Model Context Protocol server allows you to integrate with Stripe APIs through function calling. This protocol supports various tools to interact with different Stripe services.
Browse More Finance & Fintech MCP Servers
Explore all finance & fintech servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up PineScript in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use PineScript?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.