Skip to main content

MCP server providing Pine Script v6 documentation for AI assistants

Project description

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

Usage with Claude Code

Add to .mcp.json in your project (recommended):

{
  "mcpServers": {
    "pinescript-docs": {
      "type": "stdio",
      "command": "uvx",
      "args": ["pinescript-mcp"]
    }
  }
}

Usage with Claude Desktop

Add to ~/.config/claude/claude_desktop_config.json:

{
  "mcpServers": {
    "pinescript-docs": {
      "command": "uvx",
      "args": ["pinescript-mcp"]
    }
  }
}

Usage with Google Antigravity

Add to ~/.gemini/antigravity/mcp_config.json:

{
  "mcpServers": {
    "pinescript-docs": {
      "command": "uvx",
      "args": ["pinescript-mcp"]
    }
  }
}

Or use the public HTTP server (no install):

{
  "mcpServers": {
    "pinescript-docs": {
      "serverUrl": "https://pinescript-mcp.fly.dev/mcp"
    }
  }
}

Version Pinning

Documentation is bundled in the package - each version contains a frozen snapshot. For reproducible agent behavior, pin to a specific version:

{
  "mcpServers": {
    "pinescript-docs": {
      "command": "uvx",
      "args": ["pinescript-mcp==0.6.8"]
    }
  }
}

Without pinning, uvx pinescript-mcp gets the latest version.

Alternative: pip install

If you prefer pip over uvx:

pip install pinescript-mcp==0.6.8

Note: "command": "pinescript-mcp" only works if the install location is in your PATH. The uvx method above is more reliable as it handles environments automatically.

Public Server (No Install Required)

Connect directly to the hosted server - no Python or uvx needed:

{
  "mcpServers": {
    "pinescript-docs": {
      "type": "http",
      "url": "https://pinescript-mcp.fly.dev/mcp/"
    }
  }
}

Available Tools (10)

Tool Description
get_manifest() Start here for natural language questions — routing guide
resolve_topic(query) Fast lookup for exact API terms (ta.rsi, repainting)
search_docs(query) Grep for exact strings across all docs
list_docs() List all documentation files with descriptions
list_sections(path) List ## headers in a doc file (for navigating large files)
get_doc(path) Read a specific documentation file
get_section(path, header) Read a specific section by header
get_functions(namespace) List valid functions (ta, strategy, etc.)
validate_function(name) Check if a function exists in Pine v6
lint_script(script) Lint Pine Script (17 rules, free, no API cost)

Available Prompts

Prompt Description
debug_error(error, code) Analyze a Pine Script compilation error
convert_v5_to_v6(code) Convert Pine Script v5 code to v6 syntax
explain_function(name) Explain a Pine Script function in detail

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.hull doesn't exist, use ta.hma)
  • Deprecated syntax from v4/v5
  • Incorrect parameter orders
  • Missing required arguments

Lint Rules (17 total)

The lint_script tool checks for common Pine Script issues without using AI:

Rule Type Description
S000 Warning AST parser failed (graceful fallback)
S001 Error Real syntax errors (via pynescript AST parser)
E001 Error input.enum() with const string constants
E003 Error Return type keyword on function declaration
E005 Error study() → use indicator()
E006 Error security() → use request.security()
E007 Error alertcondition() in strategy scripts
E009 Error format.currency doesn't exist
E010 Error Direct na comparison (use na() function)
E012 Error Unknown/hallucinated function
E013 Error input.enum() with options array
E014 Error strategy() missing title parameter
E015 Error Mismatched string quotes
W001 Warning Missing //@version=6
W003 Warning lookahead_on without justification
W004 Warning High max_bars_back value
W005 Warning Potentially unused variable

Performance

The HTTP server (Fly.io) uses response caching with 1-hour TTL for documentation lookups, making repeated queries very fast.

Development

# Clone and install locally
git clone https://gitlab.com/articat1066/pinescript-v6-mcp
cd pinescript-mcp
pip install -e .

# Run the server
pinescript-mcp

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pinescript_mcp-0.6.8.tar.gz (326.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pinescript_mcp-0.6.8-py3-none-any.whl (354.2 kB view details)

Uploaded Python 3

File details

Details for the file pinescript_mcp-0.6.8.tar.gz.

File metadata

  • Download URL: pinescript_mcp-0.6.8.tar.gz
  • Upload date:
  • Size: 326.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for pinescript_mcp-0.6.8.tar.gz
Algorithm Hash digest
SHA256 adf50e17912cef336dbc0d1283a78cc560c477c8c5d5964869e37bf52717b27e
MD5 e3b826ee4ea6bcc7971ab278c45f6177
BLAKE2b-256 b27a7671a6fa905b06ec4ee8eaf3487f6bec152390328db3a91d0fae3b70acfd

See more details on using hashes here.

File details

Details for the file pinescript_mcp-0.6.8-py3-none-any.whl.

File metadata

  • Download URL: pinescript_mcp-0.6.8-py3-none-any.whl
  • Upload date:
  • Size: 354.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for pinescript_mcp-0.6.8-py3-none-any.whl
Algorithm Hash digest
SHA256 ae07cd922728a1cb8c6b54224334b4e57444a4c760d2e664df7550ab3584b731
MD5 feb1dec515a53389166a60643c43c969
BLAKE2b-256 09fd58b8967b46f817d647f50fc71790a45eacb5f81b8ca22882eef77c9783b9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page