@xmemo/client 0.4.163 → 0.4.165

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/LICENSE CHANGED
@@ -1,7 +1,21 @@
1
- Copyright (c) Yonro.
1
+ MIT License
2
2
 
3
- All rights reserved.
3
+ Copyright (c) 2025-2026 Yonro
4
4
 
5
- This package is published as a client distribution artifact for XMemo.
6
- No license is granted to copy, modify, distribute, sublicense, or use the source
7
- code except as expressly permitted by Yonro in a separate written agreement.
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -43,6 +43,8 @@ xmemo setup antigravity
43
43
  xmemo setup antigravity --dry-run
44
44
  xmemo setup kiro
45
45
  xmemo setup kiro --dry-run
46
+ xmemo setup grok
47
+ xmemo setup grok --dry-run
46
48
  xmemo mcp add antigravity2
47
49
  xmemo mcp add antigravity2 --write
48
50
  xmemo doctor
@@ -447,6 +449,38 @@ After setup, restart Kiro or reload MCP servers for the changes to take effect.
447
449
  The CLI refuses to overwrite an existing `XMemo`, `memory_os`, or `memory-os`
448
450
  MCP server entry. Edit the config manually if you need to rotate the endpoint.
449
451
 
452
+ ### Grok (xAI)
453
+
454
+ Recommended Grok setup:
455
+
456
+ ```bash
457
+ xmemo setup grok
458
+ ```
459
+
460
+ `setup grok` appends an XMemo MCP server to Grok's user config at
461
+ `~/.grok/config.toml` using Grok's TOML `[mcp_servers.XMemo]` format with `url`,
462
+ `bearer_token_env_var = "XMEMO_KEY"`, and an `[mcp_servers.XMemo.http_headers]`
463
+ table carrying `X-Memory-OS-Agent-ID`. Use `xmemo setup grok --dry-run` to
464
+ preview without writing.
465
+
466
+ Set your XMemo token with:
467
+
468
+ ```bash
469
+ xmemo login
470
+ # or
471
+ printf '%s\n' 'your-token' | xmemo token add --from-stdin
472
+ ```
473
+
474
+ Grok is also fully compatible with Claude Code: it automatically reads Claude
475
+ Code marketplaces, plugins, skills, and MCP servers. So `xmemo setup claude-code`
476
+ plus the repo's `.claude-plugin/`, `.mcp.json`, and `skills/` are discovered by
477
+ Grok with zero extra configuration. Use `xmemo setup grok` when you want the
478
+ server written directly into Grok's own `~/.grok/config.toml`.
479
+
480
+ After setup, restart Grok or run `/mcps` to reload MCP servers. The CLI refuses
481
+ to overwrite an existing `XMemo` MCP server entry; edit the config manually if
482
+ you need to rotate the endpoint.
483
+
450
484
  ### Antigravity 2.0
451
485
 
452
486
  Recommended Antigravity 2.0 setup:
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * XMemo MCP stdio server — thin local proxy for Glama quality tests and
4
+ * clients that only support stdio transport.
5
+ *
6
+ * Reads XMEMO_KEY and XMEMO_URL from environment, forwards all MCP
7
+ * JSON-RPC messages to the hosted endpoint over Streamable HTTP.
8
+ */
9
+ import { spawn } from 'node:child_process';
10
+ import { resolve, dirname } from 'node:path';
11
+ import { fileURLToPath } from 'node:url';
12
+
13
+ const __dirname = dirname(fileURLToPath(import.meta.url));
14
+ const mcpRemoteBin = resolve(__dirname, '..', 'node_modules', '.bin', 'mcp-remote');
15
+ const url = process.env.XMEMO_URL
16
+ ? `${process.env.XMEMO_URL.replace(/\/$/, '')}/mcp`
17
+ : 'https://xmemo.dev/mcp';
18
+ const token = process.env.XMEMO_KEY ?? '';
19
+
20
+ const args = [url];
21
+ if (token) {
22
+ args.push('--header', `Authorization:Bearer ${token}`);
23
+ }
24
+
25
+ const child = spawn(process.execPath, [mcpRemoteBin, ...args], {
26
+ stdio: ['inherit', 'inherit', 'inherit'],
27
+ env: { ...process.env }
28
+ });
29
+
30
+ child.on('exit', (code) => process.exit(code ?? 1));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xmemo/client",
3
- "version": "0.4.163",
3
+ "version": "0.4.165",
4
4
  "description": "Privacy-first CLI and MCP setup helper for XMemo.",
5
5
  "mcpName": "io.github.yonro/xmemo",
6
6
  "type": "module",
@@ -44,5 +44,5 @@
44
44
  "cli",
45
45
  "privacy"
46
46
  ],
47
- "license": "UNLICENSED"
47
+ "license": "MIT"
48
48
  }
