PineScript MCP Documentation Server
Provides comprehensive documentation access, style guide adherence, and code review capabilities for PineScript v6 development, including semantic search across functions and variables, and real-time validation with 9 rules.
Click on "Install 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 MCP Documentation Serverreview this PineScript indicator code"
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 Documentation Server
AI-optimized Model Context Protocol (MCP) server for PineScript v6 development, providing comprehensive documentation access, style guide adherence, and code review capabilities specifically designed for AI coding agents.
Performance Metrics: 4,277x faster data access through memory-first architecture with <15ms response times.
Quick Start (2 minutes)
Installation & Verification:
# 1. Install and connect
npm install git+git@github.com:iamrichardD/mcp-server-pinescript.git
claude mcp add pinescript-docs node ./node_modules/mcp-server-pinescript/index.js
# 2. Verify connection
claude mcp list # Should show "pinescript-docs: Connected ✓"
# 3. Test validation (this code has deliberate errors)
claude -p "Use pinescript_review to check: //@version=6
indicator('RSI Test', shorttitle='RSI_INDICATOR_WITH_LONG_TITLE', overlay=false, precision=15)
plot(ta.rsi(close,14))"
# Expected: 2 errors detected in <15ms with actionable fixesVerification Indicators:
Error detection: SHORT_TITLE_TOO_LONG (39 chars > 10 limit)
Error detection: INVALID_PRECISION (15 > max allowed 8)
Performance: Sub-15ms response times
Output: Structured JSON with severity levels and fix suggestions
Related MCP server: TVControl
Core Capabilities
Documentation Search (pinescript_reference):
Semantic search with synonym expansion across 457 functions + 427 variables
Streaming delivery for large result sets via JSON chunks
Enhanced keyword matching for technical terms
Code Review (pinescript_review):
Directory support for entire PineScript projects
Multi-format output (JSON, Markdown, streaming)
Severity filtering (errors, warnings, suggestions)
Real-time streaming for large codebases
9 validation rules with 100% test coverage
Basic Usage Commands
Code Validation:
claude -p "Use pinescript_review to check this code: [your PineScript code]"Documentation Research:
claude -p "Use pinescript_reference to search 'array functions'"Project Review:
claude -p "Use pinescript_review with source_type=directory, directory_path=./src"Performance Verification:
time claude -p "Use pinescript_reference to search 'ta.sma'"
# Target: <15ms total response timeIntegration Setup
Claude Desktop Integration - Add to @claude_desktop_config.json:
{
"mcpServers": {
"pinescript": {
"command": "node",
"args": ["/path/to/mcp-server-pinescript/index.js"]
}
}
}Local Development Mode:
git clone https://github.com/iamrichardD/mcp-server-pinescript.git
cd mcp-server-pinescript && npm install && npm start
# Should show: "PineScript MCP Server ready with preloaded documentation!"Performance & Architecture
Performance Characteristics:
Response Times: 5-15ms for typical queries (70-85% faster than baseline)
Memory Usage: ~12MB RAM with 555KB preloaded documentation
Data Access: 0.0005ms average (4,277x faster than file I/O)
Concurrency: High request throughput without file system contention
Design Patterns:
Memory-first architecture with all documentation preloaded at startup
Zero file I/O eliminates disk bottlenecks during request processing
Streaming optimization for JSON chunk delivery of large datasets
Hash-based lookups provide O(1) performance for documentation access
Development Workflow
Core Commands:
npm start # Start server (TypeScript)
npm run dev # Development mode with watch
npm test # Run all tests (617+ tests, <2ms atomic execution)
npm run quality:check # Quick quality validation
npm run quality:fix # Fix all quality issues
npm run build # Build TypeScript
node comprehensive-test.js # End-to-end integration testIntegration Testing:
# Run comprehensive end-to-end validation
node comprehensive-test.js
# Expected output:
# ✅ Data Foundation: 457 functions + 427 variables loaded
# ✅ Search Performance: <15ms (sub-1ms typical)
# ✅ Validation Rules: SHORT_TITLE_TOO_LONG, INVALID_PRECISION detection
# ✅ Syntax Compatibility: Pine Script v6 validation working
# ✅ Overall Performance: All operations <15ms thresholdVersion Management:
./scripts/set-session-type.sh [patch|minor|major] # Set session type
npm run release:prepare # Prepare release
ln -sf ../../.githooks/* .git/hooks/ # Setup git hooksTroubleshooting
Connection Issues:
"command not found: claude" → Install @Claude Code CLI
"Module not found" → Run
npm installin project directory"Connection refused" → Verify server running and MCP registration path
Performance Issues:
Slow responses (>50ms) → Check for "preloaded documentation" in startup logs
Memory errors on large files → Use
format=streamparameterNo validation errors shown → Verify with known error patterns
Quick Diagnostics:
# Verify preloading performance
claude -p "Show pinescript_reference response time for 'indicator' search"
# Test streaming capability
claude -p "Use pinescript_review with format=stream on large file"
# Check validation rules
claude -p "List available pinescript_review validation rules"Documentation Structure
This project uses multi-audience documentation for optimal usability:
@USER-GUIDE.md - Comprehensive integration guide for developers
@MAINTAINER.md - Contributor and project maintenance documentation
@AGENT.md - Universal agent configuration and architecture patterns
@.project/AI-INTEGRATION.md - AI systems and MCP client integration
For detailed usage examples, advanced configuration, and production deployment patterns, see @USER-GUIDE.md.
Requirements & Quality
System Requirements:
Node.js 18+ required
Memory: ~12MB RAM (minimal requirements)
AI Clients: Claude Desktop, Claude Code CLI, Cursor IDE
API Access: Firecrawl API key (maintainers only for documentation updates)
Quality Metrics:
Test reliability: 100% pass rate (617-658 tests)
Response consistency: <2ms variation in execution
Performance regression: Continuous monitoring prevents degradation
Zero tolerance: All tests must pass before commits
Contributing
MIT License - see LICENSE file for details.
Contributing Process:
Fork the repository
Create a feature branch
Run quality checks:
npm run quality:checkSubmit pull request with passing tests
For issues and feature requests, please use the GitHub issue tracker.
Performance Demonstration: This server demonstrates production-ready Agile Coaching + Atomic Testing + TypeScript Architecture with measured 4,277x performance improvements through memory-first design and streaming optimization.
Available Tools
4 toolsmcp_service_versionA
Get authoritative version information from package.json plus deployment diagnostics including build status, git commit, and bug fix resolution status.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations provided, so the description carries full burden. It lists what the tool returns but does not discuss potential side effects, required permissions, error conditions, or whether it's read-only. For a simple version tool this is adequate but not comprehensive.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Single sentence that efficiently conveys core purpose and additional diagnostics. No unnecessary words.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given zero parameters and no output schema, the description provides a complete picture of what information the tool returns. It covers the main diagnostics expected from a version info tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
No parameters exist, so baseline is 4. The description does not need to add parameter info, and it appropriately focuses on the output.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Specifically describes the resource (authoritative version info from package.json) and additional diagnostic items (build status, git commit, bug fix resolution). Clearly distinguishes from sibling tools which focus on PineScript tasks.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Describes what the tool does but does not explicitly state when to use it versus alternatives or provide any usage constraints. Siblings are unrelated, so lack of exclusion is less critical but still leaves room for improvement.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
pinescript_referenceA
Search PineScript documentation with enhanced semantic matching and streaming support for large result sets.
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search term or topic with synonym expansion (e.g., "array functions", "style guide naming", "syntax rules") | |
| format | No | Output format: json (all results), stream (chunked delivery) | json |
| version | No | PineScript version (default: v6) | v6 |
| max_results | No | Maximum results to return (default: 10, max: 100) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the transparency burden. It mentions enhanced semantic matching and streaming support, which are behavioral traits. It does not disclose explicit safety or side effects, but the search nature implies read-only, and the added detail is valuable.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Single, well-structured sentence that front-loads the core purpose and efficiently adds key differentiators (semantic matching, streaming). No wasted words.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a search tool with 4 parameters (fully described in schema) and no output schema, the description covers the main behavioral aspect (enhanced matching, streaming). However, it does not differentiate from siblings or explain return structure, leaving a slight gap.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so baseline is 3. The description adds minimal extra meaning beyond schema; 'synonym expansion' echoes the query description, and streaming is noted but already in format default. No significant new parameter insight.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states it searches PineScript documentation with added semantic matching and streaming support, distinguishing it from sibling tools like syntax_compatibility_validation or pinescript_review.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No explicit guidance on when to use this tool versus siblings, such as pinescript_review or syntax_compatibility_validation. The description implies it is for documentation lookup but does not provide exclusion criteria or alternatives.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
pinescript_reviewA
Review PineScript code against style guide and language rules. Supports single files, directories, and streaming for large results via JSON chunks.
| Name | Required | Description | Default |
|---|---|---|---|
| code | No | PineScript code to review (required when source_type=code) | |
| format | No | Output format: json (single response), markdown (formatted), stream (chunked JSON for large files/directories) | json |
| version | No | PineScript version (default: v6) | v6 |
| file_path | No | Path to PineScript file to review (required when source_type=file) | |
| recursive | No | For directory source: scan subdirectories recursively (default: true) | |
| chunk_size | No | For stream format: violations per chunk (default: 20, max: 100) | |
| source_type | No | Source type: code (string input), file (single file path), directory (scan for .pine files) | code |
| directory_path | No | Path to directory containing PineScript files (required when source_type=directory) | |
| file_extensions | No | File extensions to scan for (default: [".pine", ".pinescript"]) | |
| severity_filter | No | Filter violations by severity (default: all) | all |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions streaming for large results, indicating non-blocking behavior, but does not disclose potential resource usage, side effects (e.g., file system writes), or whether it is read-only. Adequate but not comprehensive.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence that efficiently conveys the core functionality and key features (single files, directories, streaming) without redundancy. Every phrase adds value.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity (10 parameters, 3 enum types, no output schema), the description is relatively brief. It covers high-level capabilities but lacks details on return values, error handling, or comprehensive usage scenarios. Adequate for basic understanding but leaves gaps for nuanced use.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema already documents all parameters. The description adds little to no new meaning beyond what the schema provides. It rephrases some parameter purposes but doesn't clarify dependencies or provide examples.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly identifies the tool's purpose: reviewing PineScript code against a style guide and language rules. It specifies supported input types (single files, directories) and output formats (streaming, JSON chunks), making the tool's scope unambiguous.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description does not provide explicit guidance on when to use this tool versus siblings (e.g., syntax_compatibility_validation). It lacks 'when to use' or 'when not to use' statements, leaving the agent to infer usage context from the description alone.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
syntax_compatibility_validationA
Validate Pine Script code for v6 syntax compatibility and migration requirements.
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Pine Script source code to validate for syntax compatibility | |
| format | No | Output format for validation results | json |
| migration_guide | No | Include migration guidance for deprecated functions |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries full burden. It discloses the core function of validating syntax and migration, but lacks details on behavioral traits such as side effects, rate limits, or what the output contains (e.g., errors, warnings).
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Single sentence, zero waste, directly conveys the tool's purpose. It is appropriately sized and front-loaded.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no output schema and three well-documented parameters, the description is adequate but incomplete. It does not describe the output format or what validation results look like, which is important for a validation tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so baseline is 3. The description adds limited meaning beyond the schema; it restates the purpose of the code parameter and mentions migration_guide, but does not significantly enhance understanding.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool validates Pine Script code for v6 syntax compatibility and migration requirements, using a specific verb and resource that distinguishes it from sibling tools like pinescript_review or pinescript_reference.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies the tool should be used when checking v6 syntax compatibility, but does not explicitly state when to use it versus alternatives, nor provide any when-not or exclusion criteria.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
TDQS
Each tool has a clearly distinct purpose: service version info, documentation search, code review, and syntax validation. No overlap or ambiguity.
Naming is inconsistent: three tools use 'pinescript_' prefix but one uses 'mcp_service_version', and 'syntax_compatibility_validation' does not follow a verb_noun pattern. Mixed conventions make it harder to predict tool names.
With 4 tools covering distinct aspects of PineScript documentation and validation, the tool count is well-scoped for the server's purpose, not too few or too many.
The set covers reference search, code review, and syntax compatibility, which are core needs. A minor gap is missing a tool for listing specific language features or version history, but overall functional completeness is good.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Official DevSpeak MCP server — translate technical text into formal specs from any AI IDE or agent
MCP server for Gainium — manage trading bots, deals, and balances via AI assistants
Research-only MCP server: turn your AI into a quant research desk — backtests, no trades.
MCP server for AI agent profiles and smart notes. 60+ coding prompt packs with expert personas.
Related MCP Servers
- AlicenseAqualityAmaintenanceProvides comprehensive Pine Script v6 documentation and tools to help AI assistants look up functions, validate syntax, and generate accurate code. It enables linting, version conversion from v5 to v6, and deep conceptual analysis to prevent code hallucinations.109MIT
- AlicenseBqualityBmaintenanceMCP server that lets AI agents directly control and interact with the TradingView desktop app via 88 chart-control tools, enabling automated chart reading, Pine Script compilation, strategy optimization, and replay control.10577138MIT
- FlicenseNot gradedqualityBmaintenanceA comprehensive MCP server that integrates TradingView Desktop automation, screener API, Yahoo Finance, IDX/BEI tools, backtesting, news sentiment, trade math, and market sessions. It enables traders to perform technical analysis, backtest strategies, manage positions, and automate TradingView tasks through natural language.
- FlicenseNot gradedqualityCmaintenanceAn MCP server that extends TradingView with AI-driven morning briefs, trading rule automation, and 81 tools for chart control, Pine Script development, replay practice, and multi-pane layouts.552
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/iamrichardD/mcp-server-pinescript'
If you have feedback or need assistance with the MCP directory API, please join our Discord server