-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmcp_server.py
More file actions
45 lines (33 loc) · 1.2 KB
/
Copy pathmcp_server.py
File metadata and controls
45 lines (33 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
"""
MCP server entry point for deploydiff.
Starts an MCP stdio server that exposes all CLI commands as AI-callable tools.
Usage:
deploydiff mcp # integrated subcommand
deploydiff-mcp # standalone entry point
"""
from __future__ import annotations
def run_mcp() -> None:
"""Start the MCP stdio server (entry point for console_scripts)."""
try:
import click_to_mcp
except ImportError:
import sys
print(
"Error: click-to-mcp is not installed. Install it with: pip install git+https://github.com/Coding-Dev-Tools/click-to-mcp.git",
file=sys.stderr,
)
sys.exit(1)
from deploydiff.cli import main
click_to_mcp.run(main, prefix="dd")
def run_for_app(app: object) -> None:
"""Start the MCP server for a given Click app (injected by cli.py)."""
try:
import click_to_mcp
except ImportError:
import sys
print(
"Error: click-to-mcp is not installed. Install it with: pip install git+https://github.com/Coding-Dev-Tools/click-to-mcp.git",
file=sys.stderr,
)
sys.exit(1)
click_to_mcp.run(app, prefix="dd")