Skip to content

Commit a263656

Browse files
committed
Add mastervault-mcp-server v1.1.1
A project by JustMichael-80 (https://github.com/JustMichael-80). Headless, filesystem-backed MCP server that serves a MasterVault (files + its orientation/decision-log/soft-delete protocol) to any MCP client over stdio.
1 parent 14c2ae2 commit a263656

15 files changed

Lines changed: 4003 additions & 0 deletions

File tree

‎mastervault-mcp-server/.gitignore‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules/
2+
dist/
3+
dist-bundled/
4+
*.log

‎mastervault-mcp-server/HANDOFF.md‎

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Handoff Spec — Deferred Work
2+
3+
This is the scoped, mechanical work deliberately left out of v1 so it can be
4+
handed to a cheaper model (in ModelForge, Claude Code, or a Sonnet session)
5+
rather than spending premium tokens on it. v1 is complete and verified without
6+
any of the below; these are additive.
7+
8+
## Context for the model picking this up
9+
10+
`mastervault-mcp-server` is a TypeScript stdio MCP server that serves a
11+
"MasterVault" (a structured Obsidian-style knowledge vault) to any MCP client,
12+
without Obsidian. It has 9 tools across three tiers (protocol / files / delete).
13+
The build passes (`npm run build`), a functional harness passes 12/12 including
14+
path-traversal security tests, and an MCP stdio handshake exposes all 9 tools.
15+
Read `README.md` first, then `src/` — start at `src/index.ts`.
16+
17+
Do not change the security model in `src/services/vault.ts` without re-running
18+
`node test-harness.mjs` and keeping all security tests green.
19+
20+
## Task 1 — Evaluation suite (mcp-builder Phase 4)
21+
22+
The mcp-builder skill asks for 10 evaluation questions in XML. Create
23+
`evaluations/eval.xml` with 10 `<qa_pair>` entries that test whether an LLM can
24+
use these tools to answer realistic questions about a vault. Each question must
25+
be independent, read-only, complex (multiple tool calls), realistic, verifiable
26+
(single string-comparable answer), and stable.
27+
28+
Build a small fixture vault under `evaluations/fixture-vault/` with known
29+
content so answers are deterministic. Example question shape: "Using orient then
30+
search, what confidence value is recorded for the vault-structure seed row?" →
31+
answer a specific string.
32+
33+
Format per the skill:
34+
```xml
35+
<evaluation>
36+
<qa_pair>
37+
<question>...</question>
38+
<answer>...</answer>
39+
</qa_pair>
40+
</evaluation>
41+
```
42+
43+
## Task 2 — Unit tests
44+
45+
Convert `test-harness.mjs` into a proper test suite (node:test or vitest). Cover:
46+
- VaultService: read (with/without line range), list pagination, search, write,
47+
append, move (collision + overwrite paths).
48+
- Security: `../` traversal, absolute path, escaping move, null byte — all must
49+
throw `PathSecurityError` or stay confined.
50+
- Tool layer: patch's zero-match and multi-match rejection; log_decision
51+
section-aware append when the category heading is absent vs present;
52+
stage_delete collision suffixing.
53+
Wire it to `npm test` and a `.github/workflows/ci.yml` that runs lint + build +
54+
test on push.
55+
56+
## Task 3 — Git read tools (v2 tool tier)
57+
58+
Add read-only git helpers as a fourth tier, mirroring ModelForge's own set:
59+
`mastervault_git_status`, `mastervault_git_log`, `mastervault_git_diff`. All
60+
`readOnlyHint: true`. Shell out to `git -C <vaultRoot>` with argument arrays
61+
(never string interpolation — no injection surface). Guard: if the vault is not
62+
a git repo, return an actionable message, not an error. Keep `git_commit` out
63+
unless explicitly requested — writes should stay behind the existing tools.
64+
65+
## Task 4 — Packaging niceties
66+
67+
- Add a `LICENSE` file (MIT) to match `package.json`.
68+
- Add `.gitignore` (`node_modules/`, `dist/`, `*.log`).
69+
- Consider publishing as an npm package so the ModelForge config can use
70+
`npx -y mastervault-mcp-server <vault>` like the filesystem-server example.
71+
72+
## Explicitly NOT in scope
73+
74+
- No hard-delete tool, ever.
75+
- No shell/run_command tool (clients provide their own).
76+
- No streamable-HTTP transport in v1 (stdio is the target for local clients like
77+
ModelForge). Add later only if a remote/multi-client use case appears; the
78+
mcp-builder TypeScript guide has the HTTP transport pattern ready to drop in.

‎mastervault-mcp-server/LICENSE‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 ChronoDyne Systems, Inc.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

‎mastervault-mcp-server/README.md‎

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# MasterVault MCP Server
2+
3+
A project by [JustMichael-80](https://github.com/JustMichael-80).
4+
5+
A headless, filesystem-backed [Model Context Protocol](https://modelcontextprotocol.io) server that serves **any MasterVault** — its files *and* its operating protocol — to any MCP client, over stdio. No Obsidian required.
6+
7+
Point it at a vault directory; any MCP-capable LLM client (ModelForge, Claude Desktop, AnythingLLM, etc.) can then orient on the vault's protocol, read and search its contents, log decisions, and soft-delete files — all behind the client's own approval flow.
8+
9+
## Why this exists
10+
11+
An Obsidian vault can already be served over MCP via the Local REST API plugin, but that ties it to Obsidian. This server drops the Obsidian dependency: it speaks the same vault semantics against a plain directory, so the MasterVault becomes portable to any client and any model. It also surfaces the vault's *protocol* (orientation, decision-logging, soft-delete), not just its files — so a fresh LLM can run the system, not merely read it.
12+
13+
## Install
14+
15+
```bash
16+
git clone https://github.com/JustMichael-80/mastervault-mcp-server.git
17+
cd mastervault-mcp-server
18+
npm install # also builds via the prepare script
19+
npm run build # (if you skipped prepare)
20+
```
21+
22+
Requires Node.js 18+.
23+
24+
## Run
25+
26+
```bash
27+
mastervault-mcp-server /absolute/path/to/vault
28+
# or
29+
MASTERVAULT_ROOT=/absolute/path/to/vault node dist/index.js
30+
```
31+
32+
The vault path is the only configuration. Nothing is hardcoded — the same binary serves any vault.
33+
34+
## Connecting a client
35+
36+
### ModelForge
37+
38+
In **Settings → MCP servers**, add a **stdio** server:
39+
40+
- **Command:** `node`
41+
- **Args:** `/absolute/path/to/mastervault-mcp-server/dist/index.js` `/absolute/path/to/vault`
42+
43+
(or use the `mastervault-mcp-server` bin directly if installed globally). The server's tools then appear in Agent mode's tool list, each behind ModelForge's Allow/Deny approval — exactly like its built-in file tools.
44+
45+
### Any MCP client (generic stdio config)
46+
47+
```json
48+
{
49+
"mcpServers": {
50+
"mastervault": {
51+
"command": "node",
52+
"args": ["/absolute/path/to/dist/index.js", "/absolute/path/to/vault"]
53+
}
54+
}
55+
}
56+
```
57+
58+
## Tools
59+
60+
| Tool | Tier | Read-only | What it does |
61+
|------|------|:---------:|--------------|
62+
| `mastervault_orient` | protocol | ✅ | Reads the orientation file and the protocol files it points to, in order. **Call this first.** |
63+
| `mastervault_get_confidence_summary` | protocol | ✅ | Returns the calibration dashboard (`_Meta/Confidence Summary.md`). |
64+
| `mastervault_log_decision` | protocol | ✍️ | Appends a consequential decision (proposal + confidence + verdict) to the right category in `_Meta/Decision Log.md`. |
65+
| `mastervault_read` | files | ✅ | Reads a file, optionally by line range; parses markdown frontmatter. |
66+
| `mastervault_list` | files | ✅ | Lists a directory, paginated, directories first. |
67+
| `mastervault_search` | files | ✅ | Case-insensitive full-text search across text files. |
68+
| `mastervault_write` | files | ✍️ | Creates or overwrites a file. |
69+
| `mastervault_patch` | files | ✍️ | Replaces one exact, unique text block in a file. |
70+
| `mastervault_stage_delete` | delete | ✍️ | Moves a file to `_ToDelete/` and logs the proposal. **Never hard-deletes.** |
71+
72+
Every tool supports `response_format: "markdown"` (default) or `"json"`.
73+
74+
## Security model
75+
76+
- **Path confinement is the single security boundary.** Every path is resolved and confined to the vault root before any filesystem call. Lexical `..` traversal, absolute paths, and null bytes are rejected; a leading slash is treated as vault-relative, not filesystem-absolute. Existing paths get a second `realpath` check so a symlink inside the vault can't point out of it.
77+
- **No hard delete.** The server has no tool that destroys data. `stage_delete` only *moves* files into `_ToDelete/`; a human is the sole final actor who empties it. This is why `stage_delete` is marked non-destructive — it's reversible by design.
78+
- **No shell execution.** File operations only. If a client needs shell access it provides that itself (ModelForge does, sandboxed and gated separately).
79+
- **stdio hygiene.** All logging goes to stderr; stdout carries only the MCP protocol.
80+
81+
## The MasterVault protocol layer
82+
83+
This server is more than a file server because of three conventions it understands:
84+
85+
- **`_orientation.md`** — the entry point a fresh LLM reads first (via `mastervault_orient`) to inherit the vault's working rules.
86+
- **`_Meta/Decision Log.md` + `Confidence Summary.md`** — a decision-logging + calibration system: consequential proposals are logged with a pre-verdict confidence estimate, and the gap between estimate and outcome accumulates into a per-category calibration signal.
87+
- **`_ToDelete/`** — the soft-delete staging area; the human is always the final actor on removal.
88+
89+
A vault that lacks these still works as a plain file tree — the protocol tools report what's missing rather than failing.
90+
91+
## Development
92+
93+
```bash
94+
npm run dev # tsx watch
95+
npm run build # tsc -> dist/
96+
npm start # node dist/index.js <vault>
97+
```
98+
99+
## License
100+
101+
MIT

0 commit comments

Comments
 (0)