Skip to content

Commit ef5f6a8

Browse files
authored
configurable configuration file path (#113)
Signed-off-by: Manabu McCloskey <[email protected]>
1 parent 981d2fc commit ef5f6a8

File tree

2 files changed

+27
-11
lines changed

2 files changed

+27
-11
lines changed

README.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -94,18 +94,13 @@ python3 -m spark_history_mcp.core.main
9494
# Deactivate venv
9595
deactivate
9696
```
97-
98-
99-
### 📊 Sample Data
100-
The repository includes real Spark event logs for testing:
101-
- `spark-bcec39f6201b42b9925124595baad260` - ✅ Successful ETL job
102-
- `spark-110be3a8424d4a2789cb88134418217b` - 🔄 Data processing job
103-
- `spark-cc4d115f011443d787f03a71a476a745` - 📈 Multi-stage analytics job
104-
105-
See **[TESTING.md](TESTING.md)** for using them.
106-
10797
### ⚙️ Server Configuration
10898
Edit `config.yaml` for your Spark History Server:
99+
100+
**Config File Options:**
101+
- Command line: `--config /path/to/config.yaml` or `-c /path/to/config.yaml`
102+
- Environment variable: `SHS_MCP_CONFIG=/path/to/config.yaml`
103+
- Default: `./config.yaml`
109104
```yaml
110105
servers:
111106
local:
@@ -121,6 +116,15 @@ mcp:
121116
debug: true
122117
```
123118
119+
120+
### 📊 Sample Data
121+
The repository includes real Spark event logs for testing:
122+
- `spark-bcec39f6201b42b9925124595baad260` - ✅ Successful ETL job
123+
- `spark-110be3a8424d4a2789cb88134418217b` - 🔄 Data processing job
124+
- `spark-cc4d115f011443d787f03a71a476a745` - 📈 Multi-stage analytics job
125+
126+
See **[TESTING.md](TESTING.md)** for using them.
127+
124128
## 📸 Screenshots
125129

126130
### 🔍 Get Spark Application

src/spark_history_mcp/core/main.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
"""Main entry point for Spark History Server MCP."""
22

3+
import argparse
34
import json
45
import logging
6+
import os
57
import sys
68

79
from spark_history_mcp.config.config import Config
@@ -16,9 +18,19 @@
1618

1719
def main():
1820
"""Main entry point."""
21+
parser = argparse.ArgumentParser(description="Spark History Server MCP")
22+
parser.add_argument(
23+
"--config",
24+
"-c",
25+
default=os.getenv("SHS_MCP_CONFIG", "config.yaml"),
26+
help="Path to config file (default: config.yaml, env: SHS_MCP_CONFIG)",
27+
)
28+
args = parser.parse_args()
29+
1930
try:
2031
logger.info("Starting Spark History Server MCP...")
21-
config = Config.from_file("config.yaml")
32+
logger.info(f"Using config file: {args.config}")
33+
config = Config.from_file(args.config)
2234
if config.mcp.debug:
2335
logger.setLevel(logging.DEBUG)
2436
logger.debug(json.dumps(json.loads(config.model_dump_json()), indent=4))

0 commit comments

Comments
 (0)