Cover image
Try Now
2025-03-22

3 years

Works with Finder

1

Github Watches

1

Github Forks

6

Github Stars

TradingView PineScript MCP Server

A Model Context Protocol (MCP) server for working with TradingView PineScript. This server provides tools for validating, fixing, and generating PineScript code through a standardized API.

Features

  • PineScript Validation - Automatically validates PineScript code for syntax errors and warnings
  • Error Fixing - Automatically fixes common PineScript syntax errors
  • Template Generation - Provides validated templates for various PineScript strategies and indicators

Getting Started

Prerequisites

  • Node.js 16.x or higher
  • npm 8.x or higher

Installation

  1. Clone the repository
git clone https://github.com/yourusername/pinescriptproject1.git
cd pinescriptproject1
  1. Install dependencies
npm install
  1. Build the project
npm run build

Running the Server

Start the MCP server:

npm run start-server

This will start the server with stdio transport, which allows it to communicate with MCP clients.

API

Tools

The MCP server exposes the following tools:

1. validate_pinescript

Validates PineScript code for syntax errors and warnings.

Parameters:

  • script (string): The PineScript code to validate
  • version (string, optional): Expected PineScript version (e.g., 'v5', 'v4')

Returns:

  • valid (boolean): Whether the script is valid
  • errors (string[]): List of syntax errors
  • warnings (string[]): List of warnings

2. fix_pinescript_errors

Automatically fixes common syntax errors in PineScript code.

Parameters:

  • script (string): The PineScript code to fix

Returns:

  • fixed (boolean): Whether any fixes were applied
  • fixedCode (string): The fixed script
  • changes (string[]): List of changes made

3. get_pinescript_template

Provides validated templates for common PineScript strategies and indicators.

Parameters:

  • template_type (string): Type of template ('strategy' or 'indicator')
  • name (string): Template name

Returns:

  • template (string): The template code
  • message (string): Confirmation message

Supported PineScript Features

Syntax Validation

The validator currently checks for:

  • Empty scripts
  • Version annotations
  • Balanced parentheses
  • String quotes
  • Comma placement in function calls
  • Deprecated functions in PineScript v5
  • Incorrect variable export syntax

Error Fixing

The fixer can automatically fix:

  • Missing version annotations
  • Unbalanced parentheses
  • Unclosed string literals
  • Missing commas in function calls
  • Deprecated study() function
  • Incorrect variable export syntax

Development

Running Tests

npm test

Debugging

To run the server in development mode with automatic reloading:

npm run dev

License

ISC

Contributing

Contributions are welcome!

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Callycode Limited
  • A geek-themed horoscope generator blending Bitcoin prices, tech jargon, and astrological whimsy.

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Beniyam Berhanu
  • Therapist adept at identifying core issues and offering practical advice with images.

  • INFOLAB OPERATIONS 2
  • A medical specialist offering assistance grounded in clinical guidelines. Disclaimer: This is intended for research and is NOT safe for clinical use!

  • Shea galley
  • A GPT designed to provide everyday financial advice and tools to Canadians, primarily inspired by the subreddit Personal Finance Canada.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • huahuayu
  • 统一的API网关,用于将多个Etherscan样区块链Explorer API与对AI助手的模型上下文协议(MCP)支持。

  • deemkeen
  • 用电源组合控制您的MBOT2:MQTT+MCP+LLM

  • jae-jae
  • MCP服务器使用剧作《无头浏览器》获取网页内容。

  • HiveNexus
  • 一个适用于中小型团队的AI聊天机器人,支持DeepSeek,Open AI,Claude和Gemini等车型。 专为中小团队设计的ai聊天应用,支持deepSeek,打开ai,claude,双子座等模型。

  • zhaoyunxing92
  • MCP(消息连接器协议)服务

    Reviews

    2 (1)
    Avatar
    user_p9y80qjv
    2025-04-16

    As a dedicated user of the pinescript-mcp-server, I can confidently say that this tool is indispensable for anyone working with Pine Script. Created by CyberBOB07, it offers seamless integration and robust features that significantly streamline backend processes. The ease of use and efficiency it brings to my programming tasks is unparalleled. Highly recommend checking it out on GitHub!