diff --git a/.gitignore b/.gitignore index f87909d..29a2f58 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ output.json config/*.db aigpt +mcp/scripts/__* diff --git a/README.md b/README.md index 2db50e4..c3b84c0 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ $ ./aigpt mcp chat "hello world!" --host http://localhost:11434 --model syui/ai --- # openai api -$ ./aigpt mcp set-api -api sk-abc123 +$ ./aigpt mcp set-api --api sk-abc123 $ ./aigpt mcp chat "こんにちは" -p openai -m gpt-4o-mini --- diff --git a/mcp/cli.py b/mcp/cli.py index 5164c4c..9949254 100644 --- a/mcp/cli.py +++ b/mcp/cli.py @@ -1,3 +1,28 @@ # cli.py +import sys +import subprocess +from pathlib import Path + +SCRIPT_DIR = Path.home() / ".config" / "aigpt" / "mcp" / "scripts" +def run_script(name): + script_path = SCRIPT_DIR / f"{name}.py" + if not script_path.exists(): + print(f"❌ スクリプトが見つかりません: {script_path}") + sys.exit(1) + + args = sys.argv[2:] # ← "ask" の後の引数を取り出す + result = subprocess.run(["python", str(script_path)] + args, capture_output=True, text=True) + print(result.stdout) + if result.stderr: + print(result.stderr) def main(): - print("Hello MCP!") + if len(sys.argv) < 2: + print("Usage: mcp