@@ -13,10 +13,10 @@ Use XMemo when the task may depend on prior memory, durable project context, cod
13
13
  ## Workflow
14
14
 
15
15
  1. **Recall first** when prior context could change the answer. Use XMemo search/recall/context tools before making assumptions about preferences or past decisions.
16
- 2. **Save only durable information** that the user asks to remember or that is clearly useful across future Kiro sessions.
16
+ 2. **Save only durable information** that the user asks to remember or that is clearly useful across future sessions.
17
17
  3. **Keep memory content concise, scoped, and useful**. Prefer concrete facts, decisions, links to public docs, and action items over chat transcripts.
18
18
  4. **For destructive memory actions**, confirm the exact target before deleting, forgetting, or overwriting.
19
- 5. **If authorization errors occur**, ask the user to verify the `XMEMO_KEY` environment variable is set and to restart Kiro.
19
+ 5. **If authorization errors occur**, tell the user: "Run `xmemo login` or visit https://xmemo.dev to get your token, then set the `XMEMO_KEY` environment variable and restart Kiro."
20
20
 
21
21
  ## Good Memory Candidates
22
22
 
@@ -12,8 +12,10 @@ export {
12
12
  defaultCopilotConfigPath,
13
13
  defaultCursorConfigPath,
14
14
  defaultGeminiConfigPath,
15
+ defaultGrokConfigPath,
15
16
  defaultHermesConfigPath,
16
17
  defaultJetbrainsConfigPath,
18
+ defaultKimiCodeConfigPath,
17
19
  defaultKiroConfigPath,
18
20
  defaultOpencodeConfigPath,
19
21
  defaultOpenclawConfigPath,
@@ -131,6 +131,21 @@ export function profileClientConfig(clientId) {
131
131
  return path.join(userHome(env), '.kiro', 'steering', 'AGENTS.md');
132
132
  }
133
133
  },
