@medicine-wheel/mcp 4.0.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.
Files changed (78) hide show
  1. package/dist/index.d.ts +3 -0
  2. package/dist/index.d.ts.map +1 -0
  3. package/dist/index.js +115 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/jsonl-store.d.ts +184 -0
  6. package/dist/jsonl-store.d.ts.map +1 -0
  7. package/dist/jsonl-store.js +393 -0
  8. package/dist/jsonl-store.js.map +1 -0
  9. package/dist/prompts/index.d.ts +3 -0
  10. package/dist/prompts/index.d.ts.map +1 -0
  11. package/dist/prompts/index.js +229 -0
  12. package/dist/prompts/index.js.map +1 -0
  13. package/dist/resources/index.d.ts +3 -0
  14. package/dist/resources/index.d.ts.map +1 -0
  15. package/dist/resources/index.js +252 -0
  16. package/dist/resources/index.js.map +1 -0
  17. package/dist/store.d.ts +15 -0
  18. package/dist/store.d.ts.map +1 -0
  19. package/dist/store.js +16 -0
  20. package/dist/store.js.map +1 -0
  21. package/dist/tools/ceremony-lifecycle.d.ts +10 -0
  22. package/dist/tools/ceremony-lifecycle.d.ts.map +1 -0
  23. package/dist/tools/ceremony-lifecycle.js +275 -0
  24. package/dist/tools/ceremony-lifecycle.js.map +1 -0
  25. package/dist/tools/coordination.d.ts +10 -0
  26. package/dist/tools/coordination.d.ts.map +1 -0
  27. package/dist/tools/coordination.js +136 -0
  28. package/dist/tools/coordination.js.map +1 -0
  29. package/dist/tools/discovery.d.ts +11 -0
  30. package/dist/tools/discovery.d.ts.map +1 -0
  31. package/dist/tools/discovery.js +552 -0
  32. package/dist/tools/discovery.js.map +1 -0
  33. package/dist/tools/east.d.ts +3 -0
  34. package/dist/tools/east.d.ts.map +1 -0
  35. package/dist/tools/east.js +271 -0
  36. package/dist/tools/east.js.map +1 -0
  37. package/dist/tools/epistemic.d.ts +10 -0
  38. package/dist/tools/epistemic.d.ts.map +1 -0
  39. package/dist/tools/epistemic.js +159 -0
  40. package/dist/tools/epistemic.js.map +1 -0
  41. package/dist/tools/governance-transformation.d.ts +10 -0
  42. package/dist/tools/governance-transformation.d.ts.map +1 -0
  43. package/dist/tools/governance-transformation.js +181 -0
  44. package/dist/tools/governance-transformation.js.map +1 -0
  45. package/dist/tools/integrations.d.ts +9 -0
  46. package/dist/tools/integrations.d.ts.map +1 -0
  47. package/dist/tools/integrations.js +643 -0
  48. package/dist/tools/integrations.js.map +1 -0
  49. package/dist/tools/north.d.ts +3 -0
  50. package/dist/tools/north.d.ts.map +1 -0
  51. package/dist/tools/north.js +436 -0
  52. package/dist/tools/north.js.map +1 -0
  53. package/dist/tools/reasoning-observability.d.ts +10 -0
  54. package/dist/tools/reasoning-observability.d.ts.map +1 -0
  55. package/dist/tools/reasoning-observability.js +90 -0
  56. package/dist/tools/reasoning-observability.js.map +1 -0
  57. package/dist/tools/south.d.ts +3 -0
  58. package/dist/tools/south.d.ts.map +1 -0
  59. package/dist/tools/south.js +295 -0
  60. package/dist/tools/south.js.map +1 -0
  61. package/dist/tools/structural-tension.d.ts +15 -0
  62. package/dist/tools/structural-tension.d.ts.map +1 -0
  63. package/dist/tools/structural-tension.js +695 -0
  64. package/dist/tools/structural-tension.js.map +1 -0
  65. package/dist/tools/west.d.ts +3 -0
  66. package/dist/tools/west.d.ts.map +1 -0
  67. package/dist/tools/west.js +313 -0
  68. package/dist/tools/west.js.map +1 -0
  69. package/dist/types.d.ts +28 -0
  70. package/dist/types.d.ts.map +1 -0
  71. package/dist/types.js +9 -0
  72. package/dist/types.js.map +1 -0
  73. package/dist/validators/index.d.ts +3 -0
  74. package/dist/validators/index.d.ts.map +1 -0
  75. package/dist/validators/index.js +388 -0
  76. package/dist/validators/index.js.map +1 -0
  77. package/package.json +48 -0
  78. package/tsconfig.json +20 -0
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js ADDED
@@ -0,0 +1,115 @@
1
+ #!/usr/bin/env node
2
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
3
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
+ import { CallToolRequestSchema, ListToolsRequestSchema, ListResourcesRequestSchema, ReadResourceRequestSchema, ListPromptsRequestSchema, GetPromptRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
5
+ import { eastTools } from "./tools/east.js";
6
+ import { southTools } from "./tools/south.js";
7
+ import { westTools } from "./tools/west.js";
8
+ import { northTools } from "./tools/north.js";
9
+ import { validators } from "./validators/index.js";
10
+ import { integrationTools } from "./tools/integrations.js";
11
+ import { discoveryTools } from "./tools/discovery.js";
12
+ import { structuralTensionTools } from "./tools/structural-tension.js";
13
+ import { ceremonyLifecycleTools } from "./tools/ceremony-lifecycle.js";
14
+ import { epistemicTools } from "./tools/epistemic.js";
15
+ import { coordinationTools } from "./tools/coordination.js";
16
+ import { governanceTransformationTools } from "./tools/governance-transformation.js";
17
+ import { reasoningObservabilityTools } from "./tools/reasoning-observability.js";
18
+ import { resources } from "./resources/index.js";
19
+ import { prompts } from "./prompts/index.js";
20
+ const server = new Server({
21
+ name: "@medicine-wheel/mcp",
22
+ version: "4.0.0",
23
+ }, {
24
+ capabilities: {
25
+ tools: {},
26
+ resources: {},
27
+ prompts: {},
28
+ },
29
+ });
30
+ const allTools = [
31
+ ...eastTools,
32
+ ...southTools,
33
+ ...westTools,
34
+ ...northTools,
35
+ ...validators,
36
+ ...integrationTools,
37
+ ...discoveryTools,
38
+ ...structuralTensionTools,
39
+ ...ceremonyLifecycleTools,
40
+ ...epistemicTools,
41
+ ...coordinationTools,
42
+ ...governanceTransformationTools,
43
+ ...reasoningObservabilityTools,
44
+ ];
45
+ server.setRequestHandler(ListToolsRequestSchema, async () => {
46
+ return {
47
+ tools: allTools.map((tool) => ({
48
+ name: tool.name,
49
+ description: tool.description,
50
+ inputSchema: tool.inputSchema,
51
+ })),
52
+ };
53
+ });
54
+ server.setRequestHandler(CallToolRequestSchema, async (request) => {
55
+ const tool = allTools.find((t) => t.name === request.params.name);
56
+ if (!tool)
57
+ throw new Error(`Unknown tool: ${request.params.name}`);
58
+ try {
59
+ const result = await tool.handler(request.params.arguments || {});
60
+ return {
61
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
62
+ };
63
+ }
64
+ catch (error) {
65
+ const errorMessage = error instanceof Error ? error.message : String(error);
66
+ return {
67
+ content: [{ type: "text", text: JSON.stringify({ error: errorMessage, direction: "Please ensure all required parameters are provided" }, null, 2) }],
68
+ isError: true,
69
+ };
70
+ }
71
+ });
72
+ server.setRequestHandler(ListResourcesRequestSchema, async () => {
73
+ return {
74
+ resources: resources.map((r) => ({
75
+ uri: r.uri,
76
+ name: r.name,
77
+ description: r.description,
78
+ mimeType: r.mimeType,
79
+ })),
80
+ };
81
+ });
82
+ server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
83
+ const resource = resources.find((r) => r.uri === request.params.uri);
84
+ if (!resource)
85
+ throw new Error(`Resource not found: ${request.params.uri}`);
86
+ return {
87
+ contents: [{ uri: resource.uri, mimeType: resource.mimeType || "application/json", text: JSON.stringify(resource.content, null, 2) }],
88
+ };
89
+ });
90
+ server.setRequestHandler(ListPromptsRequestSchema, async () => {
91
+ return {
92
+ prompts: prompts.map((p) => ({ name: p.name, description: p.description, arguments: p.arguments })),
93
+ };
94
+ });
95
+ server.setRequestHandler(GetPromptRequestSchema, async (request) => {
96
+ const prompt = prompts.find((p) => p.name === request.params.name);
97
+ if (!prompt)
98
+ throw new Error(`Prompt not found: ${request.params.name}`);
99
+ const messages = await prompt.handler(request.params.arguments || {});
100
+ return { messages };
101
+ });
102
+ async function main() {
103
+ console.error("🌿 @medicine-wheel/mcp server v4.0 initializing...");
104
+ console.error("📂 Using JSONL file-backed store (.mw/store/)");
105
+ const transport = new StdioServerTransport();
106
+ await server.connect(transport);
107
+ console.error("Medicine Wheel MCP Server running on stdio");
108
+ console.error("🌅 East | 🌞 South | 🌄 West | 🌌 North");
109
+ console.error("All my relations 🌿");
110
+ }
111
+ main().catch((error) => {
112
+ console.error("Server error:", error);
113
+ process.exit(1);
114
+ });
115
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,0BAA0B,EAC1B,yBAAyB,EACzB,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,6BAA6B,EAAE,MAAM,sCAAsC,CAAC;AACrF,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,C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AAC,CAAC,CAAC;AAEH,KAAK,UAAU,IAAI;IACjB,OAAO,CAAC,KAAK,CAAC,oDAAoD,CAAC,CAAC;IACpE,OAAO,CAAC,KAAK,CAAC,+CAA+C,CAAC,CAAC;IAC/D,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAC5D,OAAO,CAAC,KAAK,CAAC,yCAAyC,CAAC,CAAC;IACzD,OAAO,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;AACvC,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;IACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,184 @@
1
+ /**
2
+ * JSONL File-Based Persistence for Medicine Wheel MCP Server
3
+ *
4
+ * Mirror of lib/jsonl-store.ts adapted for the MCP server process.
5
+ * Both the Web UI and MCP server read/write the same .mw/store/ JSONL files,
6
+ * enabling data created in either interface to be visible across both.
7
+ *
8
+ * Improvements over initial version (PR #27 Copilot review):
9
+ * - readJsonl() throws on real FS errors instead of silently returning []
10
+ * - EdgeCollection uses upsert keyed by from_id:to_id — no duplicate edges
11
+ * - flush() uses file lock + read-modify-write — concurrent writes merge
12
+ *
13
+ * @see https://github.com/jgwill/medicine-wheel/issues/26
14
+ */
15
+ interface StoredNode {
16
+ id: string;
17
+ type: string;
18
+ name: string;
19
+ description?: string;
20
+ direction?: string;
21
+ metadata?: Record<string, unknown>;
22
+ created_at: string;
23
+ updated_at: string;
24
+ }
25
+ interface StoredEdge {
26
+ id?: string;
27
+ from_id: string;
28
+ to_id: string;
29
+ relationship_type: string;
30
+ strength: number;
31
+ ceremony_honored: boolean;
32
+ ceremony_id?: string;
33
+ obligations: string[];
34
+ created_at: string;
35
+ }
36
+ interface StoredCeremony {
37
+ id: string;
38
+ type: string;
39
+ direction: string;
40
+ participants: string[];
41
+ medicines_used: string[];
42
+ intentions: string[];
43
+ timestamp: string;
44
+ research_context?: string;
45
+ }
46
+ interface StoredBeat {
47
+ id: string;
48
+ direction: string;
49
+ title: string;
50
+ description: string;
51
+ prose?: string;
52
+ ceremonies: string[];
53
+ learnings: string[];
54
+ timestamp: string;
55
+ act: number;
56
+ relations_honored: string[];
57
+ }
58
+ interface StoredCycle {
59
+ id: string;
60
+ research_question: string;
61
+ current_direction: string;
62
+ start_date: string;
63
+ beats?: string[];
64
+ ceremonies_conducted: number;
65
+ relations_mapped: number;
66
+ wilson_alignment: number;
67
+ ocap_compliant: boolean;
68
+ archived?: boolean;
69
+ }
70
+ interface StoredChart {
71
+ id: string;
72
+ desired_outcome: string;
73
+ current_reality: string;
74
+ direction: string;
75
+ action_steps: any[];
76
+ due_date?: string;
77
+ created_at: string;
78
+ updated_at: string;
79
+ phase: string;
80
+ ceremonies_linked: string[];
81
+ wilson_alignment?: number;
82
+ cycle_id?: string;
83
+ }
84
+ interface StoredMmot {
85
+ id: string;
86
+ chart_id: string;
87
+ timestamp: string;
88
+ step1_expected: string;
89
+ step1_actual: string;
90
+ step2_analysis: string;
91
+ step3_adjustments: string[];
92
+ step4_feedback: string;
93
+ }
94
+ declare class JsonlCollection<T extends {
95
+ id?: string;
96
+ }> {
97
+ private items;
98
+ private filePath;
99
+ private lastMtime;
100
+ private loaded;
101
+ constructor(filePath: string);
102
+ private sync;
103
+ /**
104
+ * Read-modify-write inside a file lock so concurrent writers merge
105
+ * instead of clobbering each other.
106
+ */
107
+ private flush;
108
+ get(id: string): T | undefined;
109
+ getAll(): T[];
110
+ has(id: string): boolean;
111
+ size(): number;
112
+ set(id: string, item: T): void;
113
+ filter(predicate: (item: T) => boolean): T[];
114
+ search(query: string, fields: (keyof T)[]): T[];
115
+ }
116
+ declare class EdgeCollection {
117
+ private items;
118
+ private filePath;
119
+ private lastMtime;
120
+ private loaded;
121
+ constructor(filePath: string);
122
+ private edgeKey;
123
+ private sync;
124
+ private flush;
125
+ /** Upsert: replaces any existing edge with the same endpoints. */
126
+ add(edge: StoredEdge): void;
127
+ getAll(): StoredEdge[];
128
+ getForNode(nodeId: string): StoredEdge[];
129
+ getRelatedNodeIds(nodeId: string): string[];
130
+ updateCeremony(fromId: string, toId: string, ceremonyId: string): void;
131
+ }
132
+ export declare class JsonlStore {
133
+ readonly dataDir: string;
134
+ readonly nodes: JsonlCollection<StoredNode>;
135
+ readonly edges: EdgeCollection;
136
+ readonly ceremonies: JsonlCollection<StoredCeremony>;
137
+ readonly beats: JsonlCollection<StoredBeat>;
138
+ readonly cycles: JsonlCollection<StoredCycle>;
139
+ readonly charts: JsonlCollection<StoredChart>;
140
+ readonly mmots: JsonlCollection<StoredMmot>;
141
+ constructor(dataDir?: string);
142
+ createNode(node: StoredNode): void;
143
+ getNode(id: string): StoredNode | undefined;
144
+ getAllNodes(limit?: number): StoredNode[];
145
+ getNodesByType(type: string): StoredNode[];
146
+ getNodesByDirection(direction: string): StoredNode[];
147
+ searchNodes(query: string, opts?: {
148
+ type?: string;
149
+ direction?: string;
150
+ limit?: number;
151
+ }): StoredNode[];
152
+ createEdge(edge: StoredEdge): void;
153
+ getEdgesForNode(nodeId: string): StoredEdge[];
154
+ getRelatedNodeIds(nodeId: string): string[];
155
+ updateEdgeCeremony(fromId: string, toId: string, ceremonyId: string): void;
156
+ getRelationalWeb(nodeId: string, depth?: number): {
157
+ nodes: StoredNode[];
158
+ edges: StoredEdge[];
159
+ };
160
+ logCeremony(ceremony: StoredCeremony): void;
161
+ getCeremony(id: string): StoredCeremony | undefined;
162
+ getAllCeremonies(limit?: number): StoredCeremony[];
163
+ getCeremoniesByDirection(direction: string): StoredCeremony[];
164
+ getCeremoniesByType(type: string): StoredCeremony[];
165
+ createBeat(beat: StoredBeat): void;
166
+ getBeat(id: string): StoredBeat | undefined;
167
+ getAllBeats(limit?: number): StoredBeat[];
168
+ getBeatsByDirection(direction: string): StoredBeat[];
169
+ createCycle(cycle: StoredCycle): void;
170
+ getCycle(id: string): StoredCycle | undefined;
171
+ getAllCycles(): {
172
+ active: StoredCycle[];
173
+ archived: StoredCycle[];
174
+ };
175
+ archiveCycle(id: string): void;
176
+ saveChart(chart: StoredChart): void;
177
+ getChart(id: string): StoredChart | undefined;
178
+ getAllCharts(direction?: string): StoredChart[];
179
+ saveMmot(mmot: StoredMmot): void;
180
+ getMmotsByChart(chartId: string): StoredMmot[];
181
+ }
182
+ export declare function getJsonlStore(dataDir?: string): JsonlStore;
183
+ export {};
184
+ //# sourceMappingURL=jsonl-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsonl-store.d.ts","sourceRoot":"","sources":["../src/jsonl-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAOH,UAAU,UAAU;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,UAAU;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,cAAc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