Skip to content

Commit a86c750

Browse files
Merge pull request #19 from MarcSkovMadsen/enhancement/config
Make holoviz-mcp configurable
2 parents bf3c403 + 214855e commit a86c750

30 files changed

Lines changed: 2642 additions & 320 deletions

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
recursive-include holoviz_mcp/docs_mcp/templates *.md
1+
recursive-include holoviz_mcp/config *.yaml *.json

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,48 @@ Install additional packages and restart the server to include them.
354354

355355
</details>
356356

357+
## ⚙️ User Configuration
358+
359+
HoloViz MCP supports user configuration via a YAML file, allowing you to customize server behavior and documentation sources to fit your workflow.
360+
361+
### Custom Configuration File
362+
363+
You can provide a custom configuration file to override or extend the default settings. By default, configuration is loaded from `~/.holoviz-mcp/config.yaml`, but you can specify a different location using the `HOLOVIZ_MCP_USER_DIR` environment variable:
364+
365+
```bash
366+
export HOLOVIZ_MCP_USER_DIR=/path/to/your/config_dir
367+
```
368+
369+
### Adding Custom Documentation Repositories
370+
371+
To add documentation from other libraries or your own projects, edit your configuration YAML and add entries under `docs.repositories`.
372+
373+
#### Example: Adding Plotly and Altair Documentation
374+
375+
```yaml
376+
docs:
377+
repositories:
378+
plotly:
379+
url: "https://github.com/plotly/plotly.py.git"
380+
branch: "main"
381+
folders:
382+
docs: {}
383+
base_url: "https://plotly.com/python"
384+
altair:
385+
url: "https://github.com/altair-viz/altair.git"
386+
branch: "main"
387+
folders:
388+
doc: {}
389+
base_url: "https://altair-viz.github.io"
390+
```
391+
392+
After updating your configuration:
393+
394+
- update your index (`holoviz-mcp-update`)
395+
- restart the MCP server
396+
397+
Your custom documentation repositories will now be available for search and reference within HoloViz MCP.
398+
357399
## 🔧 Troubleshooting
358400

359401
### Common Issues

pixi.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ fastmcp = "*"
1414
GitPython = "*"
1515
nbconvert = "*"
1616
panel = "*"
17+
pydantic = ">=2.0"
18+
PyYAML = "*"
1719
sentence-transformers = "*"
1820

1921
[host-dependencies]

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ dependencies = [
4545
"packaging",
4646
"nbconvert",
4747
"panel",
48+
"pydantic>=2.0",
49+
"PyYAML",
4850
"sentence-transformers",
4951
]
5052

src/holoviz_mcp/config/__init__.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
"""Configuration package for HoloViz MCP server."""
2+
3+
from .loader import ConfigLoader
4+
from .loader import ConfigurationError
5+
from .loader import get_config
6+
from .loader import get_config_loader
7+
from .loader import reload_config
8+
from .models import DocsConfig
9+
from .models import GitRepository
10+
from .models import HoloVizMCPConfig
11+
from .models import PromptConfig
12+
from .models import ResourceConfig
13+
from .models import SecurityConfig
14+
from .models import ServerConfig
15+
16+
__all__ = [
17+
# Loader
18+
"ConfigLoader",
19+
"ConfigurationError",
20+
"get_config",
21+
"get_config_loader",
22+
"reload_config",
23+
# Models
24+
"DocsConfig",
25+
"GitRepository",
26+
"HoloVizMCPConfig",
27+
"PromptConfig",
28+
"ResourceConfig",
29+
"SecurityConfig",
30+
"ServerConfig",
31+
]

