basecamp-cli-mcp 0.6.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- basecamp_cli_mcp/__init__.py +6 -0
- basecamp_cli_mcp/cli.py +80 -0
- basecamp_cli_mcp/data/tools.json +18543 -0
- basecamp_cli_mcp/generator.py +168 -0
- basecamp_cli_mcp/help_parser.py +169 -0
- basecamp_cli_mcp/runner.py +189 -0
- basecamp_cli_mcp/server.py +102 -0
- basecamp_cli_mcp/setup_cmd.py +142 -0
- basecamp_cli_mcp-0.6.0.dist-info/METADATA +161 -0
- basecamp_cli_mcp-0.6.0.dist-info/RECORD +12 -0
- basecamp_cli_mcp-0.6.0.dist-info/WHEEL +4 -0
- basecamp_cli_mcp-0.6.0.dist-info/entry_points.txt +2 -0
basecamp_cli_mcp/cli.py
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import argparse
|
|
4
|
+
import asyncio
|
|
5
|
+
import json
|
|
6
|
+
import sys
|
|
7
|
+
from importlib.resources import files
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
|
|
10
|
+
from . import __version__
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def main(argv: list[str] | None = None) -> int:
|
|
14
|
+
parser = argparse.ArgumentParser(
|
|
15
|
+
prog="basecamp-cli-mcp",
|
|
16
|
+
description="MCP server that wraps the basecamp CLI.",
|
|
17
|
+
)
|
|
18
|
+
parser.add_argument("--version", action="version", version=f"%(prog)s {__version__}")
|
|
19
|
+
parser.add_argument(
|
|
20
|
+
"--include",
|
|
21
|
+
action="append",
|
|
22
|
+
default=None,
|
|
23
|
+
metavar="PATTERN",
|
|
24
|
+
help=(
|
|
25
|
+
"Only expose tools whose name matches PATTERN (fnmatch glob). "
|
|
26
|
+
"Repeatable. Example: --include 'cards_*' --include 'todos_*'."
|
|
27
|
+
),
|
|
28
|
+
)
|
|
29
|
+
parser.add_argument(
|
|
30
|
+
"--exclude",
|
|
31
|
+
action="append",
|
|
32
|
+
default=None,
|
|
33
|
+
metavar="PATTERN",
|
|
34
|
+
help="Hide tools whose name matches PATTERN. Repeatable. Applied after --include.",
|
|
35
|
+
)
|
|
36
|
+
sub = parser.add_subparsers(dest="command")
|
|
37
|
+
|
|
38
|
+
gen = sub.add_parser("generate", help="Regenerate data/tools.json from the basecamp CLI.")
|
|
39
|
+
gen.add_argument(
|
|
40
|
+
"--output",
|
|
41
|
+
type=Path,
|
|
42
|
+
default=None,
|
|
43
|
+
help="Path to write tools.json (default: in-tree data/tools.json next to this package).",
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
sub.add_parser(
|
|
47
|
+
"setup",
|
|
48
|
+
help="Install the basecamp CLI (if missing) and run `basecamp setup` to authenticate.",
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
args = parser.parse_args(argv)
|
|
52
|
+
|
|
53
|
+
if args.command == "generate":
|
|
54
|
+
return _generate(args.output)
|
|
55
|
+
|
|
56
|
+
if args.command == "setup":
|
|
57
|
+
from .setup_cmd import run as run_setup
|
|
58
|
+
|
|
59
|
+
return run_setup()
|
|
60
|
+
|
|
61
|
+
from . import server
|
|
62
|
+
|
|
63
|
+
asyncio.run(server.run(include=args.include, exclude=args.exclude))
|
|
64
|
+
return 0
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def _generate(output: Path | None) -> int:
|
|
68
|
+
from .generator import Generator
|
|
69
|
+
|
|
70
|
+
tools = Generator().generate()
|
|
71
|
+
if output is None:
|
|
72
|
+
output = Path(str(files("basecamp_cli_mcp") / "data" / "tools.json"))
|
|
73
|
+
output.parent.mkdir(parents=True, exist_ok=True)
|
|
74
|
+
output.write_text(json.dumps(tools, indent=2) + "\n", encoding="utf-8")
|
|
75
|
+
print(f"Wrote {len(tools)} tools to {output}", file=sys.stderr)
|
|
76
|
+
return 0
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
if __name__ == "__main__":
|
|
80
|
+
raise SystemExit(main())
|