threadctx-mcp 0.1.1 → 0.1.2
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/dist/server.js +31 -2
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { dirname, join } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
1
4
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
2
5
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
3
6
|
import { CallToolRequestSchema, ListToolsRequestSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
@@ -8,7 +11,30 @@ import { CloudClient } from './cloud-client.js';
|
|
|
8
11
|
// output, Cursor's agent panel, future surfaces). See spec section 2.4 —
|
|
9
12
|
// the same short string everywhere is what makes the brand legible.
|
|
10
13
|
const attributionFooter = (n) => `· via threadctx — shared team memory (${n} hit${n === 1 ? '' : 's'})`;
|
|
14
|
+
// package.json sits next to dist/ both in this repo and once installed as a
|
|
15
|
+
// dependency, so this resolves correctly in both dev and published contexts.
|
|
16
|
+
const packageJsonPath = join(dirname(fileURLToPath(import.meta.url)), '..', 'package.json');
|
|
17
|
+
const packageVersion = JSON.parse(readFileSync(packageJsonPath, 'utf-8')).version;
|
|
11
18
|
export async function startServer() {
|
|
19
|
+
console.error('[threadctx] Shared memory MCP server for Claude Code, Cursor, and other MCP clients.');
|
|
20
|
+
console.error('[threadctx] Setup guide: https://threadctx.dev');
|
|
21
|
+
// A human typing `npx threadctx-mcp` straight into a terminal (rather than
|
|
22
|
+
// an MCP client spawning it over a pipe) is a very natural thing to try
|
|
23
|
+
// when kicking the tires — and without this check it just sits there
|
|
24
|
+
// forever waiting for JSON-RPC input that will never arrive, with zero
|
|
25
|
+
// explanation. Detect that case and exit with guidance instead of hanging.
|
|
26
|
+
if (process.stdin.isTTY) {
|
|
27
|
+
console.error('');
|
|
28
|
+
console.error("[threadctx] This looks like a terminal, not an MCP client — there's nothing more to do here.");
|
|
29
|
+
console.error('[threadctx] threadctx only runs as a subprocess that Claude Code / Cursor launch for you.');
|
|
30
|
+
console.error('[threadctx] Add this to your MCP client config (~/.claude/mcp.json or .cursor/mcp.json):');
|
|
31
|
+
console.error('');
|
|
32
|
+
console.error(JSON.stringify({ mcpServers: { threadctx: { command: 'npx', args: ['-y', 'threadctx-mcp'] } } }, null, 2));
|
|
33
|
+
console.error('');
|
|
34
|
+
console.error('[threadctx] Then restart your agent — it will pick up memory_write / memory_query.');
|
|
35
|
+
console.error('[threadctx] Full guide: https://threadctx.dev');
|
|
36
|
+
process.exit(0);
|
|
37
|
+
}
|
|
12
38
|
const config = loadConfig();
|
|
13
39
|
if (config.mode === 'cloud' && !config.apiKey) {
|
|
14
40
|
console.error('[threadctx] THREADCTX_MODE=cloud but no API key was found. Falling back to local mode. ' +
|
|
@@ -18,7 +44,7 @@ export async function startServer() {
|
|
|
18
44
|
const localStore = useCloud ? null : new LocalStore(config.dbPath);
|
|
19
45
|
const cloudClient = useCloud ? new CloudClient(config.apiUrl, config.apiKey, config.actorId) : null;
|
|
20
46
|
const repo = config.repo;
|
|
21
|
-
const server = new Server({ name: 'threadctx', version:
|
|
47
|
+
const server = new Server({ name: 'threadctx', version: packageVersion }, { capabilities: { tools: {} } });
|
|
22
48
|
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
23
49
|
tools: [
|
|
24
50
|
{
|
|
@@ -106,5 +132,8 @@ export async function startServer() {
|
|
|
106
132
|
});
|
|
107
133
|
const transport = new StdioServerTransport();
|
|
108
134
|
await server.connect(transport);
|
|
109
|
-
|
|
135
|
+
const repoSuffix = repo === 'unknown-repo'
|
|
136
|
+
? ' (no git remote found in this directory — cd into a repo with one, or set THREADCTX_REPO)'
|
|
137
|
+
: '';
|
|
138
|
+
console.error(`[threadctx] MCP server running in ${useCloud ? 'cloud' : 'local'} mode for repo "${repo}"${repoSuffix}.`);
|
|
110
139
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "threadctx-mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Shared memory MCP server for AI coding agents. Local-only by default; point it at threadctx.dev (or your own deployment) to share memory across your team.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|