|
1 | 1 | # MCP Server |
2 | 2 |
|
3 | | -The [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) is an open standard that allows AI assistants to interact with external tools and data sources. The `pred` CLI includes a built-in MCP server that exposes the full reduction graph, problem creation, solving, and reduction capabilities to any MCP-compatible AI assistant (such as Claude Code, Cursor, Windsurf, or OpenCode). |
| 3 | +The [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) is an open standard that allows AI assistants to interact with external tools and data sources. The `pred` CLI includes a built-in MCP server that exposes the full reduction graph, problem creation, solving, and reduction capabilities to any MCP-compatible AI assistant. |
| 4 | + |
| 5 | +## Setup |
| 6 | + |
| 7 | +Install the `pred` CLI, then configure your AI assistant: |
| 8 | + |
| 9 | +```bash |
| 10 | +cargo install problemreductions-cli |
| 11 | +``` |
| 12 | + |
| 13 | +**Claude Code:** |
| 14 | + |
| 15 | +```bash |
| 16 | +claude mcp add --scope user problemreductions -- pred mcp |
| 17 | +``` |
| 18 | + |
| 19 | +**Cursor / Windsurf** — add to `.cursor/mcp.json` or `~/.codeium/windsurf/mcp_config.json`: |
| 20 | + |
| 21 | +```json |
| 22 | +{ "mcpServers": { "problemreductions": { "command": "pred", "args": ["mcp"] } } } |
| 23 | +``` |
| 24 | + |
| 25 | +**OpenCode** — add to `opencode.json`: |
| 26 | + |
| 27 | +```json |
| 28 | +{ "mcp": { "problemreductions": { "type": "local", "command": ["pred", "mcp"] } } } |
| 29 | +``` |
| 30 | + |
| 31 | +Restart your AI assistant after configuration. |
4 | 32 |
|
5 | 33 | ## Walkthrough |
6 | 34 |
|
7 | | -A complete session showing how an AI assistant uses MCP tools behind the scenes to answer your questions. |
| 35 | +A complete Claude Code session showing how the AI assistant uses MCP tools behind the scenes to answer your questions. |
8 | 36 |
|
9 | 37 | **You:** Create a weighted MIS problem on a 4-vertex graph with edges 0-1, 1-2, 2-3, 3-0, 0-2 and weights [1, 2, 3, 4], explain the result. |
10 | 38 |
|
@@ -40,56 +68,6 @@ A complete session showing how an AI assistant uses MCP tools behind the scenes |
40 | 68 | > |
41 | 69 | > The QUBO objective of -6.0 corresponds to the MIS maximum of 6 — the reduction correctly inverts the sign. This confirms that {1, 3} is the optimal independent set. |
42 | 70 |
|
43 | | -## Installation |
44 | | -
|
45 | | -Install via cargo: |
46 | | -
|
47 | | -```bash |
48 | | -cargo install problemreductions-cli |
49 | | -``` |
50 | | -
|
51 | | -Or build from source: |
52 | | - |
53 | | -```bash |
54 | | -git clone https://github.com/CodingThrust/problem-reductions |
55 | | -cd problem-reductions |
56 | | -make cli # builds and installs target/release/pred |
57 | | -``` |
58 | | - |
59 | | -## Configuration |
60 | | - |
61 | | -### Claude Code |
62 | | - |
63 | | -```bash |
64 | | -# Project-scoped (current project only) |
65 | | -claude mcp add --scope project problemreductions -- pred mcp |
66 | | - |
67 | | -# User-scoped (all projects) |
68 | | -claude mcp add --scope user problemreductions -- pred mcp |
69 | | -``` |
70 | | - |
71 | | -### Cursor / Windsurf |
72 | | - |
73 | | -Add to the appropriate config file: |
74 | | -- **Cursor:** `.cursor/mcp.json` (project) or `~/.cursor/mcp.json` (global) |
75 | | -- **Windsurf:** `~/.codeium/windsurf/mcp_config.json` |
76 | | - |
77 | | -```json |
78 | | -{ "mcpServers": { "problemreductions": { "command": "pred", "args": ["mcp"] } } } |
79 | | -``` |
80 | | - |
81 | | -### OpenCode |
82 | | - |
83 | | -Add to `opencode.json` in your project root: |
84 | | - |
85 | | -```json |
86 | | -{ "mcp": { "problemreductions": { "type": "local", "command": ["pred", "mcp"] } } } |
87 | | -``` |
88 | | - |
89 | | -### Generic MCP Client |
90 | | - |
91 | | -Any MCP client that supports the stdio transport can connect by running `pred mcp`. The server communicates over stdin/stdout using the MCP JSON-RPC protocol. |
92 | | - |
93 | 71 | ## Available Tools |
94 | 72 |
|
95 | 73 | The MCP server provides 10 tools organized into two categories: **graph query tools** for exploring the reduction graph, and **instance tools** for working with concrete problem instances. |
|
0 commit comments