Metadata-Version: 2.4
Name: pinescript-mcp
Version: 0.1.1
Summary: MCP server providing Pine Script v6 documentation for AI assistants
Project-URL: Homepage, https://github.com/bch/pinescript-mcp
Project-URL: Documentation, https://github.com/bch/pinescript-mcp#readme
Project-URL: Repository, https://github.com/bch/pinescript-mcp
Author: bch
License-Expression: MIT
License-File: LICENSE
Keywords: ai,claude,documentation,mcp,pine-script,tradingview
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Documentation
Requires-Python: >=3.10
Requires-Dist: mcp>=1.26.0
Requires-Dist: twine>=6.2.0
Description-Content-Type: text/markdown

# 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):

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

## Usage with Claude Desktop

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

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

## Alternative: pip install

```bash
pip install pinescript-mcp
```

Then use `"command": "pinescript-mcp"` directly in the config.

## Available Tools

| Tool | Description |
|------|-------------|
| `list_docs()` | List all documentation files with descriptions |
| `get_doc(path)` | Read a specific documentation file |
| `search_docs(query)` | Full-text search across all docs |
| `get_functions(namespace)` | List valid functions (ta, strategy, etc.) |
| `validate_function(name)` | Check if a function exists in Pine v6 |
| `resolve_topic(query)` | Map a question to relevant docs |
| `get_manifest()` | Get routing guidance for topics |

## 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

## Development

```bash
# Clone and install locally
git clone https://github.com/bch/pinescript-mcp
cd pinescript-mcp
pip install -e .

# Run the server
pinescript-mcp
```

## License

MIT