134
+ 'kimi-code': {
135
+ label: 'Kimi Code',
136
+ setupAlias: 'kimi',
137
+ profileVersion: 'kimi-code-mcp-depth-v1',
138
+ requiredTokenEnv: TOKEN_ENV_VAR,
139
+ markerStart: CLIENT_PROFILE_MARKER_START,
140
+ markerEnd: CLIENT_PROFILE_MARKER_END,
141
+ defaultTarget: (env) => {
142
+ const isTest = env.HOME && (env.HOME.includes('memory-os-') || env.HOME.includes('test'));
143
+ if (!isTest && (existsSync(path.join(process.cwd(), '.kimi-code')) || existsSync(path.join(process.cwd(), '.git')) || existsSync(path.join(process.cwd(), 'package.json')))) {
144
+ return path.join(process.cwd(), '.kimi-code', 'AGENTS.md');
145
+ }
146
+ return path.join(userHome(env), '.kimi-code', 'AGENTS.md');
147
+ }
148
+ },
134
149
  'gemini-cli': {
135
150
  label: 'Gemini CLI',
136
151
  setupAlias: 'gemini',
@@ -222,7 +237,7 @@ export function profileClientConfig(clientId) {
222
237
  }
223
238
 
224
239
  export function supportedProfileClientIds() {
225
- return ['codex', 'cursor', 'kiro', 'gemini', 'antigravity', 'qwen', 'opencode', 'trae', 'trae-solo'];
240
+ return ['codex', 'cursor', 'kiro', 'kimi-code', 'gemini', 'antigravity', 'qwen', 'opencode', 'trae', 'trae-solo'];
226
241
  }
227
242
 
228
243
  export function defaultProfileTarget(clientId, env) {
@@ -11,6 +11,14 @@ export function createMcpClients(deps) {
11
11
  configKind: 'toml'
12
12
  });
13
13
 
14
+ clients.set('grok', {
15
+ label: 'Grok',
16
+ defaultConfigPath: deps.defaultGrokConfigPath,
17
+ buildSnippet: deps.grokTomlSnippet,
18
+ writeConfig: deps.appendGrokServerConfig,
19
+ configKind: 'toml'
20
+ });
21
+
14
22
  for (const definition of deps.JSON_MCP_CLIENT_DEFINITIONS) {
15
23
  if (definition.id === 'qwen') {
16
24
  clients.set('hermes', hermesClient(deps));
@@ -1,6 +1,8 @@
1
1
  import {
2
2
  appendTomlServerConfig,
3
- codexTomlSnippet
3
+ appendGrokServerConfig,
4
+ codexTomlSnippet,
5
+ grokTomlSnippet
4
6
  } from './formats/toml.js';
5
7
  import {
6
8
  hermesYamlSnippet,
@@ -23,8 +25,10 @@ import {
23
25
  defaultContinueConfigPath,
24
26
  defaultCursorConfigPath,
25
27
  defaultGeminiConfigPath,
28
+ defaultGrokConfigPath,
26
29
  defaultHermesConfigPath,
27
30
  defaultJetbrainsConfigPath,
31
+ defaultKimiCodeConfigPath,
28
32
  defaultKiroConfigPath,
29
33
  defaultOpencodeConfigPath,
30
34
  defaultOpenclawConfigPath,
@@ -45,6 +49,9 @@ export const MCP_CLIENTS = createMcpClients({
45
49
  defaultCodexConfigPath,
46
50
  codexTomlSnippet,
47
51
  appendTomlServerConfig,
52
+ defaultGrokConfigPath,
53
+ grokTomlSnippet,
54
+ appendGrokServerConfig,
48
55
  defaultHermesConfigPath,
49
56
  hermesYamlSnippet,
50
57
  mergeHermesMcpConfig,
@@ -64,6 +71,7 @@ export const MCP_CLIENTS = createMcpClients({
64
71
  defaultKiroConfigPath,
65
72
  defaultZedConfigPath,
66
73
  defaultJetbrainsConfigPath,
74
+ defaultKimiCodeConfigPath,
67
75
  defaultOpencodeConfigPath,
68
76
  defaultQwenConfigPath,
69
77
  defaultTraeConfigPath,
@@ -31,6 +31,7 @@ export const JSON_MCP_CLIENT_DEFINITIONS = Object.freeze([
31
31
  commandClientDefinition('claude-desktop', 'Claude Desktop', 'defaultClaudeConfigPath'),
32
32
  httpClientDefinition('openclaw', 'OpenClaw', 'defaultOpenclawConfigPath', { urlKey: 'url', authentication: 'env-bearer' }),
33
33
  commandClientDefinition('kiro', 'Kiro', 'defaultKiroConfigPath'),
34
+ httpClientDefinition('kimi-code', 'Kimi Code', 'defaultKimiCodeConfigPath', { urlKey: 'url', authentication: 'env-bearer' }),
34
35
  commandClientDefinition('zed', 'Zed', 'defaultZedConfigPath', { section: 'context_servers' }),
35
36
  nestedTransportClientDefinition('jetbrains', 'JetBrains', 'defaultJetbrainsConfigPath'),
36
37
  remoteClientDefinition('opencode', 'OpenCode', 'defaultOpencodeConfigPath'),
@@ -353,3 +354,8 @@ export const claudecodeJsonSnippet = (mcpUrl, identity = envReferenceIdentity('c
353
354
  export const claudecodeJsonServerConfig = (mcpUrl, identity = envReferenceIdentity('claude-code')) => jsonClientServerConfig('claude-code', mcpUrl, identity);
354
355
  export const mergeClaudecodeMcpConfig = (configPath, mcpUrl, identity) => mergeJsonClientMcpConfig('claude-code', configPath, mcpUrl, identity);
355
356
 
357
+ export const kimiCodeJsonConfig = (mcpUrl, identity = envReferenceIdentity('kimi-code')) => jsonClientConfig('kimi-code', mcpUrl, identity);
358
+ export const kimiCodeJsonSnippet = (mcpUrl, identity = envReferenceIdentity('kimi-code')) => jsonClientSnippet('kimi-code', mcpUrl, identity);
359
+ export const kimiCodeJsonServerConfig = (mcpUrl, identity = envReferenceIdentity('kimi-code')) => jsonClientServerConfig('kimi-code', mcpUrl, identity);
360
+ export const mergeKimiCodeMcpConfig = (configPath, mcpUrl, identity) => mergeJsonClientMcpConfig('kimi-code', configPath, mcpUrl, identity);
361
+
@@ -3,6 +3,9 @@ import path from 'node:path';
3
3
 
4
4
  import {
5
5
  COMMAND_NAME,
6
+ AGENT_ID_HEADER,
7
+ AGENT_INSTANCE_ENV_VAR,
8
+ AGENT_INSTANCE_HEADER,
6
9
  LEGACY_MCP_SERVER_NAMES,
7
10
  MCP_SERVER_NAME,
8
11
  TOKEN_ENV_VAR
@@ -18,13 +21,46 @@ import {
18
21
  } from '../../core/runtime.js';
19
22
  import { agentInstanceIdentityPath } from '../identity/device.js';
20
23
 
21
- export function codexTomlSnippet(mcpUrl) {
24
+ export function codexTomlSnippet(mcpUrl, identity) {
25
+ const agentId = identity?.agentId ?? 'codex';
26
+ const agentInstanceId = identity?.agentInstanceId ?? `\${${AGENT_INSTANCE_ENV_VAR}}`;
22
27
  return `[mcp_servers.${MCP_SERVER_NAME}]
23
28
  url = "${escapeTomlString(mcpUrl)}"
24
29
  bearer_token_env_var = "${TOKEN_ENV_VAR}"
30
+
31
+ [mcp_servers.${MCP_SERVER_NAME}.http_headers]
32
+ ${AGENT_ID_HEADER} = "${escapeTomlString(agentId)}"
33
+ ${AGENT_INSTANCE_HEADER} = "${escapeTomlString(agentInstanceId)}"
34
+ `;
35
+ }
36
+
37
+ export function grokTomlSnippet(mcpUrl, identity) {
38
+ const agentId = identity?.agentId ?? 'grok';
39
+ const agentInstanceId = identity?.agentInstanceId ?? `\${${AGENT_INSTANCE_ENV_VAR}}`;
40
+ return `[mcp_servers.${MCP_SERVER_NAME}]
41
+ url = "${escapeTomlString(mcpUrl)}"
42
+ bearer_token_env_var = "${TOKEN_ENV_VAR}"
43
+
44
+ [mcp_servers.${MCP_SERVER_NAME}.http_headers]
45
+ ${AGENT_ID_HEADER} = "${escapeTomlString(agentId)}"
46
+ ${AGENT_INSTANCE_HEADER} = "${escapeTomlString(agentInstanceId)}"
25
47
  `;
26
48
  }
27
49
 
50
+ export async function appendGrokServerConfig(configPath, mcpUrl, identity) {
51
+ const snippet = grokTomlSnippet(mcpUrl, identity);
52
+ const existing = await readTextIfExists(configPath);
53
+ const existingName = existingTomlMcpServerName(existing);
54
+ if (existingName) {
55
+ throw new UsageError(`MCP config already contains [mcp_servers.${existingName}]. Edit ${configPath} manually to avoid duplicate server definitions.`);
56
+ }
57
+
58
+ await fs.mkdir(path.dirname(configPath), { recursive: true, mode: 0o700 });
59
+ const prefix = existing.trim().length === 0 ? '' : '\n\n';
60
+ await fs.appendFile(configPath, `${prefix}${snippet}`, { mode: 0o600 });
61
+ await bestEffortChmod(configPath, 0o600);
62
+ }
63
+
28
64
  export async function codexSmokeReport(configPath, env) {
29
65
  const configText = await readTextIfExists(configPath);
30
66
  const serverBlock = findTomlServerBlock(configText);
@@ -91,8 +127,8 @@ export async function codexSmokeReport(configPath, env) {
91
127
  };
92
128
  }
93
129
 
94
- export async function appendTomlServerConfig(configPath, mcpUrl) {
95
- const snippet = codexTomlSnippet(mcpUrl);
130
+ export async function appendTomlServerConfig(configPath, mcpUrl, identity) {
131
+ const snippet = codexTomlSnippet(mcpUrl, identity);
96
132
  const existing = await readTextIfExists(configPath);
97
133
  const existingName = existingTomlMcpServerName(existing);
98
134
  if (existingName) {
@@ -153,3 +153,13 @@ export function defaultClaudecodeConfigPath(env) {
153
153
  return path.join(home, '.claude.json');
154
154
  }
155
155
 
156
+ export function defaultGrokConfigPath(env) {
157
+ const home = env.USERPROFILE || env.HOME || os.homedir();
158
+ return path.join(home, '.grok', 'config.toml');
159
+ }
160
+
161
+ export function defaultKimiCodeConfigPath(env) {
162
+ const home = env.USERPROFILE || env.HOME || os.homedir();
163
+ return path.join(home, '.kimi-code', 'mcp.json');
164
+ }
165
+
package/src/ui/setup.js CHANGED
@@ -15,6 +15,9 @@ import { profileClientConfig } from '../config/profile.js';
15
15
 
16
16
  const SETUP_CLIENT_ALIASES = new Map([
17
17
  ['codex', 'codex'],
18
+ ['grok', 'grok'],
19
+ ['grok-cli', 'grok'],
20
+ ['grok-build', 'grok'],
18
21
  ['cursor', 'cursor'],
19
22
  ['copilot', 'copilot-cli'],
20
23
  ['copilot-cli', 'copilot-cli'],
@@ -31,6 +34,9 @@ const SETUP_CLIENT_ALIASES = new Map([
31
34
  ['claude-desktop', 'claude-desktop'],
32
35
  ['openclaw', 'openclaw'],
33
36
  ['kiro', 'kiro'],
37
+ ['kimi', 'kimi-code'],
38
+ ['kimi-code', 'kimi-code'],
39
+ ['kimi-cli', 'kimi-code'],
34
40
  ['zed', 'zed'],
35
41
  ['jetbrains', 'jetbrains'],
36
42
  ['opencode', 'opencode'],