diff --git a/.gitignore b/.gitignore index 521903f..68b4606 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,9 @@ env/ # IDE .vscode/ +!.vscode/ +.vscode/* +!.vscode/mcp.json .idea/ *.swp *.swo @@ -84,4 +87,4 @@ site/ *.log *.tmp temp/ -tmp/ \ No newline at end of file +tmp/ diff --git a/.vscode/mcp.json b/.vscode/mcp.json new file mode 100644 index 0000000..6f5220c --- /dev/null +++ b/.vscode/mcp.json @@ -0,0 +1,12 @@ +{ + "mcpServers": { + "shortkit-ml": { + "type": "stdio", + "command": ".venv/bin/python", + "args": [ + "-m", + "shortcut_detect.mcp_server" + ] + } + } +} diff --git a/README.md b/README.md index 517fcfc..91c9eca 100644 --- a/README.md +++ b/README.md @@ -177,13 +177,13 @@ Custom conditions can be registered via `@register_condition("name")`. See [Cond ## MCP Server -ShortKit-ML ships an [MCP](https://modelcontextprotocol.io/) server so AI assistants (Claude, Cursor, etc.) can call detection tools directly from chat — no Python script required. +ShortKit-ML ships an [MCP](https://modelcontextprotocol.io/) server so AI assistants (Claude, Cursor, GitHub Copilot in VS Code, etc.) can call detection tools directly from chat — no Python script required. ```bash uv pip install -e ".[mcp]" ``` -Full setup instructions for **Claude Code** and **Claude Desktop**, available tools, file-based input, and troubleshooting: [**criticaldata.github.io/ShortKit-ML/mcp-server**](https://criticaldata.github.io/ShortKit-ML/mcp-server/). +Full setup instructions for **Claude Code**, **Claude Desktop**, and **GitHub Copilot in VS Code**, available tools, file-based input, and troubleshooting: [**criticaldata.github.io/ShortKit-ML/mcp-server**](https://criticaldata.github.io/ShortKit-ML/mcp-server/). ## Paper Benchmark Datasets diff --git a/docs/mcp-server.md b/docs/mcp-server.md index a189313..4f922bc 100644 --- a/docs/mcp-server.md +++ b/docs/mcp-server.md @@ -1,6 +1,6 @@ # MCP Server -ShortKit-ML ships a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) server that exposes shortcut detection as callable tools. AI assistants like Claude can run full analyses — generate data, run detectors, compare methods — directly from chat, with no Python script required. +ShortKit-ML ships a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) server that exposes shortcut detection as callable tools. AI assistants like Claude and GitHub Copilot in VS Code can run full analyses — generate data, run detectors, compare methods — directly from chat, with no Python script required. ## Prerequisites @@ -18,8 +18,6 @@ uv run python -m shortcut_detect.mcp_server The server should start without errors. Press `Ctrl+C` to stop it. ---- - ## Option 1 — Claude Code (recommended) Claude Code reads a `.mcp.json` file from the project root. This file is already committed to the repo, so no manual setup is needed after installing the package. @@ -113,6 +111,36 @@ Once connected, you can run all 19 detection methods on synthetic data directly --- +## Option 3 — GitHub Copilot in VS Code + +GitHub Copilot Chat in VS Code can consume MCP servers directly in Agent mode. This repository includes a checked-in `.vscode/mcp.json` template so the ShortKit-ML server is ready to use once your `.venv` is installed. + +### 1. Install dependencies + +```bash +uv pip install -e ".[mcp]" +``` + +### 2. Open the workspace in VS Code + +Make sure the repo root is open so VS Code can read `.vscode/mcp.json`. + +### 3. Start Copilot Chat in Agent mode + +Open Copilot Chat, switch the mode dropdown to **Agent**, and click the tools icon. Under the `shortkit-ml` MCP server, you should see the ShortKit-ML tools. + +### 4. Try a prompt + +```text +Generate 200 synthetic samples with a linear shortcut and run probe, statistical, and hbac on them. +``` + +### 5. If you need to customize the Python path + +Edit `.vscode/mcp.json` and point `command` at your workspace `.venv/bin/python` path. Use the same `shortcut_detect.mcp_server` module entry point as Claude Code and Claude Desktop. + +--- + ## Quick start — how to use the tools Once connected, the tools are **automatic** — Claude calls them for you based on what you ask. You never invoke them by name. Just describe what you want in plain English. diff --git a/tests/test_copilot_mcp_config.py b/tests/test_copilot_mcp_config.py new file mode 100644 index 0000000..d572050 --- /dev/null +++ b/tests/test_copilot_mcp_config.py @@ -0,0 +1,21 @@ +"""Tests for the checked-in Copilot / MCP workspace configuration.""" + +import json +from pathlib import Path + + +def test_vscode_mcp_config_matches_project_entrypoint(): + root = Path(__file__).resolve().parents[1] + claude_config = json.loads((root / ".mcp.json").read_text(encoding="utf-8")) + vscode_config = json.loads((root / ".vscode" / "mcp.json").read_text(encoding="utf-8")) + + claude_server = claude_config["mcpServers"]["shortkit-ml"] + vscode_server = vscode_config["mcpServers"]["shortkit-ml"] + + assert claude_server["type"] == "stdio" + assert vscode_server["type"] == "stdio" + assert claude_server["command"] == vscode_server["command"] == ".venv/bin/python" + assert claude_server["args"] == vscode_server["args"] == [ + "-m", + "shortcut_detect.mcp_server", + ]