mcp-council-server 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.
- package/README.md +645 -0
- package/package.json +54 -0
- package/src/analysis/parser.js +92 -0
- package/src/config.js +26 -0
- package/src/db/database.js +12 -0
- package/src/db/json-store.js +122 -0
- package/src/db/migrations.js +16 -0
- package/src/index.js +28 -0
- package/src/memory/decision.js +37 -0
- package/src/memory/phase.js +82 -0
- package/src/memory/recall.js +108 -0
- package/src/memory/session.js +80 -0
- package/src/prinsip/adaptive.js +139 -0
- package/src/prinsip/agentic.js +138 -0
- package/src/prinsip/transparency.js +87 -0
- package/src/score/agentic.js +28 -0
- package/src/score/completeness.js +76 -0
- package/src/score/consistency.js +15 -0
- package/src/score/index.js +101 -0
- package/src/score/transparency.js +51 -0
- package/src/tools.js +556 -0
- package/src/verify/contradiction.js +125 -0
- package/src/verify/grounding.js +30 -0
package/README.md
ADDED
|
@@ -0,0 +1,645 @@
|
|
|
1
|
+
# 🏛️ Council MCP Server
|
|
2
|
+
|
|
3
|
+
**Council MCP Server** provides memory, state, and reasoning scaffolding for an AI (like opencode) to solve complex problems through **5 ordered phases** — all without any internal LLM calls. It uses pure deterministic logic + JSON file persistence.
|
|
4
|
+
|
|
5
|
+
> Dibuat oleh [**riflxz**](https://github.com/riflxz)
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Table of Contents
|
|
10
|
+
|
|
11
|
+
- [How It Works](#how-it-works)
|
|
12
|
+
- [Features](#features)
|
|
13
|
+
- [Architecture](#architecture)
|
|
14
|
+
- [Installation](#installation)
|
|
15
|
+
- [Quick Start](#quick-start)
|
|
16
|
+
- [MCP Tools Reference](#mcp-tools-reference)
|
|
17
|
+
- [council_init](#council_init)
|
|
18
|
+
- [council_save](#council_save)
|
|
19
|
+
- [council_recall](#council_recall)
|
|
20
|
+
- [council_verify](#council_verify)
|
|
21
|
+
- [council_continue](#council_continue)
|
|
22
|
+
- [council_score](#council_score)
|
|
23
|
+
- [Phases & Personas](#phases--personas)
|
|
24
|
+
- [Three Core Principles](#three-core-principles)
|
|
25
|
+
- [Scoring System](#scoring-system)
|
|
26
|
+
- [Testing](#testing)
|
|
27
|
+
- [Project Structure](#project-structure)
|
|
28
|
+
- [License](#license)
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## How It Works
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
Task Input
|
|
36
|
+
│
|
|
37
|
+
▼
|
|
38
|
+
┌──────────────────────────────────────────────────────────┐
|
|
39
|
+
│ council_init │
|
|
40
|
+
│ • Parse task & assess complexity │
|
|
41
|
+
│ • Generate adaptive pipeline depth │
|
|
42
|
+
│ • Assign first persona │
|
|
43
|
+
│ • Initialize session state │
|
|
44
|
+
└──────────────────────┬───────────────────────────────────┘
|
|
45
|
+
│
|
|
46
|
+
▼
|
|
47
|
+
┌─────────────────────┐
|
|
48
|
+
│ PERSONA: │ ◄── Each phase has a
|
|
49
|
+
│ Analyst │ unique persona with
|
|
50
|
+
│ Architect │ defined authority
|
|
51
|
+
│ Auditor │ boundaries
|
|
52
|
+
│ Engineer │
|
|
53
|
+
│ QA │
|
|
54
|
+
└────────┬────────────┘
|
|
55
|
+
│
|
|
56
|
+
┌─────────────┴─────────────┐
|
|
57
|
+
│ council_save │
|
|
58
|
+
│ • Validate authority │
|
|
59
|
+
│ • Score output │
|
|
60
|
+
│ • Check contradictions │
|
|
61
|
+
│ • Build handshake │
|
|
62
|
+
│ • Unlock next phase │
|
|
63
|
+
└─────────────┬─────────────┘
|
|
64
|
+
│
|
|
65
|
+
▼
|
|
66
|
+
┌──────────────────┐
|
|
67
|
+
│ Score ≥ 70? │
|
|
68
|
+
└──────┬───┬───────┘
|
|
69
|
+
Yes │ │ No
|
|
70
|
+
│ └──→ Improve & re-save
|
|
71
|
+
▼
|
|
72
|
+
┌──────────────────────┐
|
|
73
|
+
│ Unlock next phase │
|
|
74
|
+
│ Handoff to next │
|
|
75
|
+
│ persona │
|
|
76
|
+
└──────────────────────┘
|
|
77
|
+
│
|
|
78
|
+
┌───────────┴───────────┐
|
|
79
|
+
│ Loop through 5 │
|
|
80
|
+
│ phases: │
|
|
81
|
+
│ decompile → design │
|
|
82
|
+
│ → critique → synth │
|
|
83
|
+
│ → verify │
|
|
84
|
+
└───────────┬───────────┘
|
|
85
|
+
│
|
|
86
|
+
▼
|
|
87
|
+
┌──────────────────────┐
|
|
88
|
+
│ council_score │
|
|
89
|
+
│ Final assessment │
|
|
90
|
+
└──────────────────────┘
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Features
|
|
96
|
+
|
|
97
|
+
| Feature | Description |
|
|
98
|
+
|---------|-------------|
|
|
99
|
+
| **🧠 5-Phase Reasoning Pipeline** | Decompile → Design → Critique → Synthesis → Verify |
|
|
100
|
+
| **👤 Persona-Based Execution** | Each phase has a unique persona (Analyst, Architect, Auditor, Engineer, QA) with defined authority boundaries |
|
|
101
|
+
| **📊 Complexity-Adaptive Pipeline** | Automatically selects light/standard/full pipeline based on task complexity scoring |
|
|
102
|
+
| **🔍 Contradiction Detection** | Cross-phase numerical and polarity contradiction detection |
|
|
103
|
+
| **📝 Transparency Logging** | Certainty levels (5 tiers), knowledge boundaries, assumption flags |
|
|
104
|
+
| **🔐 Authority Enforcement** | Each persona has strict authority boundaries — violations generate warnings |
|
|
105
|
+
| **🤝 Handshake Protocol** | Structured phase-to-phase handoff with context passing and conflict resolution |
|
|
106
|
+
| **💾 JSON Persistence** | Zero-dependency JSON file store — collections: sessions, phases, decisions, claims, transparency_log, phase_handoffs |
|
|
107
|
+
| **📈 Multi-Dimensional Scoring** | Completeness, consistency, decision quality, structure, transparency, agentic — weighted aggregate |
|
|
108
|
+
| **🔌 MCP Protocol** | 6 tools exposed via stdio MCP transport — compatible with any MCP host |
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Architecture
|
|
113
|
+
|
|
114
|
+
```
|
|
115
|
+
src/
|
|
116
|
+
├── index.js # Entry point — McpServer + StdioServerTransport
|
|
117
|
+
├── tools.js # All 6 MCP tool handlers (~600 lines)
|
|
118
|
+
├── db/
|
|
119
|
+
│ └── json-store.js # Generic JSON file CRUD (getAll, insert, updateWhere, etc.)
|
|
120
|
+
├── memory/
|
|
121
|
+
│ ├── session.js # Session CRUD & lifecycle
|
|
122
|
+
│ ├── phase.js # Phase state machine & transitions
|
|
123
|
+
│ ├── decision.js # Decision trace storage
|
|
124
|
+
│ └── recall.js # Context composer (full/summary/decisions formats)
|
|
125
|
+
├── analysis/
|
|
126
|
+
│ └── parser.js # Task structure parser (sentence splitting, keyword extraction)
|
|
127
|
+
├── prinsip/
|
|
128
|
+
│ ├── adaptive.js # Complexity detector + pipeline generator
|
|
129
|
+
│ ├── transparency.js # Certainty validation, knowledge boundaries, assumption flags
|
|
130
|
+
│ └── agentic.js # Persona definitions, authority validation, handshake builder
|
|
131
|
+
├── verify/
|
|
132
|
+
│ ├── contradiction.js # Numerical + polarity contradiction detection
|
|
133
|
+
│ └── grounding.js # Claim source verification
|
|
134
|
+
└── score/
|
|
135
|
+
├── completeness.js # Per-phase field requirement checker
|
|
136
|
+
├── consistency.js # Contradiction-based consistency scoring
|
|
137
|
+
├── transparency.js # 3-dimension transparency scoring
|
|
138
|
+
├── agentic.js # Authority violation + persona match scoring
|
|
139
|
+
└── index.js # Weighted aggregator -> final score + verdict + suggestions
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Data Flow
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
Tool Call → tools.js handler → memory/* → analysis/* → prinsip/*
|
|
146
|
+
↓ ↓
|
|
147
|
+
verify/* ←─────────────── score/*
|
|
148
|
+
↓
|
|
149
|
+
JSON response to MCP client
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### JSON Store
|
|
153
|
+
|
|
154
|
+
Six collections in `./data/`:
|
|
155
|
+
| Collection | Purpose |
|
|
156
|
+
|-----------|---------|
|
|
157
|
+
| `sessions.json` | Session metadata, status, complexity score |
|
|
158
|
+
| `phases.json` | Phase records with output, confidence, authority warnings |
|
|
159
|
+
| `decisions.json` | Decision trace per phase |
|
|
160
|
+
| `claims.json` | Claims with certainty levels and sources |
|
|
161
|
+
| `transparency_log.json` | Transparency log entries |
|
|
162
|
+
| `phase_handoffs.json` | Phase-to-phase handshake records |
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## Installation
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
# Install from npm
|
|
170
|
+
npm install -g mcp-council-server
|
|
171
|
+
|
|
172
|
+
# Or run directly with npx
|
|
173
|
+
npx mcp-council-server
|
|
174
|
+
|
|
175
|
+
# Or clone and run locally
|
|
176
|
+
git clone https://github.com/riflxz/mcp-council-server.git
|
|
177
|
+
cd mcp-council-server
|
|
178
|
+
npm install
|
|
179
|
+
npm start
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Requirements
|
|
183
|
+
- Node.js >= 18.0.0
|
|
184
|
+
- No native compilation needed — works on arm64 Linux (Node.js v26+)
|
|
185
|
+
- No database — pure JSON file persistence
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## Quick Start
|
|
190
|
+
|
|
191
|
+
### 1. Start the server
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
npm start
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
The server listens on **stdin/stdout** using the MCP stdio transport protocol.
|
|
198
|
+
|
|
199
|
+
### 2. Connect with MCP Inspector
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
npm run inspect
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### 3. Or use with any MCP client (e.g., opencode, Claude Desktop)
|
|
206
|
+
|
|
207
|
+
Add to your MCP configuration:
|
|
208
|
+
|
|
209
|
+
```json
|
|
210
|
+
{
|
|
211
|
+
"mcpServers": {
|
|
212
|
+
"council": {
|
|
213
|
+
"command": "node",
|
|
214
|
+
"args": ["/path/to/mcp-council-server/src/index.js"]
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### 4. Make your first call
|
|
221
|
+
|
|
222
|
+
```json
|
|
223
|
+
{
|
|
224
|
+
"jsonrpc": "2.0",
|
|
225
|
+
"id": 1,
|
|
226
|
+
"method": "tools/call",
|
|
227
|
+
"params": {
|
|
228
|
+
"name": "council_init",
|
|
229
|
+
"arguments": {
|
|
230
|
+
"task": "Migrasi database MySQL ke PostgreSQL. 2GB data, downtime <30 menit. Handling JSON dan ENUM types."
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
## MCP Tools Reference
|
|
239
|
+
|
|
240
|
+
### council_init
|
|
241
|
+
|
|
242
|
+
Creates a new reasoning session. Parses the task, assesses complexity, generates an adaptive pipeline, assigns the first persona.
|
|
243
|
+
|
|
244
|
+
**Parameters:**
|
|
245
|
+
|
|
246
|
+
| Field | Type | Required | Description |
|
|
247
|
+
|-------|------|----------|-------------|
|
|
248
|
+
| `task` | string | ✅ | The problem or task to solve |
|
|
249
|
+
| `title` | string | ❌ | Optional session title |
|
|
250
|
+
| `context` | string | ❌ | Additional context for the AI |
|
|
251
|
+
|
|
252
|
+
**Response:**
|
|
253
|
+
|
|
254
|
+
```json
|
|
255
|
+
{
|
|
256
|
+
"type": "council_init",
|
|
257
|
+
"sessionId": "uuid",
|
|
258
|
+
"adaptation": {
|
|
259
|
+
"complexity": { "raw": 49, "normalized": 49, "level": "moderate", "pipelineDepth": "standard" },
|
|
260
|
+
"pipeline": [
|
|
261
|
+
{ "name": "decompile", "persona": "analyst", "depth": "standard", "order": 1 },
|
|
262
|
+
{ "name": "design", "persona": "architect", "depth": "standard", "order": 2 },
|
|
263
|
+
{ "name": "critique", "persona": "auditor", "depth": "standard", "order": 3 },
|
|
264
|
+
{ "name": "synthesis", "persona": "engineer", "depth": "standard", "order": 4 },
|
|
265
|
+
{ "name": "verify", "persona": "qa", "depth": "standard", "order": 5 }
|
|
266
|
+
],
|
|
267
|
+
"adaptiveReason": "Complexity score 49/100 (moderate). Pipeline: standard."
|
|
268
|
+
},
|
|
269
|
+
"personas": { "current": { "name": "Systems Analyst", "identity": "...", "authority": [...], "notAuthority": [...], "handoffMessage": "..." } },
|
|
270
|
+
"phase": "decompile",
|
|
271
|
+
"phasePlan": [ { "name": "decompile", "status": "active" }, { "name": "design", "status": "locked" }, ... ],
|
|
272
|
+
"instructions": "Fase DECOMPOSE (standar): Uraikan task ke komponen-komponen...",
|
|
273
|
+
"memorySlots": { "originalTask": "...", "decompositions": [], "decisions": [], "constraints": [], "criticalQuestions": [] },
|
|
274
|
+
"transparencyLog": { "entries": [], "count": 0 }
|
|
275
|
+
}
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
### council_save
|
|
281
|
+
|
|
282
|
+
Saves phase output, scores it, detects contradictions, builds a handshake to the next phase.
|
|
283
|
+
|
|
284
|
+
**Parameters:**
|
|
285
|
+
|
|
286
|
+
| Field | Type | Required | Description |
|
|
287
|
+
|-------|------|----------|-------------|
|
|
288
|
+
| `sessionId` | string | ✅ | Session ID from council_init |
|
|
289
|
+
| `phase` | string | ✅ | Phase name (decompile/design/critique/synthesis/verify) |
|
|
290
|
+
| `output` | object | ✅ | Phase-specific output fields |
|
|
291
|
+
|
|
292
|
+
**Phase-Specific Output Fields:**
|
|
293
|
+
|
|
294
|
+
| Phase | Required Fields | Optional Fields |
|
|
295
|
+
|-------|----------------|-----------------|
|
|
296
|
+
| `decompile` | summary, decisions, constraints, confidence, criticalQuestions, claims | knowledgeBoundary |
|
|
297
|
+
| `design` | summary, approaches, justification, tradeoffs, recommended, decisions | claims, knowledgeBoundary, confidence |
|
|
298
|
+
| `critique` | summary, vulnerabilities, riskLevel, mitigation, confidence | claims, knowledgeBoundary, constraints |
|
|
299
|
+
| `synthesis` | summary, implementation, testing, warnings | decisions, claims, knowledgeBoundary, confidence |
|
|
300
|
+
| `verify` | summary, checks, passedCount, failedCount, finalConfidence | decision, recommendations, claims, knowledgeBoundary |
|
|
301
|
+
|
|
302
|
+
**Response:**
|
|
303
|
+
|
|
304
|
+
```json
|
|
305
|
+
{
|
|
306
|
+
"type": "council_save",
|
|
307
|
+
"status": "saved",
|
|
308
|
+
"phase": "decompile",
|
|
309
|
+
"scoring": {
|
|
310
|
+
"finalScore": 93,
|
|
311
|
+
"verdict": "excellent",
|
|
312
|
+
"dimensions": {
|
|
313
|
+
"completeness": { "score": 100, "passed": [...], "failed": [] },
|
|
314
|
+
"consistency": { "score": 100, "contradictions": [], "warnings": [] },
|
|
315
|
+
"transparency": { "score": 87, "details": { "certainty": 35, "knowledgeBoundary": 32, "assumptions": 20 } },
|
|
316
|
+
"agentic": { "score": 100, "violations": [] }
|
|
317
|
+
}
|
|
318
|
+
},
|
|
319
|
+
"canProceed": true,
|
|
320
|
+
"handoff": {
|
|
321
|
+
"from": "decompile",
|
|
322
|
+
"to": "design",
|
|
323
|
+
"personaTransition": { "fromPersona": "Systems Analyst", "toPersona": "Solution Architect" },
|
|
324
|
+
"conflicts": [],
|
|
325
|
+
"handshake": { "fromAuthority": [...], "toAuthority": [...], "context": [...] }
|
|
326
|
+
},
|
|
327
|
+
"nextPhase": "design",
|
|
328
|
+
"phasePlan": [ { "name": "decompile", "status": "locked" }, { "name": "design", "status": "active" }, ... ],
|
|
329
|
+
"sessionComplete": false
|
|
330
|
+
}
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
---
|
|
334
|
+
|
|
335
|
+
### council_recall
|
|
336
|
+
|
|
337
|
+
Retrieves session context for the AI to maintain state continuity.
|
|
338
|
+
|
|
339
|
+
**Parameters:**
|
|
340
|
+
|
|
341
|
+
| Field | Type | Required | Description |
|
|
342
|
+
|-------|------|----------|-------------|
|
|
343
|
+
| `sessionId` | string | ✅ | Session ID |
|
|
344
|
+
| `format` | string | ❌ | `"full"` (default), `"summary"`, or `"decisions"` |
|
|
345
|
+
|
|
346
|
+
**Response:**
|
|
347
|
+
|
|
348
|
+
```json
|
|
349
|
+
{
|
|
350
|
+
"type": "council_recall",
|
|
351
|
+
"sessionId": "uuid",
|
|
352
|
+
"status": "active",
|
|
353
|
+
"progress": "2/5",
|
|
354
|
+
"currentPhase": { "name": "design", "persona": "Solution Architect", "status": "active" },
|
|
355
|
+
"phases": [{ "name": "decompile", "status": "done", "score": 93 }, { "name": "design", "status": "active", "score": null }],
|
|
356
|
+
"summary": "...",
|
|
357
|
+
"decisions": [...],
|
|
358
|
+
"warnings": [],
|
|
359
|
+
"transparencyLog": { "entries": [...], "count": 2 }
|
|
360
|
+
}
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
---
|
|
364
|
+
|
|
365
|
+
### council_verify
|
|
366
|
+
|
|
367
|
+
Verifies claims against the session store — detects contradictions and checks grounding.
|
|
368
|
+
|
|
369
|
+
**Parameters:**
|
|
370
|
+
|
|
371
|
+
| Field | Type | Required | Description |
|
|
372
|
+
|-------|------|----------|-------------|
|
|
373
|
+
| `sessionId` | string | ✅ | Session ID |
|
|
374
|
+
| `claims` | array | ✅ | Array of claims to verify: `[{ text, source }]` |
|
|
375
|
+
| `mode` | string | ❌ | `"contradiction"`, `"grounding"`, or `"all"` (default) |
|
|
376
|
+
|
|
377
|
+
**Response:**
|
|
378
|
+
|
|
379
|
+
```json
|
|
380
|
+
{
|
|
381
|
+
"type": "council_verify",
|
|
382
|
+
"mode": "all",
|
|
383
|
+
"results": {
|
|
384
|
+
"contradictions": [...],
|
|
385
|
+
"grounding": { "verified": 1, "unverified": 1, "verifiedPct": 50 }
|
|
386
|
+
},
|
|
387
|
+
"summary": { "total": 2, "passed": 1, "failed": 1 }
|
|
388
|
+
}
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
---
|
|
392
|
+
|
|
393
|
+
### council_continue
|
|
394
|
+
|
|
395
|
+
Resumes a session from where it left off — restores full context.
|
|
396
|
+
|
|
397
|
+
**Parameters:**
|
|
398
|
+
|
|
399
|
+
| Field | Type | Required | Description |
|
|
400
|
+
|-------|------|----------|-------------|
|
|
401
|
+
| `sessionId` | string | ✅ | Session ID |
|
|
402
|
+
|
|
403
|
+
**Response:**
|
|
404
|
+
|
|
405
|
+
```json
|
|
406
|
+
{
|
|
407
|
+
"type": "council_continue",
|
|
408
|
+
"sessionId": "uuid",
|
|
409
|
+
"status": "active",
|
|
410
|
+
"currentPhase": { "name": "critique", "persona": "Security & Quality Auditor", "status": "active" },
|
|
411
|
+
"personas": { "current": { ... } },
|
|
412
|
+
"phasePlan": [...],
|
|
413
|
+
"instructions": "...",
|
|
414
|
+
"memorySlots": { ... },
|
|
415
|
+
"transparencyLog": { ... }
|
|
416
|
+
}
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
---
|
|
420
|
+
|
|
421
|
+
### council_score
|
|
422
|
+
|
|
423
|
+
Generates a final multi-dimensional quality assessment for the completed session.
|
|
424
|
+
|
|
425
|
+
**Parameters:**
|
|
426
|
+
|
|
427
|
+
| Field | Type | Required | Description |
|
|
428
|
+
|-------|------|----------|-------------|
|
|
429
|
+
| `sessionId` | string | ✅ | Session ID |
|
|
430
|
+
|
|
431
|
+
**Response:**
|
|
432
|
+
|
|
433
|
+
```json
|
|
434
|
+
{
|
|
435
|
+
"type": "council_score",
|
|
436
|
+
"sessionId": "uuid",
|
|
437
|
+
"overall": {
|
|
438
|
+
"finalScore": 87,
|
|
439
|
+
"verdict": "good",
|
|
440
|
+
"qualityScore": 89,
|
|
441
|
+
"adaptabilityScore": 85,
|
|
442
|
+
"transparencyScore": 100,
|
|
443
|
+
"agenticScore": 71
|
|
444
|
+
},
|
|
445
|
+
"phaseScores": {
|
|
446
|
+
"decompile": { "score": 93, "verdict": "excellent" },
|
|
447
|
+
"design": { "score": 93, "verdict": "excellent" },
|
|
448
|
+
"critique": { "score": 82, "verdict": "good" },
|
|
449
|
+
"synthesis": { "score": 91, "verdict": "excellent" },
|
|
450
|
+
"verify": { "score": 82, "verdict": "good" }
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
---
|
|
456
|
+
|
|
457
|
+
## Phases & Personas
|
|
458
|
+
|
|
459
|
+
| Phase | Persona | Authority | Not Authority |
|
|
460
|
+
|-------|---------|-----------|---------------|
|
|
461
|
+
| **decompile** | Systems Analyst | Decompose tasks, identify constraints & hidden requirements, ask clarifying questions | ❌ No solutions ❌ No tech evaluation ❌ No design decisions |
|
|
462
|
+
| **design** | Solution Architect | Define approaches, evaluate tradeoffs, recommend solutions | ❌ No implementation ❌ No code ❌ No detailed testing |
|
|
463
|
+
| **critique** | Security & Quality Auditor | Identify risks, verify constraints, check security | ❌ No solutions ❌ No designs ❌ No implementation |
|
|
464
|
+
| **synthesis** | Implementation Engineer | Write implementation steps, create test plans | ❌ No architecture changes ❌ No requirement changes |
|
|
465
|
+
| **verify** | Quality Assurance | Run checks, validate completeness, approve/reject | ❌ No redesign ❌ No reimplementation |
|
|
466
|
+
|
|
467
|
+
### Handshake Protocol
|
|
468
|
+
|
|
469
|
+
Each phase transition includes a formal handshake:
|
|
470
|
+
1. **From Persona** sends context + unresolved items
|
|
471
|
+
2. **To Persona** acknowledges context
|
|
472
|
+
3. **Conflicts** between phases are documented
|
|
473
|
+
4. **Scoring ≥ 70** required to proceed to next phase
|
|
474
|
+
|
|
475
|
+
---
|
|
476
|
+
|
|
477
|
+
## Three Core Principles
|
|
478
|
+
|
|
479
|
+
### 🔄 ADAPTIF — Adaptive Pipeline Depth
|
|
480
|
+
|
|
481
|
+
The server assesses task complexity and adjusts pipeline depth:
|
|
482
|
+
|
|
483
|
+
| Complexity Score | Level | Pipeline Depth | Description |
|
|
484
|
+
|----------------|-------|---------------|-------------|
|
|
485
|
+
| 0–20 | Simple | Light | decompile → synthesis → verify |
|
|
486
|
+
| 21–60 | Moderate | Standard | decompile → design → critique → synthesis → verify |
|
|
487
|
+
| 61–100 | Complex | Full | decompile → design → critique → synthesis → verify (deep) + looping |
|
|
488
|
+
|
|
489
|
+
**Complexity factors:**
|
|
490
|
+
- Baseline: 10
|
|
491
|
+
- Keywords per hit: +8 (migration, security, kubernetes, performance, etc.)
|
|
492
|
+
- Domain boost: +10 (migration/security/kubernetes/performance)
|
|
493
|
+
- Numbers detected: +5
|
|
494
|
+
|
|
495
|
+
### 👁️ TRANSPARANSI — Certainty & Knowledge Boundaries
|
|
496
|
+
|
|
497
|
+
**5 Certainty Levels:**
|
|
498
|
+
|
|
499
|
+
| Level | Label | Description |
|
|
500
|
+
|-------|-------|-------------|
|
|
501
|
+
| 1 | Confirmed | Verified from reliable source |
|
|
502
|
+
| 2 | Likely | High confidence, not yet verified |
|
|
503
|
+
| 3 | Uncertain | Need further investigation |
|
|
504
|
+
| 4 | Unknown | No information available |
|
|
505
|
+
| 5 | Assumption | Used as working hypothesis |
|
|
506
|
+
|
|
507
|
+
**Knowledge Boundary tracking:**
|
|
508
|
+
- `whatIKnow` — confidently known
|
|
509
|
+
- `whatIAssume` — working assumptions
|
|
510
|
+
- `whatIDontKnow` — known unknowns
|
|
511
|
+
- `whatNeedsVerification` — requires external validation
|
|
512
|
+
|
|
513
|
+
### 🤖 AGENTIC — Persona Authority
|
|
514
|
+
|
|
515
|
+
Each persona has defined:
|
|
516
|
+
- **Identity** — who they are
|
|
517
|
+
- **Authority** — what they CAN do
|
|
518
|
+
- **Not Authority** — what they CANNOT do
|
|
519
|
+
- **Handoff Message** — what they pass to the next persona
|
|
520
|
+
|
|
521
|
+
Authority violations (e.g., decompile suggesting a solution) are flagged with warnings and penalty scoring.
|
|
522
|
+
|
|
523
|
+
---
|
|
524
|
+
|
|
525
|
+
## Scoring System
|
|
526
|
+
|
|
527
|
+
### Per-Phase Scoring
|
|
528
|
+
|
|
529
|
+
| Dimension | Weight | Description |
|
|
530
|
+
|-----------|--------|-------------|
|
|
531
|
+
| Completeness | 25% | Required fields present, correct types, minimum lengths |
|
|
532
|
+
| Consistency | 25% | No contradictions with previous phases (numerical, polarity, constraint compliance) |
|
|
533
|
+
| Decision Quality | 15% | Quality of decisions made in the phase |
|
|
534
|
+
| Structure | 10% | Structural organization of output |
|
|
535
|
+
| Transparency | 15% | Certainty levels, knowledge boundaries, assumption flags |
|
|
536
|
+
| Agentic | 10% | No authority violations, persona identity keywords present |
|
|
537
|
+
|
|
538
|
+
### Score Thresholds
|
|
539
|
+
|
|
540
|
+
| Score Range | Verdict | Action |
|
|
541
|
+
|-------------|---------|--------|
|
|
542
|
+
| ≥ 90 | Excellent | Auto-proceed to next phase |
|
|
543
|
+
| 70–89 | Good | Proceed to next phase |
|
|
544
|
+
| 50–69 | Needs Improvement | Can still proceed, but review suggestions |
|
|
545
|
+
| < 50 | Insufficient | Must improve before proceeding |
|
|
546
|
+
|
|
547
|
+
### Final Session Score
|
|
548
|
+
|
|
549
|
+
Weighted aggregate of all phase scores plus cross-cutting assessments:
|
|
550
|
+
- **Quality Score** — average phase quality
|
|
551
|
+
- **Adaptability Score** — how well pipeline depth matches task
|
|
552
|
+
- **Transparency Score** — consistency of transparency across phases
|
|
553
|
+
- **Agentic Score** — authority compliance across phases
|
|
554
|
+
|
|
555
|
+
---
|
|
556
|
+
|
|
557
|
+
## Testing
|
|
558
|
+
|
|
559
|
+
```bash
|
|
560
|
+
# Run full integration test (5 phases + final score)
|
|
561
|
+
node test_full.mjs
|
|
562
|
+
```
|
|
563
|
+
|
|
564
|
+
The test script:
|
|
565
|
+
1. Creates a session with a migration task
|
|
566
|
+
2. Runs all 5 phases (decompile → design → critique → synthesis → verify)
|
|
567
|
+
3. Verifies phase gating (cannot skip phases)
|
|
568
|
+
4. Tests recall and continue tools
|
|
569
|
+
5. Generates final council_score
|
|
570
|
+
6. Reports pass/fail for each step
|
|
571
|
+
|
|
572
|
+
Example output:
|
|
573
|
+
```
|
|
574
|
+
1. INIT → moderate (49) 5ph persona:Systems Analyst
|
|
575
|
+
2. DECOMPILE → 93 (excellent) proceed:true → design
|
|
576
|
+
3. DESIGN → 93 (excellent) proceed:true → critique
|
|
577
|
+
4. CRITIQUE → 82 (good) proceed:true → synthesis
|
|
578
|
+
5. SYNTHESIS → 91 (excellent) proceed:true → verify
|
|
579
|
+
6. VERIFY → 82 (good) proceed:true complete:true
|
|
580
|
+
7. SCORE → 87 (good) q:89 a:85 t:100 ag:71
|
|
581
|
+
|
|
582
|
+
✅ 7/7 passed
|
|
583
|
+
```
|
|
584
|
+
|
|
585
|
+
---
|
|
586
|
+
|
|
587
|
+
## Project Structure
|
|
588
|
+
|
|
589
|
+
```
|
|
590
|
+
mcp-council-server/
|
|
591
|
+
├── package.json
|
|
592
|
+
├── README.md
|
|
593
|
+
├── .env.example
|
|
594
|
+
├── .gitignore
|
|
595
|
+
├── src/
|
|
596
|
+
│ ├── index.js # Entry point
|
|
597
|
+
│ ├── tools.js # MCP tool handlers
|
|
598
|
+
│ ├── db/
|
|
599
|
+
│ │ └── json-store.js # JSON file persistence
|
|
600
|
+
│ ├── memory/
|
|
601
|
+
│ │ ├── session.js # Session lifecycle
|
|
602
|
+
│ │ ├── phase.js # Phase state machine
|
|
603
|
+
│ │ ├── decision.js # Decision trace
|
|
604
|
+
│ │ └── recall.js # Context composer
|
|
605
|
+
│ ├── analysis/
|
|
606
|
+
│ │ └── parser.js # Task parser
|
|
607
|
+
│ ├── prinsip/
|
|
608
|
+
│ │ ├── adaptive.js # Complexity detection
|
|
609
|
+
│ │ ├── transparency.js # Certainty & knowledge boundaries
|
|
610
|
+
│ │ └── agentic.js # Personas & authority
|
|
611
|
+
│ ├── verify/
|
|
612
|
+
│ │ ├── contradiction.js # Contradiction detection
|
|
613
|
+
│ │ └── grounding.js # Claim verification
|
|
614
|
+
│ └── score/
|
|
615
|
+
│ ├── completeness.js # Completeness checker
|
|
616
|
+
│ ├── consistency.js # Consistency scoring
|
|
617
|
+
│ ├── transparency.js # Transparency scoring
|
|
618
|
+
│ ├── agentic.js # Agentic scoring
|
|
619
|
+
│ └── index.js # Aggregator
|
|
620
|
+
├── test_flow.mjs # Test script
|
|
621
|
+
├── test_debug.mjs # Debug tool
|
|
622
|
+
└── test_full.mjs # Full integration test
|
|
623
|
+
```
|
|
624
|
+
|
|
625
|
+
---
|
|
626
|
+
|
|
627
|
+
## Why Not an Internal LLM?
|
|
628
|
+
|
|
629
|
+
Council does NOT call any LLM internally. Instead:
|
|
630
|
+
|
|
631
|
+
1. **The AI (opencode/Claude/etc.)** is the reasoner — it reads the tool responses, produces phase outputs, and makes decisions
|
|
632
|
+
2. **Council** provides the scaffolding — memory, state, structure, scoring, and guardrails
|
|
633
|
+
3. **Pure deterministic logic** — no API costs, no latency, no black-box behavior
|
|
634
|
+
4. **Full transparency** — every score, contradiction, and authority warning is explainable
|
|
635
|
+
|
|
636
|
+
This separation of concerns means:
|
|
637
|
+
- The AI stays focused on reasoning
|
|
638
|
+
- Council stays focused on structure and quality
|
|
639
|
+
- No vendor lock-in — works with any MCP-compatible AI
|
|
640
|
+
|
|
641
|
+
---
|
|
642
|
+
|
|
643
|
+
## License
|
|
644
|
+
|
|
645
|
+
MIT © [riflxz](https://github.com/riflxz)
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mcp-council-server",
|
|
3
|
+
"version": "4.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Council MCP Server — AI reasoning scaffolding with memory, state, and persona-based phase orchestration for complex problem-solving via MCP protocol",
|
|
6
|
+
"main": "src/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"mcp-council-server": "src/index.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"start": "node src/index.js",
|
|
12
|
+
"inspect": "npx @modelcontextprotocol/inspector node src/index.js"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@modelcontextprotocol/sdk": "1.8.0",
|
|
16
|
+
"dotenv": "16.4.7",
|
|
17
|
+
"uuid": "11.0.3",
|
|
18
|
+
"zod": "3.23.8"
|
|
19
|
+
},
|
|
20
|
+
"author": {
|
|
21
|
+
"name": "riflxz",
|
|
22
|
+
"url": "https://github.com/riflxz"
|
|
23
|
+
},
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "git+https://github.com/riflxz/mcp-council-server.git"
|
|
27
|
+
},
|
|
28
|
+
"bugs": {
|
|
29
|
+
"url": "https://github.com/riflxz/mcp-council-server/issues"
|
|
30
|
+
},
|
|
31
|
+
"homepage": "https://github.com/riflxz/mcp-council-server#readme",
|
|
32
|
+
"keywords": [
|
|
33
|
+
"mcp",
|
|
34
|
+
"model-context-protocol",
|
|
35
|
+
"council",
|
|
36
|
+
"ai-scaffolding",
|
|
37
|
+
"reasoning",
|
|
38
|
+
"llm",
|
|
39
|
+
"agent",
|
|
40
|
+
"opencode",
|
|
41
|
+
"persona",
|
|
42
|
+
"orchestration"
|
|
43
|
+
],
|
|
44
|
+
"license": "MIT",
|
|
45
|
+
"engines": {
|
|
46
|
+
"node": ">=18.0.0"
|
|
47
|
+
},
|
|
48
|
+
"files": [
|
|
49
|
+
"src/",
|
|
50
|
+
"README.md",
|
|
51
|
+
"LICENSE",
|
|
52
|
+
"package.json"
|
|
53
|
+
]
|
|
54
|
+
}
|