src/holoviz_mcp/config/config.yaml

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
# Default configuration for HoloViz MCP server
2+
# This file provides the default settings that are used when no user configuration is provided.
3+
4+
server:
5+
name: holoviz-mcp
6+
version: "1.0.0"
7+
description: "Model Context Protocol server for HoloViz ecosystem"
8+
log_level: INFO
9+
transport: stdio
10+
anonymized_telemetry: false
11+
jupyter_server_proxy_url: ""
12+
security:
13+
allow_code_execution: false
14+
15+
docs:
16+
repositories:
17+
panel:
18+
url: https://github.com/holoviz/panel.git
19+
branch: main
20+
folders:
21+
doc:
22+
url_path: ""
23+
examples/reference:
24+
url_path: "/reference"
25+
base_url: https://panel.holoviz.org
26+
reference_patterns:
27+
- "examples/reference/**/*.md"
28+
- "examples/reference/**/*.ipynb"
29+
- "examples/reference/**/*.rst"
30+
panel-material-ui:
31+
url: https://github.com/panel-extensions/panel-material-ui.git
32+
branch: main
33+
folders:
34+
doc:
35+
url_path: ""
36+
examples/reference:
37+
url_path: "/reference"
38+
base_url: https://panel-material-ui.holoviz.org/
39+
reference_patterns:
40+
- "examples/reference/**/*.md"
41+
- "examples/reference/**/*.ipynb"
42+
- "examples/reference/**/*.rst"
43+
hvplot:
44+
url: https://github.com/holoviz/hvplot.git
45+
branch: main
46+
folders:
47+
doc:
48+
url_path: ""
49+
base_url: https://hvplot.holoviz.org
50+
reference_patterns:
51+
- "doc/reference/**/*.md"
52+
- "doc/reference/**/*.ipynb"
53+
- "doc/reference/**/*.rst"
54+
param:
55+
url: https://github.com/holoviz/param.git
56+
branch: main
57+
folders:
58+
doc:
59+
url_path: ""
60+
base_url: https://param.holoviz.org
61+
reference_patterns:
62+
- "doc/reference/**/*.md"
63+
- "doc/reference/**/*.ipynb"
64+
- "doc/reference/**/*.rst"
65+
holoviews:
66+
url: https://github.com/holoviz/holoviews.git
67+
branch: main
68+
folders:
69+
doc:
70+
url_path: ""
71+
examples/reference:
72+
url_path: "/reference"
73+
base_url: https://holoviews.org
74+
reference_patterns:
75+
- "examples/reference/**/*.md"
76+
- "examples/reference/**/*.ipynb"
77+
- "examples/reference/**/*.rst"
78+
datashader:
79+
url: https://github.com/holoviz/datashader.git
80+
branch: main
81+
folders:
82+
doc:
83+
url_path: ""
84+
examples:
85+
url_path: "/examples"
86+
base_url: https://datashader.org
87+
reference_patterns:
88+
- "doc/reference/**/*.md"
89+
- "doc/reference/**/*.ipynb"
90+
- "doc/reference/**/*.rst"
91+
geoviews:
92+
url: https://github.com/holoviz/geoviews.git
93+
branch: main
94+
folders:
95+
doc:
96+
url_path: ""
97+
examples:
98+
url_path: "/examples"
99+
base_url: https://geoviews.org
100+
reference_patterns:
101+
- "doc/reference/**/*.md"
102+
- "doc/reference/**/*.ipynb"
103+
- "doc/reference/**/*.rst"
104+
colorcet:
105+
url: https://github.com/holoviz/colorcet.git
106+
branch: main
107+
folders:
108+
doc:
109+
url_path: ""
110+
base_url: https://colorcet.holoviz.org
111+
reference_patterns:
112+
- "doc/reference/**/*.md"
113+
- "doc/reference/**/*.ipynb"
114+
- "doc/reference/**/*.rst"
115+
lumen:
116+
url: https://github.com/holoviz/lumen.git
117+
branch: main
118+
folders:
119+
doc:
120+
url_path: ""
121+
base_url: https://lumen.holoviz.org
122+
reference_patterns:
123+
- "doc/reference/**/*.md"
124+
- "doc/reference/**/*.ipynb"
125+
- "doc/reference/**/*.rst"
126+
127+
index_patterns:
128+
- "**/*.md"
129+
- "**/*.ipynb"
130+
- "**/*.rst"
131+
132+
exclude_patterns:
133+
- "**/node_modules/**"
134+
- "**/.git/**"
135+
- "**/build/**"
136+
- "**/__pycache__/**"
137+
- "**/.pytest_cache/**"
138+
139+
max_file_size: 1048576 # 1MB
140+
update_interval: 86400 # 24 hours
141+
142+
resources:
143+
search_paths: [] # Additional search paths for user resources
144+
# Default search paths are automatically included:
145+
# - Package default resources (src/holoviz_mcp/config/resources/)
146+
# - User config resources (~/.holoviz_mcp/config/resources/)
147+
148+
prompts:
149+
search_paths: [] # Additional search paths for user prompts
150+
# Default search paths are automatically included:
151+
# - Package default prompts (src/holoviz_mcp/config/prompts/)
152+
# - User config prompts (~/.holoviz_mcp/config/prompts/)

0 commit comments

Comments
 (0)