exponential-mcp 0.12.1 → 0.13.1
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 +89 -41
- package/dist/agentGuidance.d.ts +15 -0
- package/dist/agentGuidance.js +59 -0
- package/dist/cli.js +50 -52
- package/dist/clientConfig.d.ts +53 -0
- package/dist/clientConfig.js +103 -0
- package/dist/index.js +5 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -6,6 +6,8 @@ Connect Claude to your [Exponential](https://exponential.im) workspace. Manage p
|
|
|
6
6
|
|
|
7
7
|
## Quick Start
|
|
8
8
|
|
|
9
|
+
You need [Node.js](https://nodejs.org) 18 or later and an Exponential account. Setup is two steps: create an agent, then connect your app.
|
|
10
|
+
|
|
9
11
|
### 1. Create an Agent
|
|
10
12
|
|
|
11
13
|
Open [exponential.im/settings/agents/new](https://www.exponential.im/settings/agents/new):
|
|
@@ -15,38 +17,61 @@ Open [exponential.im/settings/agents/new](https://www.exponential.im/settings/ag
|
|
|
15
17
|
|
|
16
18
|
The agent is its own identity: what Claude does in Exponential is attributed to it, not to you.
|
|
17
19
|
|
|
18
|
-
### 2.
|
|
20
|
+
### 2. Connect Your App
|
|
21
|
+
|
|
22
|
+
Find your app below. `<key>` is the key from step 1.
|
|
23
|
+
|
|
24
|
+
#### Claude Desktop
|
|
19
25
|
|
|
20
26
|
```bash
|
|
21
27
|
npx exponential-mcp init
|
|
22
28
|
```
|
|
23
29
|
|
|
24
|
-
Paste the
|
|
30
|
+
Paste the key when prompted, then quit and reopen Claude Desktop. `init` saves the key on this machine and adds the server to Claude Desktop's config file on macOS, Windows and Linux.
|
|
25
31
|
|
|
26
|
-
|
|
32
|
+
#### Claude Code
|
|
27
33
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
34
|
+
```bash
|
|
35
|
+
claude mcp add --scope user exponential -e EXPONENTIAL_API_KEY=<key> -- npx -y exponential-mcp serve
|
|
36
|
+
```
|
|
31
37
|
|
|
32
|
-
|
|
33
|
-
- The server uses `.mcp.json` in your project directory
|
|
34
|
-
- Reload your VSCode window (`Cmd+Shift+P` → "Developer: Reload Window")
|
|
35
|
-
- The server will be available in your current project
|
|
38
|
+
`--scope user` makes the server available in every project. Leave it out to add the server to the current project only.
|
|
36
39
|
|
|
37
|
-
|
|
40
|
+
#### Cursor
|
|
38
41
|
|
|
39
|
-
|
|
42
|
+
Add to `~/.cursor/mcp.json` (every project) or `.cursor/mcp.json` (one project):
|
|
40
43
|
|
|
41
|
-
|
|
44
|
+
```json
|
|
45
|
+
{
|
|
46
|
+
"mcpServers": {
|
|
47
|
+
"exponential": {
|
|
48
|
+
"command": "npx",
|
|
49
|
+
"args": ["-y", "exponential-mcp", "serve"],
|
|
50
|
+
"env": { "EXPONENTIAL_API_KEY": "<key>" }
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
```
|
|
42
55
|
|
|
43
|
-
|
|
56
|
+
#### VS Code
|
|
44
57
|
|
|
45
|
-
|
|
46
|
-
|
|
58
|
+
Add to `.vscode/mcp.json`. VS Code names the top-level key `servers`, not `mcpServers`:
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"servers": {
|
|
63
|
+
"exponential": {
|
|
64
|
+
"command": "npx",
|
|
65
|
+
"args": ["-y", "exponential-mcp", "serve"],
|
|
66
|
+
"env": { "EXPONENTIAL_API_KEY": "<key>" }
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
47
70
|
```
|
|
48
71
|
|
|
49
|
-
|
|
72
|
+
#### Codex
|
|
73
|
+
|
|
74
|
+
Add to `~/.codex/config.toml`:
|
|
50
75
|
|
|
51
76
|
```toml
|
|
52
77
|
[mcp_servers.exponential]
|
|
@@ -55,9 +80,27 @@ args = ["-y", "exponential-mcp", "serve"]
|
|
|
55
80
|
env = { EXPONENTIAL_API_KEY = "<key>" }
|
|
56
81
|
```
|
|
57
82
|
|
|
58
|
-
|
|
83
|
+
#### Any Other MCP Client
|
|
84
|
+
|
|
85
|
+
Run the command `npx` with the arguments `-y exponential-mcp serve`, and set the environment variable `EXPONENTIAL_API_KEY` to your key. The server speaks MCP over stdio.
|
|
86
|
+
|
|
87
|
+
### 3. Ask
|
|
88
|
+
|
|
89
|
+
Restart the app, then try: "What's on my plate today?"
|
|
90
|
+
|
|
91
|
+
## One Key per App
|
|
92
|
+
|
|
93
|
+
Create a separate agent for each app, so that what each app does in Exponential is attributed to its own agent. The config blocks above do this: each one carries its own key in `EXPONENTIAL_API_KEY`.
|
|
94
|
+
|
|
95
|
+
`init` works differently. It saves one key on the machine, and any app whose config has no `EXPONENTIAL_API_KEY` falls back to it. `EXPONENTIAL_API_KEY` always overrides the saved key.
|
|
96
|
+
|
|
97
|
+
To give Claude Desktop its own key, add `"env": { "EXPONENTIAL_API_KEY": "<key>" }` to the `exponential` entry in its config file (see [Claude Desktop by Hand](#claude-desktop-by-hand)). Re-running `init` rewrites that entry, including its `env`.
|
|
98
|
+
|
|
99
|
+
A personal API key from [Settings → API keys](https://www.exponential.im/settings/api-keys) also works in place of an agent key, but then the app acts as you.
|
|
59
100
|
|
|
60
|
-
|
|
101
|
+
### Self-Hosted Exponential
|
|
102
|
+
|
|
103
|
+
Point the server at your own instance with `npx exponential-mcp init --base-url https://your-host`, or set `EXPONENTIAL_API_URL` next to `EXPONENTIAL_API_KEY` in the app's config.
|
|
61
104
|
|
|
62
105
|
## What Claude Can Do
|
|
63
106
|
|
|
@@ -73,44 +116,47 @@ Once connected, Claude can:
|
|
|
73
116
|
- **Run the product backlog** – tickets, features, epics, stories, pages and decisions
|
|
74
117
|
- **Track time** – log, confirm and report on the day
|
|
75
118
|
|
|
76
|
-
##
|
|
119
|
+
## Claude Desktop by Hand
|
|
77
120
|
|
|
78
|
-
|
|
121
|
+
`npx exponential-mcp init` edits Claude Desktop's config file for you. To do it yourself, open the file for your platform:
|
|
79
122
|
|
|
80
|
-
|
|
81
|
-
|
|
123
|
+
| Platform | Config file |
|
|
124
|
+
|----------|-------------|
|
|
125
|
+
| macOS | `~/Library/Application Support/Claude/claude_desktop_config.json` |
|
|
126
|
+
| Windows | `%APPDATA%\Claude\claude_desktop_config.json` |
|
|
127
|
+
| Linux | `~/.config/Claude/claude_desktop_config.json` |
|
|
82
128
|
|
|
83
|
-
Add
|
|
129
|
+
Add the `exponential` entry under `mcpServers`, keeping any servers already there:
|
|
84
130
|
|
|
85
131
|
```json
|
|
86
132
|
{
|
|
87
133
|
"mcpServers": {
|
|
88
134
|
"exponential": {
|
|
89
|
-
"command": "
|
|
90
|
-
"args": ["
|
|
135
|
+
"command": "npx",
|
|
136
|
+
"args": ["-y", "exponential-mcp", "serve"],
|
|
137
|
+
"env": { "EXPONENTIAL_API_KEY": "<key>" }
|
|
91
138
|
}
|
|
92
139
|
}
|
|
93
140
|
}
|
|
94
141
|
```
|
|
95
142
|
|
|
96
|
-
|
|
143
|
+
Then quit and reopen Claude Desktop.
|
|
97
144
|
|
|
98
|
-
|
|
145
|
+
If you installed Node with nvm, fnm, asdf or similar, a bare `npx` will not work here: Claude Desktop does not start servers with your shell's `PATH`. Use the entry that `npx exponential-mcp doctor` prints. It names `npx` by its full path and puts Node's directory on `PATH`. `init` writes that same entry.
|
|
99
146
|
|
|
100
|
-
|
|
101
|
-
{
|
|
102
|
-
"mcpServers": {
|
|
103
|
-
"exponential": {
|
|
104
|
-
"command": "npx",
|
|
105
|
-
"args": ["-y", "exponential-mcp", "serve"]
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
```
|
|
147
|
+
## Troubleshooting
|
|
110
148
|
|
|
111
|
-
|
|
149
|
+
Start with `npx exponential-mcp doctor`. It checks the saved key and Claude Desktop's config, and prints a config entry that works on your machine.
|
|
112
150
|
|
|
113
|
-
|
|
151
|
+
| Symptom | Fix |
|
|
152
|
+
|---------|-----|
|
|
153
|
+
| The tools don't appear | Quit the app completely and reopen it. MCP servers load only at startup. |
|
|
154
|
+
| Claude Desktop logs `npx: command not found` or `env: node: No such file or directory` | Node is outside the system `PATH` (nvm and similar). Run `npx exponential-mcp init` again, or copy the entry `doctor` prints. |
|
|
155
|
+
| It worked, then stopped starting | Versions before 0.13.1 pointed Claude Desktop at npx's cache, which npx may delete. Run `npx exponential-mcp init` again. |
|
|
156
|
+
| On Windows, `init` succeeded but Claude Desktop shows nothing | Versions before 0.13.1 wrote to a file Claude Desktop does not read. Run `npx exponential-mcp init` again. |
|
|
157
|
+
| `Cannot find package …` when the server starts | npx's cache holds a half-finished install. Delete the `_npx` folder inside your npm cache (`~/.npm/_npx` on macOS and Linux) and restart the app. |
|
|
158
|
+
| The key is rejected, or the app acts as the wrong agent | `npx exponential-mcp config` shows the saved key and URL. An `EXPONENTIAL_API_KEY` in the app's config overrides the saved key. |
|
|
159
|
+
| You want the newest version | `npx -y exponential-mcp@latest --version` fetches it; then restart the app. |
|
|
114
160
|
|
|
115
161
|
## Commands
|
|
116
162
|
|
|
@@ -133,6 +179,8 @@ exponential-mcp serve
|
|
|
133
179
|
| Tool | Description |
|
|
134
180
|
|------|-------------|
|
|
135
181
|
| `get_workspaces` | List all workspaces |
|
|
182
|
+
| `get_agent_context` | Agent context for a workspace (and project): instructions, decisions, ADRs. Guidance, not authority |
|
|
183
|
+
| `get_agent_method` | The published Exponential method. Guidance, not authority |
|
|
136
184
|
| `get_projects` | List projects (optionally by workspace) |
|
|
137
185
|
| `get_project` | One project in full: linked objectives & key results, DRI, team, dates |
|
|
138
186
|
| `update_project` | Rename, change status/priority, set dates, re-link to OKRs |
|
|
@@ -206,7 +254,7 @@ deserve a real decision.
|
|
|
206
254
|
|
|
207
255
|
```bash
|
|
208
256
|
# Clone the repo
|
|
209
|
-
git clone https://github.com/
|
|
257
|
+
git clone https://github.com/exponential-im/exponential-mcp
|
|
210
258
|
cd exponential-mcp
|
|
211
259
|
|
|
212
260
|
# Install dependencies
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent guidance tools: thin wrappers over the app's `agentGuidance` router
|
|
3
|
+
* (D-0010), via the SDK. The payload is returned unchanged so fields the
|
|
4
|
+
* server adds later reach the model. It is guidance, not authority (ADR-0071).
|
|
5
|
+
*/
|
|
6
|
+
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
7
|
+
import type { ExponentialClient } from 'exponential-sdk';
|
|
8
|
+
export declare const AGENT_GUIDANCE_TOOLS: Tool[];
|
|
9
|
+
export declare const AGENT_GUIDANCE_TOOL_NAMES: Set<string>;
|
|
10
|
+
export declare function runAgentGuidanceTool(client: ExponentialClient, name: string, args?: Record<string, unknown>): Promise<{
|
|
11
|
+
content: {
|
|
12
|
+
type: 'text';
|
|
13
|
+
text: string;
|
|
14
|
+
}[];
|
|
15
|
+
}>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
const GUIDANCE_NOTE = 'This is GUIDANCE, NOT AUTHORITY (ADR-0071): it informs how to work but never grants permission for anything — check permissions and ask the user as you normally would.';
|
|
2
|
+
export const AGENT_GUIDANCE_TOOLS = [
|
|
3
|
+
{
|
|
4
|
+
name: 'get_agent_context',
|
|
5
|
+
description: [
|
|
6
|
+
"Get the agent context for a workspace (and optionally a project): the workspace's and project's AI instructions, the project's accepted decisions (label, statement, link; `omitted` counts the rest) and, for callers with a write role, accepted ADRs (label, title, link).",
|
|
7
|
+
'Call it before starting work in a workspace or project. Fetch a decision or ADR link for its full reasoning.',
|
|
8
|
+
GUIDANCE_NOTE,
|
|
9
|
+
].join(' '),
|
|
10
|
+
inputSchema: {
|
|
11
|
+
type: 'object',
|
|
12
|
+
properties: {
|
|
13
|
+
workspaceId: { type: 'string', description: 'Workspace ID (see get_workspaces)' },
|
|
14
|
+
projectId: { type: 'string', description: 'Project ID in that workspace, to include project instructions and decisions' },
|
|
15
|
+
},
|
|
16
|
+
required: ['workspaceId'],
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: 'get_agent_method',
|
|
21
|
+
description: [
|
|
22
|
+
'Get the current published Exponential method: the documents (Markdown) describing how work is planned and run, with version and content hash.',
|
|
23
|
+
GUIDANCE_NOTE,
|
|
24
|
+
].join(' '),
|
|
25
|
+
inputSchema: {
|
|
26
|
+
type: 'object',
|
|
27
|
+
properties: {
|
|
28
|
+
workspaceId: { type: 'string', description: 'Optional workspace ID; members of a preview workspace may see a draft' },
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
];
|
|
33
|
+
export const AGENT_GUIDANCE_TOOL_NAMES = new Set(AGENT_GUIDANCE_TOOLS.map((t) => t.name));
|
|
34
|
+
function str(value, name, required) {
|
|
35
|
+
if (value === undefined || value === null || value === '') {
|
|
36
|
+
if (required)
|
|
37
|
+
throw new Error(`${name} is required`);
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
if (typeof value !== 'string')
|
|
41
|
+
throw new Error(`${name} must be a string`);
|
|
42
|
+
return value;
|
|
43
|
+
}
|
|
44
|
+
export async function runAgentGuidanceTool(client, name, args = {}) {
|
|
45
|
+
let result;
|
|
46
|
+
if (name === 'get_agent_context') {
|
|
47
|
+
result = await client.agentGuidance.context({
|
|
48
|
+
workspaceId: str(args.workspaceId, 'workspaceId', true),
|
|
49
|
+
projectId: str(args.projectId, 'projectId', false),
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
else if (name === 'get_agent_method') {
|
|
53
|
+
result = await client.agentGuidance.method({ workspaceId: str(args.workspaceId, 'workspaceId', false) });
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
throw new Error(`Unknown agent guidance tool: ${name}`);
|
|
57
|
+
}
|
|
58
|
+
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
59
|
+
}
|
package/dist/cli.js
CHANGED
|
@@ -10,11 +10,18 @@ import { homedir } from 'os';
|
|
|
10
10
|
import { dirname, join } from 'path';
|
|
11
11
|
import * as readline from 'readline';
|
|
12
12
|
import { fileURLToPath } from 'url';
|
|
13
|
+
import { claudeDesktopConfigPath, diagnoseServerEntry, isClaudeDesktopInstalled, serverEntry, } from './clientConfig.js';
|
|
14
|
+
// Report the real package version rather than a hand-maintained literal that drifts.
|
|
15
|
+
const PKG_VERSION = JSON.parse(readFileSync(join(dirname(fileURLToPath(import.meta.url)), '..', 'package.json'), 'utf-8')).version;
|
|
13
16
|
const CONFIG_DIR = join(homedir(), '.config', 'exponential-mcp');
|
|
14
17
|
const LEGACY_CONFIG_PATH = join(CONFIG_DIR, 'config.json');
|
|
15
18
|
const configStore = createConfigStore({ projectName: 'exponential-mcp' });
|
|
16
|
-
const
|
|
17
|
-
|
|
19
|
+
const HOST = {
|
|
20
|
+
platform: process.platform,
|
|
21
|
+
home: homedir(),
|
|
22
|
+
env: process.env,
|
|
23
|
+
exists: existsSync,
|
|
24
|
+
};
|
|
18
25
|
function prompt(question) {
|
|
19
26
|
const rl = readline.createInterface({
|
|
20
27
|
input: process.stdin,
|
|
@@ -45,23 +52,16 @@ function migrateLegacyConfig() {
|
|
|
45
52
|
}
|
|
46
53
|
}
|
|
47
54
|
function getClaudeConfigPath() {
|
|
48
|
-
|
|
49
|
-
if (existsSync(MACOS_CLAUDE_CONFIG_PATH)) {
|
|
50
|
-
return MACOS_CLAUDE_CONFIG_PATH;
|
|
51
|
-
}
|
|
52
|
-
if (existsSync(LEGACY_CLAUDE_CONFIG_PATH)) {
|
|
53
|
-
return LEGACY_CLAUDE_CONFIG_PATH;
|
|
54
|
-
}
|
|
55
|
-
return MACOS_CLAUDE_CONFIG_PATH;
|
|
56
|
-
}
|
|
57
|
-
return LEGACY_CLAUDE_CONFIG_PATH;
|
|
55
|
+
return claudeDesktopConfigPath(HOST);
|
|
58
56
|
}
|
|
59
57
|
function getServerEntry() {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
58
|
+
return serverEntry(HOST, {
|
|
59
|
+
execPath: process.execPath,
|
|
60
|
+
serverPath: fileURLToPath(new URL('./index.js', import.meta.url)),
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
function printServerEntry() {
|
|
64
|
+
console.log(JSON.stringify({ mcpServers: { exponential: getServerEntry() } }, null, 2));
|
|
65
65
|
}
|
|
66
66
|
const DEFAULT_BASE_URL = 'https://www.exponential.im';
|
|
67
67
|
// Plain text when piped, so logs and CI output stay readable.
|
|
@@ -75,12 +75,14 @@ function printOtherAppsHelp() {
|
|
|
75
75
|
console.log('Create a separate agent for each app, then set its key in that app\'s');
|
|
76
76
|
console.log('MCP config. EXPONENTIAL_API_KEY overrides the key saved by init.\n');
|
|
77
77
|
console.log(` ${dim('Claude Code')}`);
|
|
78
|
-
console.log(' claude mcp add exponential -e EXPONENTIAL_API_KEY=<key> -- npx -y exponential-mcp serve\n');
|
|
78
|
+
console.log(' claude mcp add --scope user exponential -e EXPONENTIAL_API_KEY=<key> -- npx -y exponential-mcp serve\n');
|
|
79
79
|
console.log(` ${dim('Codex ~/.codex/config.toml')}`);
|
|
80
80
|
console.log(' [mcp_servers.exponential]');
|
|
81
81
|
console.log(' command = "npx"');
|
|
82
82
|
console.log(' args = ["-y", "exponential-mcp", "serve"]');
|
|
83
83
|
console.log(' env = { EXPONENTIAL_API_KEY = "<key>" }\n');
|
|
84
|
+
console.log(` ${dim('Cursor, VS Code and others')}`);
|
|
85
|
+
console.log(' https://github.com/exponential-im/exponential-mcp#quick-start\n');
|
|
84
86
|
console.log(dim('Restart the app afterwards. Re-running init resets the Claude Desktop entry.'));
|
|
85
87
|
}
|
|
86
88
|
function ensureParentDir(filePath) {
|
|
@@ -92,7 +94,7 @@ function ensureParentDir(filePath) {
|
|
|
92
94
|
program
|
|
93
95
|
.name('exponential-mcp')
|
|
94
96
|
.description('MCP server for Exponential - connect Claude to your productivity data')
|
|
95
|
-
.version(
|
|
97
|
+
.version(PKG_VERSION);
|
|
96
98
|
program
|
|
97
99
|
.command('init')
|
|
98
100
|
.description('Set up Exponential MCP with an agent key')
|
|
@@ -122,9 +124,13 @@ program
|
|
|
122
124
|
apiUrl: baseUrl,
|
|
123
125
|
});
|
|
124
126
|
console.log(`${green('✓')} Key saved ${dim(configStore.getConfigPath())}`);
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
127
|
+
const claudeDesktopReady = updateClaudeConfig();
|
|
128
|
+
if (claudeDesktopReady) {
|
|
129
|
+
console.log(`\n${bold('Done.')} Restart Claude Desktop, then ask: "What's on my plate today?"\n`);
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
console.log(`\n${bold('Key saved.')} Connect an app below, then ask: "What's on my plate today?"\n`);
|
|
133
|
+
}
|
|
128
134
|
printOtherAppsHelp();
|
|
129
135
|
console.log();
|
|
130
136
|
});
|
|
@@ -160,7 +166,6 @@ program
|
|
|
160
166
|
migrateLegacyConfig();
|
|
161
167
|
const issues = [];
|
|
162
168
|
const configPath = getClaudeConfigPath();
|
|
163
|
-
const recommended = getServerEntry();
|
|
164
169
|
console.log('🩺 Exponential MCP Doctor\n');
|
|
165
170
|
if (!configStore.isAuthenticated()) {
|
|
166
171
|
issues.push('No API key found. Run "exponential-mcp init" first.');
|
|
@@ -182,19 +187,7 @@ program
|
|
|
182
187
|
issues.push('No "exponential" entry found in Claude Desktop config.');
|
|
183
188
|
}
|
|
184
189
|
else {
|
|
185
|
-
|
|
186
|
-
issues.push('MCP config is missing "command" for Exponential.');
|
|
187
|
-
}
|
|
188
|
-
else if (!existsSync(serverConfig.command)) {
|
|
189
|
-
issues.push(`MCP command not found: ${serverConfig.command}`);
|
|
190
|
-
}
|
|
191
|
-
const serverArg = Array.isArray(serverConfig.args) ? serverConfig.args[0] : null;
|
|
192
|
-
if (!serverArg) {
|
|
193
|
-
issues.push('MCP config args missing server entry point.');
|
|
194
|
-
}
|
|
195
|
-
else if (!existsSync(serverArg)) {
|
|
196
|
-
issues.push(`MCP server entry not found: ${serverArg}`);
|
|
197
|
-
}
|
|
190
|
+
issues.push(...diagnoseServerEntry(serverConfig, existsSync));
|
|
198
191
|
}
|
|
199
192
|
if (issues.length === 0) {
|
|
200
193
|
console.log('✅ No issues found. Claude Desktop should load the Exponential MCP server.');
|
|
@@ -206,31 +199,36 @@ program
|
|
|
206
199
|
}
|
|
207
200
|
}
|
|
208
201
|
console.log('\nRecommended MCP config:\n');
|
|
209
|
-
|
|
210
|
-
mcpServers: {
|
|
211
|
-
exponential: recommended,
|
|
212
|
-
},
|
|
213
|
-
}, null, 2));
|
|
202
|
+
printServerEntry();
|
|
214
203
|
});
|
|
215
|
-
|
|
204
|
+
/** Adds the server to Claude Desktop's config. False when nothing was written. */
|
|
205
|
+
function updateClaudeConfig() {
|
|
216
206
|
const configPath = getClaudeConfigPath();
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
207
|
+
if (!isClaudeDesktopInstalled(HOST, configPath)) {
|
|
208
|
+
console.log(`${dim('-')} Claude Desktop ${dim(`not found at ${dirname(configPath)}, skipped`)}`);
|
|
209
|
+
return false;
|
|
210
|
+
}
|
|
211
|
+
let claudeConfig = {};
|
|
220
212
|
if (existsSync(configPath)) {
|
|
221
213
|
try {
|
|
222
214
|
claudeConfig = JSON.parse(readFileSync(configPath, 'utf-8'));
|
|
223
|
-
if (!claudeConfig.mcpServers) {
|
|
224
|
-
claudeConfig.mcpServers = {};
|
|
225
|
-
}
|
|
226
215
|
}
|
|
227
|
-
catch
|
|
228
|
-
|
|
216
|
+
catch {
|
|
217
|
+
// The file holds the user's other servers. Overwriting it would lose them.
|
|
218
|
+
console.log(`! Claude Desktop ${dim(configPath)}`);
|
|
219
|
+
console.log(' That file is not valid JSON, so it was left unchanged. Fix it and run init');
|
|
220
|
+
console.log(' again, or add this entry to it by hand:\n');
|
|
221
|
+
printServerEntry();
|
|
222
|
+
return false;
|
|
229
223
|
}
|
|
230
224
|
}
|
|
231
|
-
|
|
232
|
-
|
|
225
|
+
if (typeof claudeConfig !== 'object' || claudeConfig === null || Array.isArray(claudeConfig)) {
|
|
226
|
+
claudeConfig = {};
|
|
227
|
+
}
|
|
228
|
+
claudeConfig.mcpServers = { ...claudeConfig.mcpServers, exponential: getServerEntry() };
|
|
229
|
+
ensureParentDir(configPath);
|
|
233
230
|
writeFileSync(configPath, JSON.stringify(claudeConfig, null, 2));
|
|
234
231
|
console.log(`${green('✓')} Claude Desktop ${dim(configPath)}`);
|
|
232
|
+
return true;
|
|
235
233
|
}
|
|
236
234
|
program.parse();
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where Claude Desktop keeps its config, and what `init` writes there.
|
|
3
|
+
*
|
|
4
|
+
* Pure functions: the caller passes the platform, paths and an `exists` probe,
|
|
5
|
+
* so every branch (including Windows, from a Mac) is testable without touching
|
|
6
|
+
* the real filesystem.
|
|
7
|
+
*/
|
|
8
|
+
export interface Host {
|
|
9
|
+
platform: NodeJS.Platform;
|
|
10
|
+
home: string;
|
|
11
|
+
env: Record<string, string | undefined>;
|
|
12
|
+
exists: (path: string) => boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface ServerEntry {
|
|
15
|
+
command: string;
|
|
16
|
+
args: string[];
|
|
17
|
+
env?: Record<string, string>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The config file Claude Desktop reads on this platform.
|
|
21
|
+
*
|
|
22
|
+
* macOS keeps its old fallback to `~/.claude/` when only that file exists.
|
|
23
|
+
* Windows and Linux do not: earlier versions wrote there on those platforms
|
|
24
|
+
* and Claude Desktop never read it, so following it would repeat the bug.
|
|
25
|
+
*/
|
|
26
|
+
export declare function claudeDesktopConfigPath(host: Host): string;
|
|
27
|
+
/**
|
|
28
|
+
* Claude Desktop creates its config directory on first launch, so a missing
|
|
29
|
+
* directory means there is no Claude Desktop here to configure.
|
|
30
|
+
*/
|
|
31
|
+
export declare function isClaudeDesktopInstalled(host: Host, configPath: string): boolean;
|
|
32
|
+
/** npx unpacks into `~/.npm/_npx/<hash>/`, which it is free to delete. */
|
|
33
|
+
export declare function isNpxCachePath(path: string): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* The `mcpServers.exponential` entry for Claude Desktop.
|
|
36
|
+
*
|
|
37
|
+
* A global install or a clone has a stable path, so the entry runs it directly
|
|
38
|
+
* with this Node binary. Run through `npx`, this file sits in npx's cache: a
|
|
39
|
+
* path that disappears when the cache is cleared and never sees a new release.
|
|
40
|
+
* Then the entry calls `npx` instead.
|
|
41
|
+
*
|
|
42
|
+
* Claude Desktop does not start servers with the shell's PATH. Under nvm (or
|
|
43
|
+
* any Node outside the system directories) a bare `npx` is not found, and an
|
|
44
|
+
* absolute `npx` still fails with "env: node: No such file or directory",
|
|
45
|
+
* because npx and the server both start through `#!/usr/bin/env node`. So the
|
|
46
|
+
* entry names `npx` by absolute path and puts Node's directory on PATH.
|
|
47
|
+
*/
|
|
48
|
+
export declare function serverEntry(host: Pick<Host, 'platform' | 'exists'>, runtime: {
|
|
49
|
+
execPath: string;
|
|
50
|
+
serverPath: string;
|
|
51
|
+
}): ServerEntry;
|
|
52
|
+
/** What is wrong with an existing `mcpServers.exponential` entry, if anything. */
|
|
53
|
+
export declare function diagnoseServerEntry(entry: unknown, exists: (path: string) => boolean): string[];
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where Claude Desktop keeps its config, and what `init` writes there.
|
|
3
|
+
*
|
|
4
|
+
* Pure functions: the caller passes the platform, paths and an `exists` probe,
|
|
5
|
+
* so every branch (including Windows, from a Mac) is testable without touching
|
|
6
|
+
* the real filesystem.
|
|
7
|
+
*/
|
|
8
|
+
import { posix, win32 } from 'path';
|
|
9
|
+
const CONFIG_FILE = 'claude_desktop_config.json';
|
|
10
|
+
const NPX_ARGS = ['-y', 'exponential-mcp', 'serve'];
|
|
11
|
+
const POSIX_SYSTEM_PATH = ['/usr/local/bin', '/usr/bin', '/bin', '/usr/sbin', '/sbin'];
|
|
12
|
+
/**
|
|
13
|
+
* The config file Claude Desktop reads on this platform.
|
|
14
|
+
*
|
|
15
|
+
* macOS keeps its old fallback to `~/.claude/` when only that file exists.
|
|
16
|
+
* Windows and Linux do not: earlier versions wrote there on those platforms
|
|
17
|
+
* and Claude Desktop never read it, so following it would repeat the bug.
|
|
18
|
+
*/
|
|
19
|
+
export function claudeDesktopConfigPath(host) {
|
|
20
|
+
if (host.platform === 'win32') {
|
|
21
|
+
const appData = host.env.APPDATA ?? win32.join(host.home, 'AppData', 'Roaming');
|
|
22
|
+
return win32.join(appData, 'Claude', CONFIG_FILE);
|
|
23
|
+
}
|
|
24
|
+
if (host.platform === 'darwin') {
|
|
25
|
+
const current = posix.join(host.home, 'Library', 'Application Support', 'Claude', CONFIG_FILE);
|
|
26
|
+
const legacy = posix.join(host.home, '.claude', CONFIG_FILE);
|
|
27
|
+
return !host.exists(current) && host.exists(legacy) ? legacy : current;
|
|
28
|
+
}
|
|
29
|
+
const configHome = host.env.XDG_CONFIG_HOME ?? posix.join(host.home, '.config');
|
|
30
|
+
return posix.join(configHome, 'Claude', CONFIG_FILE);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Claude Desktop creates its config directory on first launch, so a missing
|
|
34
|
+
* directory means there is no Claude Desktop here to configure.
|
|
35
|
+
*/
|
|
36
|
+
export function isClaudeDesktopInstalled(host, configPath) {
|
|
37
|
+
const pathLib = host.platform === 'win32' ? win32 : posix;
|
|
38
|
+
return host.exists(configPath) || host.exists(pathLib.dirname(configPath));
|
|
39
|
+
}
|
|
40
|
+
/** npx unpacks into `~/.npm/_npx/<hash>/`, which it is free to delete. */
|
|
41
|
+
export function isNpxCachePath(path) {
|
|
42
|
+
return /[\\/]_npx[\\/]/.test(path);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The `mcpServers.exponential` entry for Claude Desktop.
|
|
46
|
+
*
|
|
47
|
+
* A global install or a clone has a stable path, so the entry runs it directly
|
|
48
|
+
* with this Node binary. Run through `npx`, this file sits in npx's cache: a
|
|
49
|
+
* path that disappears when the cache is cleared and never sees a new release.
|
|
50
|
+
* Then the entry calls `npx` instead.
|
|
51
|
+
*
|
|
52
|
+
* Claude Desktop does not start servers with the shell's PATH. Under nvm (or
|
|
53
|
+
* any Node outside the system directories) a bare `npx` is not found, and an
|
|
54
|
+
* absolute `npx` still fails with "env: node: No such file or directory",
|
|
55
|
+
* because npx and the server both start through `#!/usr/bin/env node`. So the
|
|
56
|
+
* entry names `npx` by absolute path and puts Node's directory on PATH.
|
|
57
|
+
*/
|
|
58
|
+
export function serverEntry(host, runtime) {
|
|
59
|
+
if (!isNpxCachePath(runtime.serverPath)) {
|
|
60
|
+
return { command: runtime.execPath, args: [runtime.serverPath] };
|
|
61
|
+
}
|
|
62
|
+
// The Node installer for Windows puts npx on the system PATH.
|
|
63
|
+
if (host.platform === 'win32') {
|
|
64
|
+
return { command: 'npx', args: [...NPX_ARGS] };
|
|
65
|
+
}
|
|
66
|
+
const nodeDir = posix.dirname(runtime.execPath);
|
|
67
|
+
const npx = posix.join(nodeDir, 'npx');
|
|
68
|
+
if (!host.exists(npx)) {
|
|
69
|
+
return { command: 'npx', args: [...NPX_ARGS] };
|
|
70
|
+
}
|
|
71
|
+
const path = [nodeDir, ...POSIX_SYSTEM_PATH.filter((dir) => dir !== nodeDir)].join(':');
|
|
72
|
+
return { command: npx, args: [...NPX_ARGS], env: { PATH: path } };
|
|
73
|
+
}
|
|
74
|
+
function isAbsolutePath(path) {
|
|
75
|
+
return posix.isAbsolute(path) || win32.isAbsolute(path);
|
|
76
|
+
}
|
|
77
|
+
/** What is wrong with an existing `mcpServers.exponential` entry, if anything. */
|
|
78
|
+
export function diagnoseServerEntry(entry, exists) {
|
|
79
|
+
const issues = [];
|
|
80
|
+
const { command, args } = (entry ?? {});
|
|
81
|
+
if (typeof command !== 'string' || command === '') {
|
|
82
|
+
issues.push('MCP config is missing "command" for Exponential.');
|
|
83
|
+
}
|
|
84
|
+
else if (isAbsolutePath(command) && !exists(command)) {
|
|
85
|
+
issues.push(`MCP command not found: ${command}`);
|
|
86
|
+
}
|
|
87
|
+
const argList = Array.isArray(args) ? args.filter((arg) => typeof arg === 'string') : [];
|
|
88
|
+
const runsThroughNpx = argList.some((arg) => arg === 'exponential-mcp' || arg.startsWith('exponential-mcp@'));
|
|
89
|
+
if (runsThroughNpx) {
|
|
90
|
+
return issues;
|
|
91
|
+
}
|
|
92
|
+
const serverPath = argList[0];
|
|
93
|
+
if (!serverPath) {
|
|
94
|
+
issues.push('MCP config args missing server entry point.');
|
|
95
|
+
}
|
|
96
|
+
else if (!exists(serverPath)) {
|
|
97
|
+
issues.push(`MCP server entry not found: ${serverPath}`);
|
|
98
|
+
}
|
|
99
|
+
else if (isNpxCachePath(serverPath)) {
|
|
100
|
+
issues.push(`MCP server entry is inside npx's cache, which npx may delete and which never updates: ${serverPath}`);
|
|
101
|
+
}
|
|
102
|
+
return issues;
|
|
103
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -12,6 +12,7 @@ import { homedir } from 'os';
|
|
|
12
12
|
import { dirname, join } from 'path';
|
|
13
13
|
import { fileURLToPath } from 'url';
|
|
14
14
|
import { DOMAINS, runDomainTool, toolDefinition } from './domains/index.js';
|
|
15
|
+
import { AGENT_GUIDANCE_TOOLS, AGENT_GUIDANCE_TOOL_NAMES, runAgentGuidanceTool } from './agentGuidance.js';
|
|
15
16
|
import { RUN_TOOLS, RUN_TOOL_NAMES, runContextFromEnv, runRunTool } from './runTools.js';
|
|
16
17
|
const LEGACY_CONFIG_PATH = join(homedir(), '.config', 'exponential-mcp', 'config.json');
|
|
17
18
|
// Report the real package version rather than a hand-maintained literal that drifts.
|
|
@@ -589,7 +590,7 @@ async function main() {
|
|
|
589
590
|
// the session gets the three run tools on top of everything else.
|
|
590
591
|
const runContext = runContextFromEnv();
|
|
591
592
|
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
592
|
-
tools: [...(runContext ? RUN_TOOLS : []), ...TOOLS, ...[...DOMAINS.values()].map(toolDefinition)],
|
|
593
|
+
tools: [...(runContext ? RUN_TOOLS : []), ...TOOLS, ...AGENT_GUIDANCE_TOOLS, ...[...DOMAINS.values()].map(toolDefinition)],
|
|
593
594
|
}));
|
|
594
595
|
// Handle tool calls
|
|
595
596
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
@@ -599,6 +600,9 @@ async function main() {
|
|
|
599
600
|
const result = await runRunTool(client, runContext, name, args);
|
|
600
601
|
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
601
602
|
}
|
|
603
|
+
if (AGENT_GUIDANCE_TOOL_NAMES.has(name)) {
|
|
604
|
+
return await runAgentGuidanceTool(client, name, args);
|
|
605
|
+
}
|
|
602
606
|
const domain = DOMAINS.get(name);
|
|
603
607
|
if (domain) {
|
|
604
608
|
const result = await runDomainTool(domain, client, args);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "exponential-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"description": "MCP server for Exponential - connect Claude to your projects, actions, goals, CRM, tickets and more",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"dev": "tsc --watch",
|
|
13
13
|
"start": "node dist/index.js",
|
|
14
14
|
"cli": "node dist/cli.js",
|
|
15
|
-
"prepublishOnly": "npm run build"
|
|
15
|
+
"prepublishOnly": "npm run build",
|
|
16
|
+
"test": "tsc && node --test test/*.test.mjs"
|
|
16
17
|
},
|
|
17
18
|
"keywords": [
|
|
18
19
|
"mcp",
|
|
@@ -34,7 +35,7 @@
|
|
|
34
35
|
"dependencies": {
|
|
35
36
|
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
36
37
|
"commander": "^12.0.0",
|
|
37
|
-
"exponential-sdk": "^1.
|
|
38
|
+
"exponential-sdk": "^1.32.0",
|
|
38
39
|
"zod": "^3.22.0",
|
|
39
40
|
"zod-to-json-schema": "^3.25.2"
|
|
40
41
|
},
|