API Reference¶
This section provides detailed API documentation for HoloViz MCP.
Core Modules¶
holoviz_mcp
¶
Accessible imports for the holoviz_mcp package.
mcp = FastMCP(name='holoviz', instructions="\n [his MCP server provides comprehensive tools, resources and prompts for working with the HoloViz ecosystem following best practices.\n\n HoloViz provides a set of core Python packages that make visualization easier, more accurate, and more powerful:\n\n - [Panel](https://panel.holoviz.org): for making apps and dashboards for your plots from any supported plotting library.\n - [hvPlot](https://hvplot.holoviz.org): to quickly generate interactive plots from your data.\n - [HoloViews](https://holoviews.org): to help you make all of your data instantly visualizable.\n - [GeoViews](https://geoviews.org): to extend HoloViews for geographic data.\n - [Datashader](https://datashader.org): for rendering even the largest datasets.\n - [Lumen](https://lumen.holoviz.org): to build data-driven dashboards from a simple YAML specification that's well suited to modern AI tools like LLMs.\n - [Param](https://param.holoviz.org): to create declarative user-configurable objects.\n - [Colorcet](https://colorcet.holoviz.org): for perceptually uniform colormaps.\n\n The server is composed of multiple sub-servers that provide various functionalities:\n\n - Documentation: Search and access HoloViz documentation and reference guides\n - Panel: Tools, resources and prompts for using Panel and Panel Extension packages\n - hvPlot: Tools, resources and prompts for using hvPlot to develop quick, interactive plots in Python\n ")
module-attribute
¶
Server¶
HoloViz MCP Server.
This MCP server provides comprehensive tools, resources and prompts for working with the HoloViz ecosystem, including Panel and hvPlot following best practices.
The server is composed of multiple sub-servers that provide various functionalities:
- Documentation: Search and access HoloViz documentation as context
- hvPlot: Tools, resources and prompts for using hvPlot to develop quick, interactive plots in Python
- Panel: Tools, resources and prompts for using Panel Material UI
logger = logging.getLogger(__name__)
module-attribute
¶
mcp = FastMCP(name='holoviz', instructions="\n [his MCP server provides comprehensive tools, resources and prompts for working with the HoloViz ecosystem following best practices.\n\n HoloViz provides a set of core Python packages that make visualization easier, more accurate, and more powerful:\n\n - [Panel](https://panel.holoviz.org): for making apps and dashboards for your plots from any supported plotting library.\n - [hvPlot](https://hvplot.holoviz.org): to quickly generate interactive plots from your data.\n - [HoloViews](https://holoviews.org): to help you make all of your data instantly visualizable.\n - [GeoViews](https://geoviews.org): to extend HoloViews for geographic data.\n - [Datashader](https://datashader.org): for rendering even the largest datasets.\n - [Lumen](https://lumen.holoviz.org): to build data-driven dashboards from a simple YAML specification that's well suited to modern AI tools like LLMs.\n - [Param](https://param.holoviz.org): to create declarative user-configurable objects.\n - [Colorcet](https://colorcet.holoviz.org): for perceptually uniform colormaps.\n\n The server is composed of multiple sub-servers that provide various functionalities:\n\n - Documentation: Search and access HoloViz documentation and reference guides\n - Panel: Tools, resources and prompts for using Panel and Panel Extension packages\n - hvPlot: Tools, resources and prompts for using hvPlot to develop quick, interactive plots in Python\n ")
module-attribute
¶
main()
¶
Set up and run the composed MCP server.
Source code in src/holoviz_mcp/server.py
setup_composed_server()
async
¶
Set up the composed server by importing all sub-servers with prefixes.
This uses static composition (import_server), which copies components from sub-servers into the main server with appropriate prefixes.
Source code in src/holoviz_mcp/server.py
Panel MCP¶
Panel MCP Server Package.
This package provides Model Context Protocol (MCP) tools for working with Panel, the Python library for creating interactive web applications and dashboards.
The package includes: - Component discovery and introspection tools - Parameter information extraction - URL proxying utilities for remote environments - Data models for component metadata
Main modules: - server: MCP server implementation with Panel-specific tools - data: Component metadata collection and utilities - models: Pydantic models for component information
Server¶
Panel MCP Server.
This MCP server provides tools, resources and prompts for using Panel to develop quick, interactive applications, tools and dashboards in Python using best practices.
Use this server to access:
- Panel Best Practices: Learn how to use Panel effectively.
- Panel Components: Get information about specific Panel components like widgets (input), panes (output) and layouts.
COMPONENTS = []
module-attribute
¶
mcp = FastMCP(name='panel', instructions='\n [Panel](https://panel.holoviz.org/) MCP Server.\n\n This MCP server provides tools, resources and prompts for using Panel to develop quick, interactive\n applications, tools and dashboards in Python using best practices.\n\n DO use this server to search for specific Panel components and access detailed information including docstrings and parameter information.\n ')
module-attribute
¶
get_component(ctx, name=None, module_path=None, package=None)
async
¶
Get complete details about a single Panel component including docstring and parameters.
Use this tool when you need full information about a specific Panel component, including its docstring, parameter specifications, and initialization signature. This is the most comprehensive tool for component information.
IMPORTANT: This tool returns exactly one component. If your criteria match multiple components, you'll get an error asking you to be more specific.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ctx
|
Context
|
FastMCP context (automatically provided by the MCP framework). |
required |
name
|
str
|
Component name to match (case-insensitive). If None, must specify other criteria. Examples: "Button", "TextInput", "Slider" |
None
|
module_path
|
str
|
Full module path to match. If None, uses name and package to find component. Examples: "panel.widgets.Button", "panel_material_ui.Button" |
None
|
package
|
str
|
Package name to filter by. If None, searches all packages. Examples: "panel" or "panel_material_ui" |
None
|
Returns:
| Type | Description |
|---|---|
ComponentDetails
|
Complete component information including docstring, parameters, and initialization signature. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no components match the criteria or if multiple components match (be more specific). |
Examples:
Get Panel's Button component:
>>> get_component(name="Button", package="panel")
ComponentDetails(name="Button", package="panel", docstring="A clickable button...", parameters={...})
Get Material UI Button component:
>>> get_component(name="Button", package="panel_material_ui")
ComponentDetails(name="Button", package="panel_material_ui", ...)
Get component by exact module path:
>>> get_component(module_path="panel.widgets.button.Button")
ComponentDetails(name="Button", module_path="panel.widgets.button.Button", ...)
Source code in src/holoviz_mcp/panel_mcp/server.py
get_component_parameters(ctx, name=None, module_path=None, package=None)
async
¶
Get detailed parameter information for a single Panel component.
Use this tool when you need to understand the parameters of a specific Panel component, including their types, default values, documentation, and constraints. This is useful for understanding how to properly initialize and configure a component.
IMPORTANT: This tool returns parameters for exactly one component. If your criteria match multiple components, you'll get an error asking you to be more specific.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ctx
|
Context
|
FastMCP context (automatically provided by the MCP framework). |
required |
name
|
str
|
Component name to match (case-insensitive). If None, must specify other criteria. Examples: "Button", "TextInput", "Slider" |
None
|
module_path
|
str
|
Full module path to match. If None, uses name and package to find component. Examples: "panel.widgets.Button", "panel_material_ui.Button" |
None
|
package
|
str
|
Package name to filter by. If None, searches all packages. Examples: "hvplot", "panel" or "panel_material_ui" |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, ParameterInfo]
|
Dictionary mapping parameter names to their detailed information, including: - type: Parameter type (e.g., 'String', 'Number', 'Boolean') - default: Default value - doc: Parameter documentation - bounds: Value constraints for numeric parameters - objects: Available options for selector parameters |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no components match the criteria or if multiple components match (be more specific). |
Examples:
Get Button parameters:
>>> get_component_parameters(name="Button", package="panel")
{"name": ParameterInfo(type="String", default="Button", doc="The text displayed on the button"), ...}
Get TextInput parameters:
>>> get_component_parameters(name="TextInput", package="panel")
{"value": ParameterInfo(type="String", default="", doc="The current text value"), ...}
Get parameters by exact module path:
>>> get_component_parameters(module_path="panel.widgets.Slider")
{"start": ParameterInfo(type="Number", default=0, bounds=(0, 100)), ...}
Source code in src/holoviz_mcp/panel_mcp/server.py
list_components(ctx, name=None, module_path=None, package=None)
async
¶
Get a summary list of Panel components without detailed docstring and parameter information.
Use this tool to get an overview of available Panel components when you want to browse or discover components without needing full parameter details. This is faster than get_component and provides just the essential information.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ctx
|
Context
|
FastMCP context (automatically provided by the MCP framework). |
required |
name
|
str
|
Component name to filter by (case-insensitive). If None, returns all components. Examples: "Button", "TextInput", "Slider" |
None
|
module_path
|
str
|
Module path prefix to filter by. If None, returns all components. Examples: "panel.widgets" to get all widgets, "panel.pane" to get all panes |
None
|
package
|
str
|
Package name to filter by. If None, returns all components. Examples: "hvplot", "panel" or "panel_material_ui" |
None
|
Returns:
| Type | Description |
|---|---|
list[ComponentSummary]
|
List of component summaries containing name, package, description, and module path. No parameter details are included for faster responses. |
Examples:
Get all available components:
>>> list_components()
[ComponentSummary(name="Button", package="panel", description="A clickable button widget", ...)]
Get all Material UI components:
>>> list_components(package="panel_material_ui")
[ComponentSummary(name="Button", package="panel_material_ui", ...)]
Get all Button components from all packages:
>>> list_components(name="Button")
[ComponentSummary(name="Button", package="panel", ...), ComponentSummary(name="Button", package="panel_material_ui", ...)]
Source code in src/holoviz_mcp/panel_mcp/server.py
list_packages(ctx)
async
¶
List all installed packages that provide Panel UI components.
Use this tool to discover what Panel-related packages are available in your environment. This helps you understand which packages you can use in the 'package' parameter of other tools.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ctx
|
Context
|
FastMCP context (automatically provided by the MCP framework). |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
List of package names that provide Panel components, sorted alphabetically. Examples: ["panel"] or ["panel", "panel_material_ui"] |
Examples:
Use this tool to see available packages:
Then use those package names in other tools:
Source code in src/holoviz_mcp/panel_mcp/server.py
search_components(ctx, query, package=None, limit=10)
async
¶
Search for Panel components by search query and optional package filter.
Use this tool to find components when you don't know the exact name but have keywords. The search looks through component names, module paths, and documentation to find matches.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ctx
|
Context
|
FastMCP context (automatically provided by the MCP framework). |
required |
query
|
str
|
Search term to look for. Can be component names, functionality keywords, or descriptions. Examples: "button", "input", "text", "chart", "plot", "slider", "select" |
required |
package
|
str
|
Package name to filter results. If None, searches all packages. Examples: "hvplot", "panel", or "panel_material_ui" |
None
|
limit
|
int
|
Maximum number of results to return. Default is 10. |
10
|
Returns:
| Type | Description |
|---|---|
list[ComponentSummarySearchResult]
|
List of matching components with relevance scores (0-100, where 100 is exact match). Results are sorted by relevance score in descending order. |
Examples:
Search for button components:
>>> search_components("button")
[ComponentSummarySearchResult(name="Button", package="panel", relevance_score=80, ...)]
Search within a specific package:
>>> search_components("input", package="panel_material_ui")
[ComponentSummarySearchResult(name="TextInput", package="panel_material_ui", ...)]
Find chart components with limited results:
>>> search_components("chart", limit=5)
[ComponentSummarySearchResult(name="Bokeh", package="panel", ...)]
Source code in src/holoviz_mcp/panel_mcp/server.py
Models¶
Pydantic models for Panel component metadata collection.
This module defines the data models used to represent Panel UI component information, including parameter details, component summaries, and search results.
ComponentDetails
¶
Bases: ComponentSummary
Complete information about a Panel UI component.
This model includes all available information about a component: summary information, initialization signature, full docstring, and detailed parameter specifications.
Source code in src/holoviz_mcp/panel_mcp/models.py
docstring = Field(description='Docstring of the component, providing detailed information about its usage.')
class-attribute
instance-attribute
¶
init_signature = Field(description="Signature of the component's __init__ method.")
class-attribute
instance-attribute
¶
parameters = Field(description='Dictionary of parameters for the component, where keys are parameter names and values are ParameterInfo objects.')
class-attribute
instance-attribute
¶
to_base()
¶
Convert to a basic component summary.
Strips away detailed information to create a lightweight summary suitable for listings and overviews.
Returns:
| Type | Description |
|---|---|
ComponentSummary
|
A summary version of this component. |
Source code in src/holoviz_mcp/panel_mcp/models.py
ComponentSummary
¶
Bases: BaseModel
High-level information about a Panel UI component.
This model provides a compact representation of a component without detailed parameter information or docstrings. Used for listings and quick overviews.
Source code in src/holoviz_mcp/panel_mcp/models.py
description = Field(description="Short description of the component's purpose and functionality.")
class-attribute
instance-attribute
¶
module_path = Field(description="Full module path of the component, e.g., 'panel.widgets.Button' or 'panel_material_ui.Button'.")
class-attribute
instance-attribute
¶
name = Field(description="Name of the component, e.g., 'Button' or 'TextInput'.")
class-attribute
instance-attribute
¶
package = Field(description="Package name of the component, e.g., 'panel' or 'panel_material_ui'.")
class-attribute
instance-attribute
¶
ComponentSummarySearchResult
¶
Bases: ComponentSummary
Component summary with search relevance scoring.
Extends ComponentSummary with a relevance score for search results, allowing proper ranking and filtering of search matches.
Source code in src/holoviz_mcp/panel_mcp/models.py
relevance_score = Field(default=0, description='Relevance score for search results')
class-attribute
instance-attribute
¶
from_component(component, relevance_score)
classmethod
¶
Create a search result from a component and relevance score.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component
|
ComponentDetails
|
The component to create a search result from. |
required |
relevance_score
|
int
|
The relevance score (0-100) for this search result. |
required |
Returns:
| Type | Description |
|---|---|
ComponentSummarySearchResult
|
A search result summary of the component. |
Source code in src/holoviz_mcp/panel_mcp/models.py
ParameterInfo
¶
Bases: BaseModel
Information about a Panel component parameter.
This model captures parameter metadata including type, default value, documentation, and type-specific attributes like bounds or options.
Source code in src/holoviz_mcp/panel_mcp/models.py
allow_None = Field(default=None, description='Whether the parameter accepts None values.')
class-attribute
instance-attribute
¶
bounds = Field(default=None, description='Value bounds for Number-type parameters.')
class-attribute
instance-attribute
¶
constant = Field(default=None, description='Whether the parameter is constant (cannot be changed after initialization).')
class-attribute
instance-attribute
¶
default = Field(default=None, description='The default value for the parameter.')
class-attribute
instance-attribute
¶
doc = Field(default=None, description='Documentation string for the parameter.')
class-attribute
instance-attribute
¶
model_config = ConfigDict(extra='allow')
class-attribute
instance-attribute
¶
objects = Field(default=None, description='Available options for Selector-type parameters.')
class-attribute
instance-attribute
¶
per_instance = Field(default=None, description='Whether the parameter is per-instance or shared across instances.')
class-attribute
instance-attribute
¶
readonly = Field(default=None, description='Whether the parameter is read-only.')
class-attribute
instance-attribute
¶
regex = Field(default=None, description='Regular expression pattern for String-type parameters.')
class-attribute
instance-attribute
¶
type = Field(description="The type of the parameter, e.g., 'Parameter', 'Number', 'Selector'.")
class-attribute
instance-attribute
¶
Data¶
Data collection module for Panel component metadata.
This module provides functionality to collect metadata about Panel UI components, including their documentation, parameter schema, and module information. It supports collecting information from panel.viewable.Viewable subclasses across different Panel-related packages.
collect_component_info(cls)
¶
Collect comprehensive information about a Panel component class.
Extracts metadata including docstring, parameter information, method signatures, and other relevant details from a Panel component class. Handles parameter introspection safely, converting non-serializable values appropriately.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cls
|
type
|
The Panel component class to analyze. |
required |
Returns:
| Type | Description |
|---|---|
ComponentDetails
|
A complete model containing all collected component information. |
Source code in src/holoviz_mcp/panel_mcp/data.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | |
find_all_subclasses(cls)
¶
Recursively find all subclasses of a given class.
This function performs a depth-first search through the class hierarchy to find all classes that inherit from the given base class, either directly or through inheritance chains.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cls
|
type
|
The base class to find subclasses for. |
required |
Returns:
| Type | Description |
|---|---|
set[type]
|
Set of all subclasses found recursively, not including the base class itself. |
Source code in src/holoviz_mcp/panel_mcp/data.py
get_components(parent=Viewable)
¶
Get detailed information about all Panel component subclasses.
Discovers all subclasses of the specified parent class (typically Viewable), filters out private classes, and collects comprehensive metadata for each. Results are sorted alphabetically by module path for consistency.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
type
|
The parent class to search for subclasses. Defaults to panel.viewable.Viewable. |
Viewable
|
Returns:
| Type | Description |
|---|---|
list[ComponentDetails]
|
List of detailed component information models, sorted by module path. |
Source code in src/holoviz_mcp/panel_mcp/data.py
load_components(filepath)
¶
Load component data from a JSON file.
Reads and deserializes component data that was previously saved using save_components(). Validates the file exists before attempting to load.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filepath
|
str
|
Path to the saved component data JSON file. |
required |
Returns:
| Type | Description |
|---|---|
list[ComponentDetails]
|
Loaded component data as Pydantic model instances. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the specified file does not exist. |
Source code in src/holoviz_mcp/panel_mcp/data.py
save_components(data, filename)
¶
Save component data to a JSON file.
Serializes a list of ComponentDetails objects to JSON format for persistence. The JSON is formatted with indentation for human readability.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
list[ComponentDetails]
|
Component data to save, typically from get_components(). |
required |
filename
|
str
|
Path where the JSON file should be created. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Absolute path to the created file. |
Source code in src/holoviz_mcp/panel_mcp/data.py
to_proxy_url(url, jupyter_server_proxy_url='')
¶
Convert localhost URLs to Jupyter server proxy URLs when applicable.
This function handles URL conversion for environments where localhost access needs to be proxied (like JupyterHub, Binder, etc.). It supports both 'localhost' and '127.0.0.1' addresses and preserves paths and query parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
The original URL to potentially convert. Can be any URL, but only localhost and 127.0.0.1 URLs will be converted. |
required |
jupyter_server_proxy_url
|
str
|
Base URL for the Jupyter server proxy. If None or empty, no conversion is performed. Defaults to the configured proxy URL. |
''
|
Returns:
| Type | Description |
|---|---|
str
|
The converted proxy URL if applicable, otherwise the original URL. Proxy URLs maintain the original port, path, and query parameters. |
Examples:
>>> to_proxy_url("https://external.com/page")
"https://external.com/page" # No conversion for external URLs
Source code in src/holoviz_mcp/panel_mcp/data.py
hvPlot MCP¶
Server¶
hvPlot MCP Server.
This MCP server provides tools, resources, and prompts for using hvPlot to develop quick, interactive plots in Python using best practices.
Use this server to: - List available hvPlot plot types (e.g., 'line', 'scatter', 'bar', ...) - Get docstrings and function signatures for hvPlot plot types - Access hvPlot documentation and best practices
mcp = FastMCP(name='hvplot', instructions='\n [hvPlot](https://hvplot.holoviz.org/) MCP Server.\n\n This MCP server provides tools, resources, and prompts for using hvPlot to develop quick, interactive plots\n in Python using best practices. Use this server to:\n\n - List available hvPlot plot types\n - Get docstrings and function signatures for hvPlot plot types\n - Access hvPlot documentation and best practices')
module-attribute
¶
get_docstring(ctx, plot_type, docstring=True, generic=True, style=True)
async
¶
Get the hvPlot docstring for a specific plot type, including available options and usage details.
Use this tool to retrieve the full docstring for a plot type, including generic and style options.
Equivalent to hvplot.help(plot_type) in the hvPlot API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ctx
|
Context
|
FastMCP context (automatically provided by the MCP framework). |
required |
plot_type
|
str
|
The type of plot to provide help for (e.g., 'line', 'scatter'). |
required |
docstring
|
bool
|
Whether to include the docstring in the output. |
True
|
generic
|
bool
|
Whether to include generic plotting options shared by all plot types. |
True
|
style
|
str or bool
|
Plotting backend to use for style options. If True, automatically infers the backend. |
True
|
Returns:
| Type | Description |
|---|---|
str
|
The docstring for the specified plot type, including all relevant options and usage information. |
Examples:
Source code in src/holoviz_mcp/hvplot_mcp/server.py
get_signature(ctx, plot_type, style=True)
async
¶
Get the function signature for a specific hvPlot plot type.
Use this tool to retrieve the Python function signature for a plot type, showing all accepted arguments and their defaults.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ctx
|
Context
|
FastMCP context (automatically provided by the MCP framework). |
required |
plot_type
|
str
|
The type of plot to provide help for (e.g., 'line', 'scatter'). |
required |
style
|
str or bool
|
Plotting backend to use for style options. If True, automatically infers the backend (ignored here). |
True
|
Returns:
| Type | Description |
|---|---|
str
|
The function signature for the specified plot type. |
Examples:
Source code in src/holoviz_mcp/hvplot_mcp/server.py
list_plot_types(ctx)
async
¶
List all available hvPlot plot types supported in the current environment.
Use this tool to discover what plot types you can generate with hvPlot.
Note: The plot types are also called "kinds".
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ctx
|
Context
|
FastMCP context (automatically provided by the MCP framework). |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
Sorted list of all plot type names (e.g., 'line', 'scatter', 'bar', ...). |
Examples:
Source code in src/holoviz_mcp/hvplot_mcp/server.py
Documentation MCP¶
Server¶
HoloViz Documentation MCP Server.
This server provides tools, resources and prompts for accessing documentation related to the HoloViz ecosystems.
Use this server to search and access documentation for HoloViz libraries, including Panel and hvPlot.
config = get_config()
module-attribute
¶
logger = logging.getLogger(__name__)
module-attribute
¶
mcp = FastMCP(name='documentation', instructions='\n [HoloViz](https://holoviz.org/) Documentation MCP Server.\n\n This server provides tools, resources and prompts for accessing documentation related to the HoloViz ecosystems.\n\n Use this server to search and access documentation for HoloViz libraries, including Panel and hvPlot.\n ')
module-attribute
¶
get_best_practices(project)
¶
Get best practices for using a project with LLMs.
DO Always use this tool to get best practices for using a project with LLMs before using it!
Args: project (str): The name of the project to get best practices for. For example, "panel", "panel-material-ui", etc.
Returns:
| Type | Description |
|---|---|
str: A string containing the best practices for the project in Markdown format.
|
|
Source code in src/holoviz_mcp/holoviz_mcp/server.py
get_document(path, project, ctx)
async
¶
Retrieve a specific document by path and project.
Use this tool to look up a specific document within a project.
Args: path: The relative path to the source document (e.g., "index.md", "how_to/customize.md") project: the name of the project (e.g., "panel", "panel-material-ui", "hvplot")
Returns:
| Type | Description |
|---|---|
The markdown content of the specified document.
|
|
Source code in src/holoviz_mcp/holoviz_mcp/server.py
get_indexer()
¶
Get or create the global DocumentationIndexer instance.
get_reference_guide(component, project=None, content=True, ctx=None)
async
¶
Find reference guides for specific HoloViz components.
Reference guides are a subset of all documents that focus on specific UI components or plot types, such as:
panel: "Button", "TextInput", ...hvplot: "bar", "scatter", ...- ...
DO use this tool to easily find reference guides for specific components in HoloViz libraries.
Args: component (str): Name of the component (e.g., "Button", "TextInput", "bar", "scatter") project (str, optional): Project name. Defaults to None (searches all projects). Options: "panel", "panel-material-ui", "hvplot", "param", "holoviews" content (bool, optional): Whether to include full content. Defaults to True. Set to False to only return metadata for faster responses.
Returns:
| Type | Description |
|---|---|
list[Document]: A list of reference guides for the component.
|
|
Examples:
>>> get_reference_guide("Button") # Find Button component guide across all projects
>>> get_reference_guide("Button", "panel") # Find Panel Button component guide specifically
>>> get_reference_guide("TextInput", "panel-material-ui") # Find Material UI TextInput guide
>>> get_reference_guide("bar", "hvplot") # Find hvplot bar chart reference
>>> get_reference_guide("scatter", "hvplot") # Find hvplot scatter plot reference
>>> get_reference_guide("Audio", content=False) # Don't include Markdown content for faster response
Source code in src/holoviz_mcp/holoviz_mcp/server.py
list_best_practices()
¶
List all available best practices projects.
This tool discovers available best practices from both user and default directories, with user resources taking precedence over default ones.
Returns:
| Type | Description |
|---|---|
list[str]: A list of project names that have best practices available.
|
Names are returned in hyphenated format (e.g., "panel-material-ui"). |
Source code in src/holoviz_mcp/holoviz_mcp/server.py
list_projects()
async
¶
List all available projects with documentation.
This tool discovers all projects that have documentation available in the index, including both core HoloViz libraries and any additional user-defined projects.
Returns:
| Type | Description |
|---|---|
list[str]: A list of project names that have documentation available.
|
Names are returned in hyphenated format (e.g., "panel-material-ui"). |
Source code in src/holoviz_mcp/holoviz_mcp/server.py
search(query, project=None, content=True, max_results=5, ctx=None)
async
¶
Search HoloViz documentation using semantic similarity.
Optimized for finding relevant documentation based on natural language queries.
DO use this tool to find answers to questions about HoloViz libraries, such as Panel and hvPlot.
Args: query (str): Search query using natural language. For example "How to style Material UI components?" or "interactive plotting with widgets" project (str, optional): Optional project filter. Defaults to None. Options: "panel", "panel-material-ui", "hvplot", "param", "holoviews" content (bool, optional): Whether to include full content. Defaults to True. Set to False to only return metadata for faster responses. max_results (int, optional): Maximum number of results to return. Defaults to 5.
Returns:
| Type | Description |
|---|---|
list[Document]: A list of relevant documents ordered by relevance.
|
|
Examples:
>>> search("How to style Material UI components?", "panel-material-ui") # Semantic search in specific project
>>> search("interactive plotting with widgets", "hvplot") # Find hvplot interactive guides
>>> search("dashboard layout best practices") # Search across all projects
>>> search("custom widgets", project="panel", max_results=3) # Limit results
>>> search("parameter handling", content=False) # Get metadata only for overview
Source code in src/holoviz_mcp/holoviz_mcp/server.py
update_index(ctx)
async
¶
Update the documentation index by re-cloning repositories and re-indexing content.
DO use this tool periodically (weekly) to ensure the documentation index is up-to-date with the latest changes in the HoloViz ecosystem.
Warning: This operation can take a long time (up to 5 minutes) depending on the number of repositories and their size!
Returns:
| Type | Description |
|---|---|
str: Status message indicating the result of the update operation.
|
|
Examples:
Source code in src/holoviz_mcp/holoviz_mcp/server.py
Models¶
Data models for the HoloViz Documentation MCP server.
Document
¶
Bases: BaseModel
Represents a document.
Source code in src/holoviz_mcp/holoviz_mcp/models.py
content = Field(default=None, description='The content of the documentation, if available. In Markdown format if possible.')
class-attribute
instance-attribute
¶
description = Field(default=None, description='A brief description of the document.')
class-attribute
instance-attribute
¶
is_reference = Field(..., description='Indicates if the document is a reference guide.')
class-attribute
instance-attribute
¶
project = Field(..., description='The project to which the document belongs.')
class-attribute
instance-attribute
¶
relevance_score = Field(default=None, description='Relevance score of the document, where 1 is the highest score indicating an exact match.')
class-attribute
instance-attribute
¶
source_path = Field(..., description='The path to the document within the project.')
class-attribute
instance-attribute
¶
source_url = Field(..., description='The URL to the source document.')
class-attribute
instance-attribute
¶
title = Field(..., description='The title of the document.')
class-attribute
instance-attribute
¶
url = Field(..., description='The URL of the rendered, target document.')
class-attribute
instance-attribute
¶
Data¶
Data handling for the HoloViz Documentation MCP server.
logger = logging.getLogger(__name__)
module-attribute
¶
DocumentationIndexer
¶
Handles cloning, processing, and indexing of documentation.
Source code in src/holoviz_mcp/holoviz_mcp/data.py
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 | |
chroma_client = chromadb.PersistentClient(path=(str(vector_db_path)))
instance-attribute
¶
collection = self.chroma_client.get_or_create_collection('holoviz_docs', configuration=_CROMA_CONFIGURATION)
instance-attribute
¶
config = get_config().docs
instance-attribute
¶
data_dir = data_dir or config.user_dir
instance-attribute
¶
nb_exporter = MarkdownExporter()
instance-attribute
¶
repos_dir = repos_dir or config.repos_dir
instance-attribute
¶
clone_or_update_repo(repo_name, repo_config, ctx=None)
async
¶
Clone or update a single repository.
Source code in src/holoviz_mcp/holoviz_mcp/data.py
convert_notebook_to_markdown(notebook_path)
¶
Convert a Jupyter notebook to markdown.
Source code in src/holoviz_mcp/holoviz_mcp/data.py
ensure_indexed(ctx=None)
async
¶
Ensure documentation is indexed, creating if necessary.
Source code in src/holoviz_mcp/holoviz_mcp/data.py
extract_docs_from_repo(repo_path, project, ctx=None)
async
¶
Extract documentation files from a repository.
Source code in src/holoviz_mcp/holoviz_mcp/data.py
get_document(path, project, ctx=None)
async
¶
Get a specific document.
Source code in src/holoviz_mcp/holoviz_mcp/data.py
index_documentation(ctx=None)
async
¶
Indexes all documentation.
Source code in src/holoviz_mcp/holoviz_mcp/data.py
is_indexed()
¶
list_projects()
async
¶
List all available projects with documentation in the index.
Returns:
| Type | Description |
|---|---|
list[str]: A list of project names that have documentation available.
|
Names are returned in hyphenated format (e.g., "panel-material-ui"). |
Source code in src/holoviz_mcp/holoviz_mcp/data.py
process_file(file_path, project, repo_config, folder_name='')
¶
Process a file and extract metadata.
Source code in src/holoviz_mcp/holoviz_mcp/data.py
run()
¶
Update the DocumentationIndexer.
Source code in src/holoviz_mcp/holoviz_mcp/data.py
search(query, project=None, content=True, max_results=5, ctx=None)
async
¶
Search the documentation using semantic similarity.
Source code in src/holoviz_mcp/holoviz_mcp/data.py
search_get_reference_guide(component, project=None, content=True, ctx=None)
async
¶
Search for reference guides for a specific component.
Source code in src/holoviz_mcp/holoviz_mcp/data.py
convert_path_to_url(path, remove_first_part=True, url_transform='holoviz')
¶
Convert a relative file path to a URL path.
Converts file paths to web URLs by replacing file extensions with .html and optionally removing the first path component for legacy compatibility.
Args: path: The file path to convert remove_first_part: Whether to remove the first path component (legacy compatibility) url_transform: How to transform the file path into a URL:
- "holoviz": Replace file extension with .html (default)
- "plotly": Replace file extension with / (e.g., filename.md -> filename/)
- "datashader": Remove leading index and replace file extension with .html (e.g., 01_filename.md -> filename.html)
Returns:
| Type | Description |
|---|---|
URL path with .html extension
|
|
Examples:
>>> convert_path_to_url(Path("doc/getting_started.md"))
"getting_started.html"
>>> convert_path_to_url(Path("examples/reference/Button.ipynb"), False)
"examples/reference/Button.html"
>>> convert_path_to_url(Path("/doc/python/3d-axes.md"), False, "plotly")
"/doc/python/3d-axes/"
>>> convert_path_to_url(Path("/examples/user_guide/10_Performance.ipynb"), False, "datashader")
"/examples/user_guide/Performance.html"
Source code in src/holoviz_mcp/holoviz_mcp/data.py
get_best_practices(project)
¶
Get best practices for using a project with LLMs.
This function searches for best practices resources in user and default directories, with user resources taking precedence over default ones.
Args: project (str): The name of the project to get best practices for. Both hyphenated (e.g., "panel-material-ui") and underscored (e.g., "panel_material_ui") names are supported.
Returns:
| Type | Description |
|---|---|
str: A string containing the best practices for the project in Markdown format.
|
|
Raises:
| Type | Description |
|---|---|
FileNotFoundError: If no best practices file is found for the project.
|
|
Source code in src/holoviz_mcp/holoviz_mcp/data.py
list_best_practices()
¶
List all available best practices projects.
This function discovers available best practices from both user and default directories, with user resources taking precedence over default ones.
Returns:
| Type | Description |
|---|---|
list[str]: A list of project names that have best practices available.
|
Names are returned in hyphenated format (e.g., "panel-material-ui"). |
Source code in src/holoviz_mcp/holoviz_mcp/data.py
log_exception(message, ctx=None)
async
¶
Log an error message to the context or logger.
log_info(message, ctx=None)
async
¶
log_warning(message, ctx=None)
async
¶
main()
¶
remove_leading_number_sep_from_path(p)
¶
Remove a leading number + underscore or hyphen from the last path component.
Configuration¶
Configuration package for HoloViz MCP server.
ConfigLoader
¶
Loads and manages HoloViz MCP configuration.
Source code in src/holoviz_mcp/config/loader.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | |
clear_cache()
¶
create_default_user_config()
¶
Create a default user configuration file.
Source code in src/holoviz_mcp/config/loader.py
get_best_practices_dir()
¶
get_prompts_dir()
¶
get_repos_dir()
¶
get_resources_dir()
¶
load_config()
¶
Load configuration from files and environment.
Returns:
| Type | Description |
|---|---|
Loaded configuration.
|
|
Raises:
| Type | Description |
|---|---|
ConfigurationError: If configuration cannot be loaded or is invalid.
|
|
Source code in src/holoviz_mcp/config/loader.py
reload_config()
¶
Reload configuration from files.
Returns:
| Type | Description |
|---|---|
Reloaded configuration.
|
|
ConfigurationError
¶
DocsConfig
¶
Bases: BaseModel
Configuration for documentation repositories.
Source code in src/holoviz_mcp/config/models.py
exclude_patterns = Field(default_factory=(lambda: ['**/node_modules/**', '**/.git/**', '**/build/**']), description='File patterns to exclude when indexing documentation')
class-attribute
instance-attribute
¶
index_patterns = Field(default_factory=(lambda: ['**/*.md', '**/*.rst', '**/*.txt']), description='File patterns to include when indexing documentation')
class-attribute
instance-attribute
¶
max_file_size = Field(default=(1024 * 1024), description='Maximum file size in bytes to index')
class-attribute
instance-attribute
¶
repositories = Field(default_factory=dict, description='Dictionary mapping package names to repository configurations')
class-attribute
instance-attribute
¶
update_interval = Field(default=86400, description='How often to check for updates in seconds')
class-attribute
instance-attribute
¶
GitRepository
¶
Bases: BaseModel
Configuration for a Git repository.
Source code in src/holoviz_mcp/config/models.py
base_url = Field(..., description='Base URL for documentation links')
class-attribute
instance-attribute
¶
branch = Field(default=None, description='Git branch to use')
class-attribute
instance-attribute
¶
commit = Field(default=None, description='Git commit hash to use')
class-attribute
instance-attribute
¶
folders = Field(default_factory=(lambda: {'doc': FolderConfig()}), description='Folders to index within the repository. Can be a list of folder names or a dict mapping folder names to FolderConfig objects')
class-attribute
instance-attribute
¶
reference_patterns = Field(default_factory=(lambda: ['examples/reference/**/*.md', 'examples/reference/**/*.ipynb']), description='Glob patterns for reference documentation files')
class-attribute
instance-attribute
¶
tag = Field(default=None, description="Git tag to use (e.g., '1.7.2')")
class-attribute
instance-attribute
¶
url = Field(..., description='Git repository URL')
class-attribute
instance-attribute
¶
url_transform = Field(default='holoviz', description='How to transform file path into URL:\n\n - holoViz transform suffix to .html: filename.md -> filename.html\n - plotly transform suffix to /: filename.md -> filename/\n - datashader removes leading index and transform suffix to .html: 01_filename.md -> filename.html\n ')
class-attribute
instance-attribute
¶
get_folder_names()
¶
Get list of folder names for backward compatibility.
get_folder_url_path(folder_name)
¶
Get URL path for a specific folder.
Source code in src/holoviz_mcp/config/models.py
validate_folders(v)
classmethod
¶
Validate and normalize folders configuration.
Source code in src/holoviz_mcp/config/models.py
validate_tag(v)
classmethod
¶
Validate git tag format, allowing both 'v1.2.3' and '1.2.3' formats.
Source code in src/holoviz_mcp/config/models.py
HoloVizMCPConfig
¶
Bases: BaseModel
Main configuration for HoloViz MCP server.
Source code in src/holoviz_mcp/config/models.py
default_dir = Field(default_factory=_holoviz_mcp_default_dir, description='Default configuration directory')
class-attribute
instance-attribute
¶
docs = Field(default_factory=DocsConfig)
class-attribute
instance-attribute
¶
model_config = ConfigDict(extra='forbid', validate_assignment=True)
class-attribute
instance-attribute
¶
prompts = Field(default_factory=PromptConfig)
class-attribute
instance-attribute
¶
repos_dir = Field(default_factory=(lambda: _holoviz_mcp_user_dir() / 'repos'), description='Repository download directory')
class-attribute
instance-attribute
¶
resources = Field(default_factory=ResourceConfig)
class-attribute
instance-attribute
¶
server = Field(default_factory=ServerConfig)
class-attribute
instance-attribute
¶
user_dir = Field(default_factory=_holoviz_mcp_user_dir, description='User configuration directory')
class-attribute
instance-attribute
¶
best_practices_dir(location='user')
¶
Get the path to the best practices directory.
Args: location: Whether to get user or default best practices directory
Source code in src/holoviz_mcp/config/models.py
config_file_path(location='user')
¶
Get the path to the configuration file.
Args: location: Whether to get user or default config file path
Source code in src/holoviz_mcp/config/models.py
prompts_dir(location='user')
¶
Get the path to the prompts directory.
Args: location: Whether to get user or default prompts directory
Source code in src/holoviz_mcp/config/models.py
resources_dir(location='user')
¶
Get the path to the resources directory.
Args: location: Whether to get user or default resources directory
Source code in src/holoviz_mcp/config/models.py
PromptConfig
¶
Bases: BaseModel
Configuration for prompts.
Source code in src/holoviz_mcp/config/models.py
search_paths = Field(default_factory=list, description='Additional paths to search for prompts')
class-attribute
instance-attribute
¶
ResourceConfig
¶
Bases: BaseModel
Configuration for resources (best practices, etc.).
Source code in src/holoviz_mcp/config/models.py
search_paths = Field(default_factory=list, description='Additional paths to search for resources')
class-attribute
instance-attribute
¶
ServerConfig
¶
Bases: BaseModel
Configuration for the MCP server.
Source code in src/holoviz_mcp/config/models.py
anonymized_telemetry = Field(default=False, description='Enable anonymized telemetry')
class-attribute
instance-attribute
¶
description = Field(default='Model Context Protocol server for HoloViz ecosystem', description='Server description')
class-attribute
instance-attribute
¶
host = Field(default='127.0.0.1', description='Host address to bind to when using HTTP transport (use 0.0.0.0 for Docker)')
class-attribute
instance-attribute
¶
jupyter_server_proxy_url = Field(default='', description='Jupyter server proxy URL for Panel app integration')
class-attribute
instance-attribute
¶
log_level = Field(default='INFO', description='Logging level')
class-attribute
instance-attribute
¶
name = Field(default='holoviz-mcp', description='Server name')
class-attribute
instance-attribute
¶
port = Field(default=8000, description='Port to bind to when using HTTP transport')
class-attribute
instance-attribute
¶
transport = Field(default='stdio', description='Transport protocol for MCP communication')
class-attribute
instance-attribute
¶
vector_db_path = Field(default_factory=(lambda: (_holoviz_mcp_user_dir() / 'vector_db' / 'chroma').expanduser()), description='Path to the Chroma vector database.')
class-attribute
instance-attribute
¶
version = Field(default='1.0.0', description='Server version')
class-attribute
instance-attribute
¶
get_config()
¶
get_config_loader()
¶
Get the global configuration loader instance.
Loader¶
Configuration loader for HoloViz MCP server.
logger = logging.getLogger(__name__)
module-attribute
¶
ConfigLoader
¶
Loads and manages HoloViz MCP configuration.
Source code in src/holoviz_mcp/config/loader.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | |
clear_cache()
¶
create_default_user_config()
¶
Create a default user configuration file.
Source code in src/holoviz_mcp/config/loader.py
get_best_practices_dir()
¶
get_prompts_dir()
¶
get_repos_dir()
¶
get_resources_dir()
¶
load_config()
¶
Load configuration from files and environment.
Returns:
| Type | Description |
|---|---|
Loaded configuration.
|
|
Raises:
| Type | Description |
|---|---|
ConfigurationError: If configuration cannot be loaded or is invalid.
|
|
Source code in src/holoviz_mcp/config/loader.py
reload_config()
¶
Reload configuration from files.
Returns:
| Type | Description |
|---|---|
Reloaded configuration.
|
|
ConfigurationError
¶
get_config()
¶
get_config_loader()
¶
Get the global configuration loader instance.
Models¶
Configuration models for HoloViz MCP server.
DocsConfig
¶
Bases: BaseModel
Configuration for documentation repositories.
Source code in src/holoviz_mcp/config/models.py
exclude_patterns = Field(default_factory=(lambda: ['**/node_modules/**', '**/.git/**', '**/build/**']), description='File patterns to exclude when indexing documentation')
class-attribute
instance-attribute
¶
index_patterns = Field(default_factory=(lambda: ['**/*.md', '**/*.rst', '**/*.txt']), description='File patterns to include when indexing documentation')
class-attribute
instance-attribute
¶
max_file_size = Field(default=(1024 * 1024), description='Maximum file size in bytes to index')
class-attribute
instance-attribute
¶
repositories = Field(default_factory=dict, description='Dictionary mapping package names to repository configurations')
class-attribute
instance-attribute
¶
update_interval = Field(default=86400, description='How often to check for updates in seconds')
class-attribute
instance-attribute
¶
FolderConfig
¶
Bases: BaseModel
Configuration for a folder within a repository.
Source code in src/holoviz_mcp/config/models.py
url_path = Field(default='', description="URL path mapping for this folder (e.g., '' for root, '/reference' for reference docs)")
class-attribute
instance-attribute
¶
GitRepository
¶
Bases: BaseModel
Configuration for a Git repository.
Source code in src/holoviz_mcp/config/models.py
base_url = Field(..., description='Base URL for documentation links')
class-attribute
instance-attribute
¶
branch = Field(default=None, description='Git branch to use')
class-attribute
instance-attribute
¶
commit = Field(default=None, description='Git commit hash to use')
class-attribute
instance-attribute
¶
folders = Field(default_factory=(lambda: {'doc': FolderConfig()}), description='Folders to index within the repository. Can be a list of folder names or a dict mapping folder names to FolderConfig objects')
class-attribute
instance-attribute
¶
reference_patterns = Field(default_factory=(lambda: ['examples/reference/**/*.md', 'examples/reference/**/*.ipynb']), description='Glob patterns for reference documentation files')
class-attribute
instance-attribute
¶
tag = Field(default=None, description="Git tag to use (e.g., '1.7.2')")
class-attribute
instance-attribute
¶
url = Field(..., description='Git repository URL')
class-attribute
instance-attribute
¶
url_transform = Field(default='holoviz', description='How to transform file path into URL:\n\n - holoViz transform suffix to .html: filename.md -> filename.html\n - plotly transform suffix to /: filename.md -> filename/\n - datashader removes leading index and transform suffix to .html: 01_filename.md -> filename.html\n ')
class-attribute
instance-attribute
¶
get_folder_names()
¶
Get list of folder names for backward compatibility.
get_folder_url_path(folder_name)
¶
Get URL path for a specific folder.
Source code in src/holoviz_mcp/config/models.py
validate_folders(v)
classmethod
¶
Validate and normalize folders configuration.
Source code in src/holoviz_mcp/config/models.py
validate_tag(v)
classmethod
¶
Validate git tag format, allowing both 'v1.2.3' and '1.2.3' formats.
Source code in src/holoviz_mcp/config/models.py
HoloVizMCPConfig
¶
Bases: BaseModel
Main configuration for HoloViz MCP server.
Source code in src/holoviz_mcp/config/models.py
default_dir = Field(default_factory=_holoviz_mcp_default_dir, description='Default configuration directory')
class-attribute
instance-attribute
¶
docs = Field(default_factory=DocsConfig)
class-attribute
instance-attribute
¶
model_config = ConfigDict(extra='forbid', validate_assignment=True)
class-attribute
instance-attribute
¶
prompts = Field(default_factory=PromptConfig)
class-attribute
instance-attribute
¶
repos_dir = Field(default_factory=(lambda: _holoviz_mcp_user_dir() / 'repos'), description='Repository download directory')
class-attribute
instance-attribute
¶
resources = Field(default_factory=ResourceConfig)
class-attribute
instance-attribute
¶
server = Field(default_factory=ServerConfig)
class-attribute
instance-attribute
¶
user_dir = Field(default_factory=_holoviz_mcp_user_dir, description='User configuration directory')
class-attribute
instance-attribute
¶
best_practices_dir(location='user')
¶
Get the path to the best practices directory.
Args: location: Whether to get user or default best practices directory
Source code in src/holoviz_mcp/config/models.py
config_file_path(location='user')
¶
Get the path to the configuration file.
Args: location: Whether to get user or default config file path
Source code in src/holoviz_mcp/config/models.py
prompts_dir(location='user')
¶
Get the path to the prompts directory.
Args: location: Whether to get user or default prompts directory
Source code in src/holoviz_mcp/config/models.py
resources_dir(location='user')
¶
Get the path to the resources directory.
Args: location: Whether to get user or default resources directory
Source code in src/holoviz_mcp/config/models.py
PromptConfig
¶
Bases: BaseModel
Configuration for prompts.
Source code in src/holoviz_mcp/config/models.py
search_paths = Field(default_factory=list, description='Additional paths to search for prompts')
class-attribute
instance-attribute
¶
ResourceConfig
¶
Bases: BaseModel
Configuration for resources (best practices, etc.).
Source code in src/holoviz_mcp/config/models.py
search_paths = Field(default_factory=list, description='Additional paths to search for resources')
class-attribute
instance-attribute
¶
ServerConfig
¶
Bases: BaseModel
Configuration for the MCP server.