@gopersonal/advisor 1.0.3 → 1.0.4
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.
- package/README.md +62 -21
- package/build/index.js +5 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,47 +7,64 @@ An MCP server that gives AI agents access to a separate AI advisor via [OpenCode
|
|
|
7
7
|
- **ask_advisor** — Get help when stuck after multiple failed attempts
|
|
8
8
|
- **get_second_opinion** — Sanity-check a decision between approaches
|
|
9
9
|
|
|
10
|
-
##
|
|
11
|
-
|
|
12
|
-
### Option A: OpenAI endpoint
|
|
10
|
+
## Quick Start
|
|
13
11
|
|
|
14
12
|
```bash
|
|
15
13
|
claude mcp add advisor \
|
|
16
14
|
-e ADVISOR_PROVIDER=openai \
|
|
17
15
|
-e ADVISOR_MODEL=gpt-4o \
|
|
18
16
|
-e ADVISOR_API_KEY=sk-your-key \
|
|
17
|
+
-e ADVISOR_BASE_URL=https://api.openai.com/v1 \
|
|
19
18
|
-- npx -y @gopersonal/advisor
|
|
20
19
|
```
|
|
21
20
|
|
|
22
|
-
|
|
21
|
+
## Setup
|
|
22
|
+
|
|
23
|
+
### Option A: OpenAI-compatible endpoint
|
|
24
|
+
|
|
25
|
+
Works with OpenAI, MiniMax, Together, Groq, and any `/v1/chat/completions` endpoint.
|
|
23
26
|
|
|
24
27
|
```bash
|
|
25
28
|
claude mcp add advisor \
|
|
26
29
|
-e ADVISOR_PROVIDER=openai \
|
|
27
30
|
-e ADVISOR_MODEL=gpt-4o \
|
|
28
31
|
-e ADVISOR_API_KEY=sk-your-key \
|
|
29
|
-
-e ADVISOR_BASE_URL=https://
|
|
32
|
+
-e ADVISOR_BASE_URL=https://api.openai.com/v1 \
|
|
33
|
+
-- npx -y @gopersonal/advisor
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Example with MiniMax (tested):
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
claude mcp add advisor \
|
|
40
|
+
-e ADVISOR_PROVIDER=openai \
|
|
41
|
+
-e ADVISOR_MODEL=MiniMax-M2.5 \
|
|
42
|
+
-e ADVISOR_API_KEY=sk-your-minimax-key \
|
|
43
|
+
-e ADVISOR_BASE_URL=https://api.minimax.io/v1 \
|
|
30
44
|
-- npx -y @gopersonal/advisor
|
|
31
45
|
```
|
|
32
46
|
|
|
33
|
-
### Option B: Anthropic endpoint
|
|
47
|
+
### Option B: Anthropic-compatible endpoint
|
|
48
|
+
|
|
49
|
+
Works with Anthropic and any `/v1/messages` endpoint.
|
|
34
50
|
|
|
35
51
|
```bash
|
|
36
52
|
claude mcp add advisor \
|
|
37
53
|
-e ADVISOR_PROVIDER=anthropic \
|
|
38
54
|
-e ADVISOR_MODEL=claude-sonnet-4-5 \
|
|
39
55
|
-e ADVISOR_API_KEY=sk-ant-your-key \
|
|
56
|
+
-e ADVISOR_BASE_URL=https://api.anthropic.com \
|
|
40
57
|
-- npx -y @gopersonal/advisor
|
|
41
58
|
```
|
|
42
59
|
|
|
43
|
-
|
|
60
|
+
Example with a proxy (tested):
|
|
44
61
|
|
|
45
62
|
```bash
|
|
46
63
|
claude mcp add advisor \
|
|
47
64
|
-e ADVISOR_PROVIDER=anthropic \
|
|
48
|
-
-e ADVISOR_MODEL=
|
|
65
|
+
-e ADVISOR_MODEL=gpt-5.2-codex \
|
|
49
66
|
-e ADVISOR_API_KEY=none \
|
|
50
|
-
-e ADVISOR_BASE_URL=https://
|
|
67
|
+
-e ADVISOR_BASE_URL=https://azure-openai-anthropic-proxy.go-shops.workers.dev \
|
|
51
68
|
-- npx -y @gopersonal/advisor
|
|
52
69
|
```
|
|
53
70
|
|
|
@@ -57,30 +74,54 @@ claude mcp add advisor \
|
|
|
57
74
|
claude mcp add advisor -- npx -y @gopersonal/advisor
|
|
58
75
|
```
|
|
59
76
|
|
|
77
|
+
### With project context and instructions
|
|
78
|
+
|
|
79
|
+
Give the advisor context about your project so it can provide more relevant advice:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
claude mcp add advisor \
|
|
83
|
+
-e ADVISOR_PROVIDER=anthropic \
|
|
84
|
+
-e ADVISOR_MODEL=gpt-5.2-codex \
|
|
85
|
+
-e ADVISOR_API_KEY=none \
|
|
86
|
+
-e ADVISOR_BASE_URL=https://azure-openai-anthropic-proxy.go-shops.workers.dev \
|
|
87
|
+
-e ADVISOR_DIRECTORY=/Users/me/myproject \
|
|
88
|
+
-e ADVISOR_INSTRUCTIONS=/Users/me/myproject/AGENTS.md \
|
|
89
|
+
-- npx -y @gopersonal/advisor
|
|
90
|
+
```
|
|
91
|
+
|
|
60
92
|
## Environment Variables
|
|
61
93
|
|
|
62
|
-
| Variable | Description | Example |
|
|
63
|
-
|
|
64
|
-
| `ADVISOR_PROVIDER` | `openai` or `anthropic` | `openai` |
|
|
65
|
-
| `ADVISOR_MODEL` | Model name | `gpt-4o`, `claude-sonnet-4-5` |
|
|
66
|
-
| `ADVISOR_API_KEY` | API key for the provider | `sk-...` |
|
|
67
|
-
| `ADVISOR_BASE_URL` |
|
|
68
|
-
| `ADVISOR_DIRECTORY` | Project directory for opencode context
|
|
69
|
-
| `ADVISOR_INSTRUCTIONS` | Path to instructions
|
|
94
|
+
| Variable | Required | Description | Example |
|
|
95
|
+
|---|---|---|---|
|
|
96
|
+
| `ADVISOR_PROVIDER` | Yes | `openai` or `anthropic` | `openai` |
|
|
97
|
+
| `ADVISOR_MODEL` | Yes | Model name | `gpt-4o`, `claude-sonnet-4-5` |
|
|
98
|
+
| `ADVISOR_API_KEY` | Yes | API key for the provider | `sk-...` |
|
|
99
|
+
| `ADVISOR_BASE_URL` | Yes | API base URL | `https://api.openai.com/v1` |
|
|
100
|
+
| `ADVISOR_DIRECTORY` | No | Project directory for opencode context | `/Users/me/myproject` |
|
|
101
|
+
| `ADVISOR_INSTRUCTIONS` | No | Path to instructions file (AGENTS.md, etc.) | `/Users/me/myproject/AGENTS.md` |
|
|
70
102
|
|
|
71
|
-
`
|
|
72
|
-
`
|
|
103
|
+
- `ADVISOR_PROVIDER` determines the API format: `openai` uses `/v1/chat/completions`, `anthropic` uses `/v1/messages`
|
|
104
|
+
- `ADVISOR_DIRECTORY` gives the advisor access to your project files and structure
|
|
105
|
+
- `ADVISOR_INSTRUCTIONS` loads a custom instructions file so the advisor knows your project conventions
|
|
73
106
|
|
|
74
107
|
If no env vars are set, the advisor connects to a running opencode instance or starts one using your default opencode config.
|
|
75
108
|
|
|
76
109
|
## How it works
|
|
77
110
|
|
|
78
111
|
1. Agent calls `ask_advisor` or `get_second_opinion` via MCP
|
|
79
|
-
2. The server creates a temporary OpenCode session
|
|
112
|
+
2. The server creates a temporary OpenCode session (scoped to `ADVISOR_DIRECTORY` if set)
|
|
80
113
|
3. Sends the prompt asynchronously, polls for the response
|
|
81
114
|
4. Auto-answers any interactive questions from the OpenCode agent
|
|
82
115
|
5. Returns the advisor's response and cleans up the session
|
|
83
116
|
|
|
117
|
+
## Tested configurations
|
|
118
|
+
|
|
119
|
+
| Provider | Model | Base URL | Status |
|
|
120
|
+
|---|---|---|---|
|
|
121
|
+
| `anthropic` | `gpt-5.2-codex` | `azure-openai-anthropic-proxy.go-shops.workers.dev` | Working |
|
|
122
|
+
| `openai` | `MiniMax-M2.5` | `api.minimax.io/v1` | Working |
|
|
123
|
+
| `anthropic` | `gpt-5.2-codex` | proxy + `ADVISOR_DIRECTORY` + `ADVISOR_INSTRUCTIONS` | Working |
|
|
124
|
+
|
|
84
125
|
## Requirements
|
|
85
126
|
|
|
86
127
|
- [OpenCode](https://opencode.ai) installed (`brew install sst/tap/opencode` or `npm i -g opencode`)
|
|
@@ -108,7 +149,7 @@ claude mcp add advisor -- node /path/to/advisor/build/index.js
|
|
|
108
149
|
npm login
|
|
109
150
|
```
|
|
110
151
|
|
|
111
|
-
2. Update the version
|
|
152
|
+
2. Update the version:
|
|
112
153
|
|
|
113
154
|
```bash
|
|
114
155
|
npm version patch # 1.0.0 -> 1.0.1 (bug fixes)
|
package/build/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
|
3
3
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { createOpencode, createOpencodeClient } from "@opencode-ai/sdk/v2";
|
|
6
|
+
import { existsSync } from "fs";
|
|
6
7
|
// --- Environment-based configuration ---
|
|
7
8
|
//
|
|
8
9
|
// Pass these via the "env" field in the MCP config JSON.
|
|
@@ -68,7 +69,8 @@ function buildOpencodeConfig() {
|
|
|
68
69
|
const apiKey = process.env.ADVISOR_API_KEY;
|
|
69
70
|
const baseURL = process.env.ADVISOR_BASE_URL;
|
|
70
71
|
const npm = process.env.ADVISOR_NPM || resolved?.npm;
|
|
71
|
-
const
|
|
72
|
+
const instructionsPath = process.env.ADVISOR_INSTRUCTIONS;
|
|
73
|
+
const instructions = instructionsPath && existsSync(instructionsPath) ? instructionsPath : undefined;
|
|
72
74
|
const config = {
|
|
73
75
|
// Disable title generation (it uses small_model which may not work with custom providers)
|
|
74
76
|
small_model: resolved?.fullModel || undefined,
|
|
@@ -77,6 +79,8 @@ function buildOpencodeConfig() {
|
|
|
77
79
|
};
|
|
78
80
|
if (instructions)
|
|
79
81
|
console.error(`[advisor] Instructions: ${instructions}`);
|
|
82
|
+
if (instructionsPath && !instructions)
|
|
83
|
+
console.error(`[advisor] Instructions file not found: ${instructionsPath}, skipping`);
|
|
80
84
|
if (resolved) {
|
|
81
85
|
config.model = resolved.fullModel;
|
|
82
86
|
console.error(`[advisor] Provider: ${resolved.provider}, Model: ${resolved.model}`);
|