PineScript Docs
This server gives AI assistants grounded access to bundled Pine Script v6 documentation so they can look up, search, validate, and explain Pine Script concepts and functions.
Discover docs — list all documentation files, list
##sections within large files, and browse functions by namespace (list_docs,list_sections,get_functions).Read documentation — fetch an entire doc file (with pagination via
limit/offset) or a single named section including nested subsections (get_doc,get_section).Search — keyword grep across all docs (
search_docs), exact API/concept term lookup (resolve_topic), and semantic/natural-language ranking (semantic_search_pine_docs).Validate code — confirm a function exists in Pine v6 with suggestions/replacements for invalid names, e.g.
ta.adx→ta.dmi(validate_function).Debug — diagnose compilation/runtime errors using semantic doc matches plus a bundled common-errors reference (
explain_pine_error).Prompt templates — list and render prompts like error debugging and v5→v6 conversion (
list_prompts,get_prompt).Prevent hallucination — grounds the model in real v6 docs to avoid made-up functions, deprecated syntax, and wrong parameter orders.
Provides comprehensive access to Pine Script v6 documentation, technical analysis functions, and syntax validation tools, enabling AI agents to accurately generate, debug, and convert TradingView scripts.
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., "@PineScript Docs convert this v5 script to v6 syntax"
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.
pinescript-mcp
Maintained by BOUCH — private hosting, custom tools and setup: paul@bouch.dev · bouch.dev/products/pinescript-mcp
MCP server providing Pine Script v6 documentation for AI assistants (Claude, etc.).
Enables AI to:
Look up Pine Script functions and validate syntax
Access official documentation for indicators, strategies, and visuals
Understand Pine Script concepts (execution model, repainting, etc.)
Generate correct v6 code with proper function references
Quick Start (stdio)
Works with Claude Code, Claude Desktop, Gemini CLI, and any MCP client that supports stdio:
{
"mcpServers": {
"pinescript-docs": {
"type": "stdio",
"command": "uvx",
"args": ["pinescript-mcp"]
}
}
}Related MCP server: Pine Script MCP Server
Public Server (No Install Required)
No Python or uvx needed — connect directly to the hosted server.
Streamable HTTP — Claude Code, mcpServers with type field):
{
"mcpServers": {
"pinescript-docs": {
"type": "http",
"url": "https://pinescript-mcp.fly.dev/mcp"
}
}
}Windsurf — uses its own shape (see Windsurf docs). Edit ~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"pinescript-docs": {
"serverUrl": "https://pinescript-mcp.fly.dev/mcp"
}
}
}ChatGPT — no config file. In ChatGPT, go to Settings → Connectors → Create and paste https://pinescript-mcp.fly.dev/mcp into the Server URL field. Developer Mode must be enabled (see OpenAI Developer Mode guide).
Claude.ai — add via the web UI's MCP connector settings, not a JSON file.
Version Pinning
Documentation is bundled in the package — each version contains a frozen snapshot. For reproducible agent behaviour, pin to a specific version:
{
"mcpServers": {
"pinescript-docs": {
"command": "uvx",
"args": ["pinescript-mcp==0.7.7"]
}
}
}Without pinning, uvx pinescript-mcp gets the latest version.
Available Tools
Tool | Description |
| Fast lookup for exact API terms ( |
| Grep for exact strings across all docs |
| List all documentation files with descriptions |
| List |
| Read a specific documentation file |
| Read a specific section by header |
| List valid functions (ta, strategy, etc.) |
| Check if a function exists in Pine v6 |
| Browse available documentation resources |
| Read a doc resource by URI (e.g. |
| List available prompt templates |
| Render a prompt template with arguments |
Available Prompts
Prompt | Description |
| Analyze a Pine Script compilation error |
| Convert Pine Script v5 code to v6 syntax |
| Explain a Pine Script function in detail |
Available Resources
URI | Description |
| Start here — routing guide for Pine Script questions |
| Complete Pine Script v6 function list (JSON) |
| Any doc file by path (e.g. |
Example Queries
"How do I create a trailing stop in Pine Script?"
"What's the difference between var and varip?"
"Is ta.supertrend a valid function?"
"How do I avoid repainting with request.security?"
Documentation Coverage
The server bundles comprehensive Pine Script v6 documentation:
Concepts: Execution model, timeframes, colors, methods, objects, common errors
Reference: Types, variables, constants, keywords, operators, annotations
Functions: Technical analysis (ta.*), strategies, requests, drawings, collections
Visuals: Plots, fills, shapes, tables, lines, boxes, backgrounds
Writing Scripts: Style guide, debugging, optimization, limitations
Why Use This?
AI models often hallucinate Pine Script functions or use deprecated v5 syntax. This MCP server grounds the AI in actual v6 documentation, preventing:
Made-up function names (e.g.,
ta.hulldoesn't exist, useta.hma)Deprecated syntax from v4/v5
Incorrect parameter orders
Missing required arguments
Skills
Combine with skills for even more control available at bouch.dev/products/pine-strategy-builder.
Development
# Clone and install locally
git clone https://github.com/paulieb89/pinescript-mcp
cd pinescript-mcp
pip install -e .
# Run the server
pinescript-mcpLicense
MIT
Available Tools
12 toolsexplain_pine_errorARead-only
USE WHEN diagnosing a Pine Script compilation or runtime error. Returns semantically relevant documentation chunks alongside the bundled common-errors reference. If the error mentions an unknown function name, also call validate_function() after this tool. AFTER calling this tool, call validate_function(fn_name) if the error mentions an unrecognised function; call get_section() on any suggested doc paths to read full context. Data sourced from ai-ready-data semantic index and bundled concepts/common_errors.md.
Inputs: error_text (required), code. Returns: result
get_docARead-onlyIdempotent
USE WHEN reading the full content of a Pine Script v6 documentation file. Returns the file content; when limit is set, a header shows the char range and offset to continue reading. AFTER calling this tool, use offset= to continue if the header indicates more content is available. For large files (ta.md, strategy.md, collections.md, drawing.md, general.md), prefer list_sections() + get_section() instead. Data sourced from bundled Pine Script v6 documentation.
Inputs: path (required), limit, offset.
get_functionsARead-onlyIdempotent
USE WHEN browsing valid Pine Script v6 functions, optionally filtered to a namespace. Returns function names grouped by namespace (e.g. ta., strategy.) or filtered to the requested namespace. AFTER calling this tool, call validate_function(fn_name) to check a specific name, or get_section() to read its documentation. Data sourced from bundled pine_v6_functions.json.
Inputs: namespace.
get_promptA
Get a prompt by name with optional arguments.
Returns the rendered prompt as JSON with a messages array. Arguments should be provided as a dict mapping argument names to values.
Inputs: name (required), arguments. Returns: result
get_sectionARead-onlyIdempotent
USE WHEN reading a specific named section from a Pine Script v6 documentation file. Returns the section content from the matched header to the next same-level header, with file path and line range. AFTER calling this tool, call list_sections(path) if the header was not found, or get_section() again with a child header for a narrower subsection. Data sourced from bundled Pine Script v6 documentation.
Inputs: path (required), header (required), include_children.
list_docsARead-onlyIdempotent
USE WHEN discovering what Pine Script v6 documentation is available. Returns a categorised list of doc file paths with one-line descriptions. AFTER calling this tool, call get_doc(path) for small files or list_sections(path) then get_section(path, header) for large files (ta.md, strategy.md, collections.md, drawing.md, general.md). Data sourced from bundled Pine Script v6 documentation.
Inputs: no named parameters.
list_promptsA
List all available prompts.
Returns JSON with prompt metadata including name, description, and optional arguments.
Inputs: no named parameters. Returns: result
list_sectionsARead-onlyIdempotent
USE WHEN navigating a large documentation file before reading a specific section. Returns a newline-separated list of # and ## headers (### excluded) in the file. AFTER calling this tool, call get_section(path, header) with a header from this list. Data sourced from bundled Pine Script v6 documentation.
Inputs: path (required).
resolve_topicARead-onlyIdempotent
USE WHEN looking up an exact Pine Script API term or known concept keyword. Returns the best-matching doc paths with matched keywords and a retrieval suggestion (get_doc or list_sections + get_section). AFTER calling this tool, follow the suggestion: call get_doc() for small files or list_sections() + get_section() for large files. For natural language questions use search_docs() instead. Data sourced from bundled TOPIC_MAP and doc file content scan.
Inputs: query (required). Returns: result
search_docsARead-onlyIdempotent
USE WHEN finding documentation sections that match specific terms across all Pine Script v6 docs. Returns up to max_results sections ranked by match count, each with a preview and a get_section() call hint. AFTER calling this tool, call get_section(file, header) for each result you want to read in full. Data sourced from bundled Pine Script v6 documentation.
Inputs: query (required), max_results.
semantic_search_pine_docsARead-only
USE WHEN answering conceptual, fuzzy, or natural language questions about Pine Script v6. Returns ranked documentation chunks with score, source path, and section header. Each result includes a get_section() call hint for retrieving the full content. AFTER calling this tool, call get_section(path, header) on the top results for complete context. For exact API term lookups use resolve_topic() instead; for keyword grep use search_docs() instead. Data sourced from the ai-ready-data pinescript-v06 semantic index.
Inputs: query (required), top_k. Returns: result
validate_functionARead-onlyIdempotent
USE WHEN confirming a Pine Script v6 function name is valid before using it in code. Returns a valid/invalid verdict with namespace suggestions or known replacement hints (e.g. ta.adx → ta.dmi, security → request.security). AFTER calling this tool, call get_functions(namespace) to list all valid functions in the relevant namespace if the function is invalid. Data sourced from bundled pine_v6_functions.json.
Inputs: fn_name (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 12 tools
The docs-navigation tools (list_docs, list_sections, get_doc, get_section) are clearly layered and distinct, and the three retrieval tools cross-reference each other with explicit 'use X instead for Y' guidance. The pairing of search_docs, resolve_topic, and semantic_search_pine_docs still overlaps enough that an agent must read descriptions carefully to choose, and get_prompt/list_prompts are unrelated to the doc domain.
Nearly all tools follow a snake_case verb_noun pattern (list_docs, get_section, validate_function, resolve_topic). semantic_search_pine_docs and explain_pine_error deviate slightly by embedding extra qualifiers/nouns, but the overall convention is readable and predictable.
12 tools is a reasonable scope for a docs server supporting discovery, reading, search, and function validation. It is slightly heavy given three overlapping search paths and two prompt tools that feel bolted on, but each tool has a defensible role.
The surface covers the full docs lifecycle: discovery, navigation, reading, keyword/semantic/topic search, API name validation, and error diagnosis with cross-tool handoffs. Minor gaps are the out-of-place prompt tools (no obvious relationship to Pine Script docs) and no dedicated 'list namespaces' shortcut, but agents can work around these.
Maintenance
Related MCP Connectors
Static analysis for Pine Script v6 strategies — catches backtest-vs-live divergence traps.
AI-powered Pine Script v6 strategy generator built for prop-firm futures traders.
Evidence-gated quant research for TradingView Pine Script strategies, run from your AI client.
Claspine docs, API reference and code checks for AI agents: guides, recipes, errors, upgrades.
Related MCP Servers
- AlicenseNot gradedqualityFmaintenanceProvides accurate Pine Script v6 coding assistance through search, completion, and reference lookup tools using a comprehensive Japanese manual database. Enables developers to quickly find functions, constants, annotations, and API specifications for TradingView Pine Script development.1ISC
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to look up any Pine Script function, search TradingView documentation, and find code examples in real time.162 npm42MIT
- AlicenseNot gradedqualityDmaintenanceEnables validation, fixing, and generation of PineScript code for TradingView, providing tools for syntax checking, error correction, and template generation.47ISC
- AlicenseAqualityDmaintenanceAI-optimized MCP server for PineScript v6 development, providing comprehensive documentation access, style guide adherence, and code review capabilities.428MIT