@cmnwlth/mcp 0.1.0
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 +202 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +208 -0
- package/dist/index.js.map +1 -0
- package/package.json +36 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Kristof Feys
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
202
|
+
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/index.ts
|
|
4
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
5
|
+
|
|
6
|
+
// src/brain.ts
|
|
7
|
+
import { resolveBrainDir as resolveBrainDirFromRegistry } from "@cmnwlth/core";
|
|
8
|
+
async function resolveBrainDir() {
|
|
9
|
+
const explicit = process.env.COMMONWEALTH_BRAIN_DIR;
|
|
10
|
+
if (explicit && explicit.length > 0) return explicit;
|
|
11
|
+
return resolveBrainDirFromRegistry(process.cwd());
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// src/server.ts
|
|
15
|
+
import { NOTE_KINDS } from "@cmnwlth/core";
|
|
16
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
17
|
+
import { z } from "zod";
|
|
18
|
+
|
|
19
|
+
// src/tools.ts
|
|
20
|
+
import {
|
|
21
|
+
buildIndex,
|
|
22
|
+
listNotes,
|
|
23
|
+
readNote,
|
|
24
|
+
regenerateDerived,
|
|
25
|
+
resolveProjectSource,
|
|
26
|
+
search
|
|
27
|
+
} from "@cmnwlth/core";
|
|
28
|
+
import { captureCandidates } from "@cmnwlth/curate";
|
|
29
|
+
async function searchNotes(brainDir, { query, kind, limit }) {
|
|
30
|
+
return search(brainDir, query, { kind, limit });
|
|
31
|
+
}
|
|
32
|
+
async function readNoteTool(brainDir, { path }) {
|
|
33
|
+
const note = await readNote(brainDir, path);
|
|
34
|
+
return { path: note.path, frontmatter: note.frontmatter, body: note.body };
|
|
35
|
+
}
|
|
36
|
+
async function remember(brainDir, { kind, title, body, tags, author }) {
|
|
37
|
+
const source = await resolveProjectSource(process.cwd()) ?? void 0;
|
|
38
|
+
const result = await captureCandidates(brainDir, [
|
|
39
|
+
{
|
|
40
|
+
kind,
|
|
41
|
+
title,
|
|
42
|
+
body,
|
|
43
|
+
tags: tags ?? [],
|
|
44
|
+
...author ? { author } : {},
|
|
45
|
+
...source ? { source } : {}
|
|
46
|
+
}
|
|
47
|
+
]);
|
|
48
|
+
const rejected = result.rejected[0];
|
|
49
|
+
if (rejected) return { status: "rejected", reason: rejected.reason };
|
|
50
|
+
const note = result.staged[0];
|
|
51
|
+
if (!note) return { status: "rejected", reason: "not-staged" };
|
|
52
|
+
if (result.promoted.length > 0) {
|
|
53
|
+
await buildIndex(brainDir);
|
|
54
|
+
await regenerateDerived(brainDir);
|
|
55
|
+
return { status: "promoted", id: note.frontmatter.id, path: result.promoted[0] };
|
|
56
|
+
}
|
|
57
|
+
return { status: "staged", id: note.frontmatter.id, path: note.path };
|
|
58
|
+
}
|
|
59
|
+
async function listWorkState(brainDir) {
|
|
60
|
+
const notes = await listNotes(brainDir, "work-state");
|
|
61
|
+
return notes.filter(
|
|
62
|
+
(n) => n.frontmatter.kind === "work-state" && n.frontmatter.status !== "done"
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
async function whoIs(brainDir, { query }) {
|
|
66
|
+
const q = query.trim().toLowerCase();
|
|
67
|
+
const people = await listNotes(brainDir, "person");
|
|
68
|
+
if (q === "") return people;
|
|
69
|
+
return people.filter((n) => {
|
|
70
|
+
const fm = n.frontmatter;
|
|
71
|
+
if (fm.kind !== "person") return false;
|
|
72
|
+
const haystacks = [fm.name, fm.title, fm.id, ...fm.tags];
|
|
73
|
+
return haystacks.some((h) => h.toLowerCase().includes(q));
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// src/server.ts
|
|
78
|
+
var kindEnum = z.enum(NOTE_KINDS);
|
|
79
|
+
function summarizeNote(note) {
|
|
80
|
+
const fm = note.frontmatter;
|
|
81
|
+
const status = "status" in fm ? ` [${fm.status}]` : "";
|
|
82
|
+
return `- ${fm.title}${status} (${note.path})`;
|
|
83
|
+
}
|
|
84
|
+
function noBrainConfigured() {
|
|
85
|
+
const cwd = process.cwd();
|
|
86
|
+
return {
|
|
87
|
+
isError: true,
|
|
88
|
+
content: [
|
|
89
|
+
{
|
|
90
|
+
type: "text",
|
|
91
|
+
text: `No Commonwealth brain is configured for ${cwd}. Run \`commonwealth init\` here to create or join a brain, or add a prefix \u2192 brain mapping to ~/.commonwealth/registry.json. (Set COMMONWEALTH_BRAIN_DIR to pin one explicitly.)`
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function createServer(brainDir = process.cwd()) {
|
|
97
|
+
const server = new McpServer({ name: "commonwealth", version: "0.0.0" });
|
|
98
|
+
server.registerTool(
|
|
99
|
+
"search",
|
|
100
|
+
{
|
|
101
|
+
title: "Search the brain",
|
|
102
|
+
description: "Full-text search across the team brain's notes (memory, decisions, work-state, people). Optionally scope to one kind and cap the number of results.",
|
|
103
|
+
inputSchema: {
|
|
104
|
+
query: z.string().min(1).describe("Search terms"),
|
|
105
|
+
kind: kindEnum.optional().describe("Restrict to a single note kind"),
|
|
106
|
+
limit: z.number().int().positive().max(100).optional().describe("Max results (default 20)")
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
async ({ query, kind, limit }) => {
|
|
110
|
+
if (brainDir === null) return noBrainConfigured();
|
|
111
|
+
const results = await searchNotes(brainDir, { query, kind, limit });
|
|
112
|
+
const text = results.length === 0 ? `No notes matched "${query}".` : results.map((r) => `- ${r.title} [${r.kind}] (${r.path})
|
|
113
|
+
${r.snippet}`).join("\n");
|
|
114
|
+
return { content: [{ type: "text", text }], structuredContent: { results } };
|
|
115
|
+
}
|
|
116
|
+
);
|
|
117
|
+
server.registerTool(
|
|
118
|
+
"read",
|
|
119
|
+
{
|
|
120
|
+
title: "Read a note",
|
|
121
|
+
description: "Read one note by its repo-relative path (as returned by search), yielding its validated frontmatter and markdown body.",
|
|
122
|
+
inputSchema: {
|
|
123
|
+
path: z.string().min(1).describe("Repo-relative note path, e.g. memory/2026-07-01-foo-a1b2.md")
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
async ({ path }) => {
|
|
127
|
+
if (brainDir === null) return noBrainConfigured();
|
|
128
|
+
const note = await readNoteTool(brainDir, { path });
|
|
129
|
+
const text = `# ${note.frontmatter.title}
|
|
130
|
+
|
|
131
|
+
${note.body}`;
|
|
132
|
+
return {
|
|
133
|
+
content: [{ type: "text", text }],
|
|
134
|
+
structuredContent: { path: note.path, frontmatter: note.frontmatter, body: note.body }
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
);
|
|
138
|
+
server.registerTool(
|
|
139
|
+
"remember",
|
|
140
|
+
{
|
|
141
|
+
title: "Remember a note",
|
|
142
|
+
description: "Record a new atomic note in the brain (memory, decision, work-state, or person). It goes through the same curation as automatic capture \u2014 the secret gate, dedup, and the brain's autoPromote setting \u2014 so it lands in canon (autoPromote on) or the review queue (off), and may be declined (e.g. a secret or a near-duplicate).",
|
|
143
|
+
inputSchema: {
|
|
144
|
+
kind: kindEnum.describe("Which kind of note to create"),
|
|
145
|
+
title: z.string().min(1).describe("Short title / the fact in one line"),
|
|
146
|
+
body: z.string().describe("Markdown body of the note"),
|
|
147
|
+
tags: z.array(z.string()).optional().describe("Topical tags"),
|
|
148
|
+
author: z.string().optional().describe("Who is recording this")
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
async ({ kind, title, body, tags, author }) => {
|
|
152
|
+
if (brainDir === null) return noBrainConfigured();
|
|
153
|
+
const result = await remember(brainDir, { kind, title, body, tags, author });
|
|
154
|
+
const text = result.status === "promoted" ? `Remembered "${title}" as ${result.id} (${result.path}).` : result.status === "staged" ? `Staged "${title}" for review as ${result.id} (${result.path}); approve with /commonwealth:promote.` : `Did not remember "${title}": ${result.reason}.`;
|
|
155
|
+
return {
|
|
156
|
+
content: [{ type: "text", text }],
|
|
157
|
+
structuredContent: { ...result }
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
);
|
|
161
|
+
server.registerTool(
|
|
162
|
+
"list-work-state",
|
|
163
|
+
{
|
|
164
|
+
title: "List active work-state",
|
|
165
|
+
description: "List active work-state notes (everything not marked done) \u2014 what workstreams are currently planned, in progress, or blocked.",
|
|
166
|
+
inputSchema: {}
|
|
167
|
+
},
|
|
168
|
+
async () => {
|
|
169
|
+
if (brainDir === null) return noBrainConfigured();
|
|
170
|
+
const notes = await listWorkState(brainDir);
|
|
171
|
+
const text = notes.length === 0 ? "No active work-state." : notes.map(summarizeNote).join("\n");
|
|
172
|
+
return { content: [{ type: "text", text }], structuredContent: { notes } };
|
|
173
|
+
}
|
|
174
|
+
);
|
|
175
|
+
server.registerTool(
|
|
176
|
+
"who-is",
|
|
177
|
+
{
|
|
178
|
+
title: "Look up a person",
|
|
179
|
+
description: "Find people notes by name, id, or tag (case-insensitive). Returns the matching person threads from the brain.",
|
|
180
|
+
inputSchema: {
|
|
181
|
+
query: z.string().min(1).describe("Name, id, or tag to look up")
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
async ({ query }) => {
|
|
185
|
+
if (brainDir === null) return noBrainConfigured();
|
|
186
|
+
const notes = await whoIs(brainDir, { query });
|
|
187
|
+
const text = notes.length === 0 ? `No people matched "${query}".` : notes.map(summarizeNote).join("\n");
|
|
188
|
+
return { content: [{ type: "text", text }], structuredContent: { notes } };
|
|
189
|
+
}
|
|
190
|
+
);
|
|
191
|
+
return server;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// src/index.ts
|
|
195
|
+
async function main() {
|
|
196
|
+
const brainDir = await resolveBrainDir();
|
|
197
|
+
const server = createServer(brainDir);
|
|
198
|
+
const transport = new StdioServerTransport();
|
|
199
|
+
await server.connect(transport);
|
|
200
|
+
console.error(
|
|
201
|
+
brainDir ? `[commonwealth-mcp] connected over stdio (brain: ${brainDir})` : `[commonwealth-mcp] connected over stdio (no brain configured for ${process.cwd()}; tools will report this until you run \`commonwealth init\` or add a registry mapping)`
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
main().catch((err) => {
|
|
205
|
+
console.error("[commonwealth-mcp] fatal:", err);
|
|
206
|
+
process.exit(1);
|
|
207
|
+
});
|
|
208
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/brain.ts","../src/server.ts","../src/tools.ts"],"sourcesContent":["import { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\nimport { resolveBrainDir } from \"./brain.js\";\nimport { createServer } from \"./server.js\";\n\n/**\n * Commonwealth MCP server entry point. Resolves the brain (explicit `COMMONWEALTH_BRAIN_DIR`\n * → `@cmnwlth/core`'s registry against cwd → `null`) once at startup, builds the server\n * against it, and wires a stdio transport. When no brain resolves the server still starts,\n * but its tools report \"no brain configured\" rather than silently using the cwd (#64). The\n * transport owns stdout for the JSON-RPC stream, so all diagnostics go to stderr.\n */\nasync function main(): Promise<void> {\n const brainDir = await resolveBrainDir();\n const server = createServer(brainDir);\n const transport = new StdioServerTransport();\n await server.connect(transport);\n console.error(\n brainDir\n ? `[commonwealth-mcp] connected over stdio (brain: ${brainDir})`\n : `[commonwealth-mcp] connected over stdio (no brain configured for ${process.cwd()}; ` +\n `tools will report this until you run \\`commonwealth init\\` or add a registry mapping)`,\n );\n}\n\nmain().catch((err) => {\n console.error(\"[commonwealth-mcp] fatal:\", err);\n process.exit(1);\n});\n","import { resolveBrainDir as resolveBrainDirFromRegistry } from \"@cmnwlth/core\";\n\n/**\n * Resolve which brain directory the MCP server operates on, or `null` when none is\n * configured for the current working directory.\n *\n * Precedence:\n * 1. `COMMONWEALTH_BRAIN_DIR` — an explicit override still wins (the plugin/daemon may set\n * it to pin a session's brain; see docs/03-distribution.md §3). We honor it here, up\n * front, so it takes precedence over the registry mappings.\n * 2. `@cmnwlth/core`'s registry resolver against the process cwd — so the MCP tools\n * (search/read/remember) hit the correct per-repo brain via the registry (marker →\n * ancestor brain → user registry; see ADR-0011). This already resolves a directory that\n * is *itself* a brain to itself, so the \"cd'd into a brain\" case is covered here.\n * 3. `null` — nothing maps. We deliberately do NOT fall back to the cwd: silently adopting\n * whatever directory Claude Code happens to launch in turns any unmapped repo into a\n * \"brain\" and masks a missing mapping as success (the surprise this fixes). Callers\n * surface an explicit \"no brain configured\" error instead. (#64)\n *\n * Async because the registry resolver reads the filesystem.\n */\nexport async function resolveBrainDir(): Promise<string | null> {\n const explicit = process.env.COMMONWEALTH_BRAIN_DIR;\n if (explicit && explicit.length > 0) return explicit;\n\n return resolveBrainDirFromRegistry(process.cwd());\n}\n","import { NOTE_KINDS, type Note } from \"@cmnwlth/core\";\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { z } from \"zod\";\nimport { listWorkState, readNoteTool, remember, searchNotes, whoIs } from \"./tools.js\";\n\n/** Zod enum of the four note kinds, reused across tool input schemas. */\nconst kindEnum = z.enum(NOTE_KINDS);\n\n/** Compact one-line summary of a note for human-readable tool output. */\nfunction summarizeNote(note: Note): string {\n const fm = note.frontmatter;\n const status = \"status\" in fm ? ` [${fm.status}]` : \"\";\n return `- ${fm.title}${status} (${note.path})`;\n}\n\n/** The MCP error-result shape returned by a tool: human text + `isError`. */\ntype ToolError = { content: { type: \"text\"; text: string }[]; isError: true };\n\n/**\n * The explicit \"no brain configured\" result. Returned by every tool when the server was\n * built without a resolved brain (see {@link createServer}), instead of silently operating\n * on the process cwd. Tells the user exactly how to wire one up. (#64)\n */\nfunction noBrainConfigured(): ToolError {\n const cwd = process.cwd();\n return {\n isError: true,\n content: [\n {\n type: \"text\",\n text:\n `No Commonwealth brain is configured for ${cwd}. Run \\`commonwealth init\\` here to ` +\n `create or join a brain, or add a prefix → brain mapping to ` +\n `~/.commonwealth/registry.json. (Set COMMONWEALTH_BRAIN_DIR to pin one explicitly.)`,\n },\n ],\n };\n}\n\n/**\n * Build the Commonwealth MCP server with the five M1 tools wired to the pure handlers in\n * `tools.ts`. Every tool reads/writes the brain only through `@cmnwlth/core`, keeping\n * markdown the source of truth (ADR-0003).\n *\n * @param brainDir Absolute path to the brain repo, or `null` when {@link resolveBrainDir}\n * found no brain for the cwd. When `null` the server still starts (so the plugin never\n * breaks an unmapped project) but every tool returns {@link noBrainConfigured} rather than\n * silently reading/writing the cwd. Defaults to the process cwd when omitted so a caller\n * that already `cd`'d into a brain can build the server without resolving.\n */\nexport function createServer(brainDir: string | null = process.cwd()): McpServer {\n const server = new McpServer({ name: \"commonwealth\", version: \"0.0.0\" });\n\n server.registerTool(\n \"search\",\n {\n title: \"Search the brain\",\n description:\n \"Full-text search across the team brain's notes (memory, decisions, work-state, \" +\n \"people). Optionally scope to one kind and cap the number of results.\",\n inputSchema: {\n query: z.string().min(1).describe(\"Search terms\"),\n kind: kindEnum.optional().describe(\"Restrict to a single note kind\"),\n limit: z.number().int().positive().max(100).optional().describe(\"Max results (default 20)\"),\n },\n },\n async ({ query, kind, limit }) => {\n if (brainDir === null) return noBrainConfigured();\n const results = await searchNotes(brainDir, { query, kind, limit });\n const text =\n results.length === 0\n ? `No notes matched \"${query}\".`\n : results.map((r) => `- ${r.title} [${r.kind}] (${r.path})\\n ${r.snippet}`).join(\"\\n\");\n return { content: [{ type: \"text\", text }], structuredContent: { results } };\n },\n );\n\n server.registerTool(\n \"read\",\n {\n title: \"Read a note\",\n description:\n \"Read one note by its repo-relative path (as returned by search), yielding its \" +\n \"validated frontmatter and markdown body.\",\n inputSchema: {\n path: z\n .string()\n .min(1)\n .describe(\"Repo-relative note path, e.g. memory/2026-07-01-foo-a1b2.md\"),\n },\n },\n async ({ path }) => {\n if (brainDir === null) return noBrainConfigured();\n const note = await readNoteTool(brainDir, { path });\n const text = `# ${note.frontmatter.title}\\n\\n${note.body}`;\n return {\n content: [{ type: \"text\", text }],\n structuredContent: { path: note.path, frontmatter: note.frontmatter, body: note.body },\n };\n },\n );\n\n server.registerTool(\n \"remember\",\n {\n title: \"Remember a note\",\n description:\n \"Record a new atomic note in the brain (memory, decision, work-state, or person). It \" +\n \"goes through the same curation as automatic capture — the secret gate, dedup, and the \" +\n \"brain's autoPromote setting — so it lands in canon (autoPromote on) or the review queue \" +\n \"(off), and may be declined (e.g. a secret or a near-duplicate).\",\n inputSchema: {\n kind: kindEnum.describe(\"Which kind of note to create\"),\n title: z.string().min(1).describe(\"Short title / the fact in one line\"),\n body: z.string().describe(\"Markdown body of the note\"),\n tags: z.array(z.string()).optional().describe(\"Topical tags\"),\n author: z.string().optional().describe(\"Who is recording this\"),\n },\n },\n async ({ kind, title, body, tags, author }) => {\n if (brainDir === null) return noBrainConfigured();\n const result = await remember(brainDir, { kind, title, body, tags, author });\n const text =\n result.status === \"promoted\"\n ? `Remembered \"${title}\" as ${result.id} (${result.path}).`\n : result.status === \"staged\"\n ? `Staged \"${title}\" for review as ${result.id} (${result.path}); approve with /commonwealth:promote.`\n : `Did not remember \"${title}\": ${result.reason}.`;\n return {\n content: [{ type: \"text\", text }],\n structuredContent: { ...result },\n };\n },\n );\n\n server.registerTool(\n \"list-work-state\",\n {\n title: \"List active work-state\",\n description:\n \"List active work-state notes (everything not marked done) — what workstreams are \" +\n \"currently planned, in progress, or blocked.\",\n inputSchema: {},\n },\n async () => {\n if (brainDir === null) return noBrainConfigured();\n const notes = await listWorkState(brainDir);\n const text =\n notes.length === 0 ? \"No active work-state.\" : notes.map(summarizeNote).join(\"\\n\");\n return { content: [{ type: \"text\", text }], structuredContent: { notes } };\n },\n );\n\n server.registerTool(\n \"who-is\",\n {\n title: \"Look up a person\",\n description:\n \"Find people notes by name, id, or tag (case-insensitive). Returns the matching \" +\n \"person threads from the brain.\",\n inputSchema: {\n query: z.string().min(1).describe(\"Name, id, or tag to look up\"),\n },\n },\n async ({ query }) => {\n if (brainDir === null) return noBrainConfigured();\n const notes = await whoIs(brainDir, { query });\n const text =\n notes.length === 0 ? `No people matched \"${query}\".` : notes.map(summarizeNote).join(\"\\n\");\n return { content: [{ type: \"text\", text }], structuredContent: { notes } };\n },\n );\n\n return server;\n}\n","import {\n buildIndex,\n listNotes,\n readNote,\n regenerateDerived,\n resolveProjectSource,\n search,\n type Frontmatter,\n type Note,\n type NoteKind,\n type SearchResult,\n} from \"@cmnwlth/core\";\nimport { captureCandidates } from \"@cmnwlth/curate\";\n\n/**\n * Pure handler layer for the Commonwealth MCP server.\n *\n * Each function takes an explicit `brainDir` plus typed args and returns a plain JS\n * result object — no MCP framing. `server.ts` adapts these into MCP tools, and the\n * tests exercise them directly. All logic lives here; the server is a thin shell.\n *\n * Markdown files are the source of truth: every read/write goes through `@cmnwlth/core`,\n * never a parallel store (ADR-0003, ADR-0005).\n */\n\n/** Arguments for {@link searchNotes}. */\nexport interface SearchNotesArgs {\n query: string;\n kind?: NoteKind;\n limit?: number;\n}\n\n/**\n * Lexical search across the brain's notes, optionally scoped to one `kind` and capped\n * at `limit` results. Delegates to `core.search` (FTS5 over title/body/tags).\n */\nexport async function searchNotes(\n brainDir: string,\n { query, kind, limit }: SearchNotesArgs,\n): Promise<SearchResult[]> {\n return search(brainDir, query, { kind, limit });\n}\n\n/** Arguments for {@link readNoteTool}. */\nexport interface ReadNoteArgs {\n /** Repo-relative path, e.g. `memory/2026-07-01-foo-a1b2.md`. */\n path: string;\n}\n\n/** A single note, flattened for return over the wire. */\nexport interface ReadNoteResult {\n path: string;\n frontmatter: Frontmatter;\n body: string;\n}\n\n/**\n * Read one note by its repo-relative path. Delegates to `core.readNote`, which throws\n * if the file is missing or its frontmatter fails schema validation.\n */\nexport async function readNoteTool(\n brainDir: string,\n { path }: ReadNoteArgs,\n): Promise<ReadNoteResult> {\n const note = await readNote(brainDir, path);\n return { path: note.path, frontmatter: note.frontmatter, body: note.body };\n}\n\n/** Arguments for {@link remember}. */\nexport interface RememberArgs {\n kind: NoteKind;\n title: string;\n body: string;\n tags?: string[];\n author?: string;\n}\n\n/** Outcome of a {@link remember}: promoted to canon, staged for review, or gate-rejected. */\nexport interface RememberResult {\n /** `promoted` = in canon; `staged` = in the review queue; `rejected` = a gate declined it. */\n status: \"promoted\" | \"staged\" | \"rejected\";\n /** The note id, when it was accepted (promoted or staged). */\n id?: string;\n /** Canonical path when promoted, staging path when staged. */\n path?: string;\n /** Why a gate declined the note (e.g. `contains-secret`, `duplicate`), when rejected. */\n reason?: string;\n}\n\n/**\n * Record a note through the SAME curation path as automatic capture (#82): the secret gate,\n * relevance/dedup gate, and the per-brain `autoPromote` decision all apply. Previously this\n * wrote straight to canon via `writeNote`, bypassing every gate — so an MCP client could plant a\n * secret or a duplicate directly into shared canon. Now it delegates to `captureCandidates`,\n * which stages the note and (unless `autoPromote` is off) approves it into canon.\n *\n * On promotion we refresh the disposable derived artifacts so a subsequent {@link searchNotes}\n * sees the note immediately (staged notes intentionally are NOT indexed until approved).\n */\nexport async function remember(\n brainDir: string,\n { kind, title, body, tags, author }: RememberArgs,\n): Promise<RememberResult> {\n // Attribute the note to the project the MCP is running in (ADR-0015), so it files under\n // <project>/<kind>/ like hook-captured notes. Best-effort: unresolved → unattributed.\n const source = (await resolveProjectSource(process.cwd())) ?? undefined;\n const result = await captureCandidates(brainDir, [\n {\n kind,\n title,\n body,\n tags: tags ?? [],\n ...(author ? { author } : {}),\n ...(source ? { source } : {}),\n },\n ]);\n\n const rejected = result.rejected[0];\n if (rejected) return { status: \"rejected\", reason: rejected.reason };\n\n const note = result.staged[0];\n if (!note) return { status: \"rejected\", reason: \"not-staged\" };\n\n if (result.promoted.length > 0) {\n // autoPromote landed it in canon — refresh derived so reads/search see it now.\n await buildIndex(brainDir);\n await regenerateDerived(brainDir);\n return { status: \"promoted\", id: note.frontmatter.id, path: result.promoted[0] };\n }\n return { status: \"staged\", id: note.frontmatter.id, path: note.path };\n}\n\n/**\n * List active work-state notes (everything whose `status` is not `done`). Delegates to\n * `core.listNotes(brainDir, \"work-state\")`.\n */\nexport async function listWorkState(brainDir: string): Promise<Note[]> {\n const notes = await listNotes(brainDir, \"work-state\");\n return notes.filter(\n (n) => n.frontmatter.kind === \"work-state\" && n.frontmatter.status !== \"done\",\n );\n}\n\n/** Arguments for {@link whoIs}. */\nexport interface WhoIsArgs {\n query: string;\n}\n\n/**\n * Look up people by name, id, or tag. Case-insensitive substring match over the\n * `person` note set. Returns every match (empty array if none).\n */\nexport async function whoIs(brainDir: string, { query }: WhoIsArgs): Promise<Note[]> {\n const q = query.trim().toLowerCase();\n const people = await listNotes(brainDir, \"person\");\n if (q === \"\") return people;\n return people.filter((n) => {\n const fm = n.frontmatter;\n if (fm.kind !== \"person\") return false;\n const haystacks = [fm.name, fm.title, fm.id, ...fm.tags];\n return haystacks.some((h) => h.toLowerCase().includes(q));\n });\n}\n"],"mappings":";;;AAAA,SAAS,4BAA4B;;;ACArC,SAAS,mBAAmB,mCAAmC;AAqB/D,eAAsB,kBAA0C;AAC9D,QAAM,WAAW,QAAQ,IAAI;AAC7B,MAAI,YAAY,SAAS,SAAS,EAAG,QAAO;AAE5C,SAAO,4BAA4B,QAAQ,IAAI,CAAC;AAClD;;;AC1BA,SAAS,kBAA6B;AACtC,SAAS,iBAAiB;AAC1B,SAAS,SAAS;;;ACFlB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAKK;AACP,SAAS,yBA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A,IACA;AAAA,MACE,OAAO;AAAA,MACP,aACE;AAAA,MAEF,aAAa;AAAA,QACX,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,SAAS,6BAA6B;AAAA,MACjE;AAAA,IACF;AAAA,IACA,OAAO,EAAE,MAAM,MAAM;AACnB,UAAI,aAAa,KAAM,QAAO,kBAAkB;AAChD,YAAM,QAAQ,MAAM,MAAM,UAAU,EAAE,MAAM,CAAC;AAC7C,YAAM,OACJ,MAAM,WAAW,IAAI,sBAAsB,KAAK,OAAO,MAAM,IAAI,aAAa,EAAE,KAAK,IAAI;AAC3F,aAAO,EAAE,SAAS,CAAC,EAAE,MAAM,QAAQ,KAAK,CAAC,GAAG,mBAAmB,EAAE,MAAM,EAAE;AAAA,IAC3E;AAAA,EACF;AAEA,SAAO;AACT;;;AFnKA,eAAe,OAAsB;AACnC,QAAM,WAAW,MAAM,gBAAgB;AACvC,QAAM,SAAS,aAAa,QAAQ;AACpC,QAAM,YAAY,IAAI,qBAAqB;AAC3C,QAAM,OAAO,QAAQ,SAAS;AAC9B,UAAQ;AAAA,IACN,WACI,mDAAmD,QAAQ,MAC3D,oEAAoE,QAAQ,IAAI,CAAC;AAAA,EAEvF;AACF;AAEA,KAAK,EAAE,MAAM,CAAC,QAAQ;AACpB,UAAQ,MAAM,6BAA6B,GAAG;AAC9C,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cmnwlth/mcp",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "MCP server exposing a Commonwealth brain to Claude Code and other MCP clients",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"commonwealth-mcp": "./dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"main": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"files": [
|
|
13
|
+
"dist"
|
|
14
|
+
],
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
17
|
+
"zod": "^3.23.0",
|
|
18
|
+
"@cmnwlth/core": "0.1.0",
|
|
19
|
+
"@cmnwlth/curate": "0.1.0"
|
|
20
|
+
},
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public",
|
|
23
|
+
"provenance": true
|
|
24
|
+
},
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "https://github.com/kristoffeys/commonwealth.git",
|
|
28
|
+
"directory": "packages/mcp"
|
|
29
|
+
},
|
|
30
|
+
"homepage": "https://github.com/kristoffeys/commonwealth#readme",
|
|
31
|
+
"bugs": "https://github.com/kristoffeys/commonwealth/issues",
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "tsup",
|
|
34
|
+
"typecheck": "tsc --noEmit"
|
|
35
|
+
}
|
|
36
|
+
}
|