Basalt MCP
A security-hardened MCP server that enables AI models to safely interact with Obsidian vaults through sandboxed file operations and todo tracking. It implements strict validation layers and resource limits to protect the local filesystem from potentially hostile tool calls.
README
Basalt MCP
A security-hardened Model Context Protocol server with two independent tool modules: Obsidian vault tools for managing a knowledge base, and git tools for LLM-assisted code review. Built for adversarial environments where the connected AI cannot be trusted.
Tools
Obsidian Vault Tools (--vault)
| Tool | Description |
|---|---|
getAllFilenames |
List all vault files, sorted by most recently modified |
readMultipleFiles |
Read files by exact, case-insensitive, or partial name match |
getOpenTodos |
Find all unchecked todo items (- [ ]) across markdown files |
updateFileContent |
Create or update files (9-step write validation chain) |
searchVault |
Search vault files by content (plain text or regex) with context snippets |
appendToFile |
Append content to an existing file (no file creation) |
listFiles |
List vault files filtered by folder and/or extension |
Git Tools (--repo)
| Tool | Description |
|---|---|
gitStatus |
Working tree status (staged, unstaged, untracked) |
gitLog |
Commit history with configurable depth |
gitDiff |
Diff output (working tree, staged, or against a ref) |
gitBlame |
Per-line blame for a file |
All git tools are read-only. No mutations (no commit, push, reset, checkout).
Quick Start
npm install
npm run build
Usage
# Both modules — vault for context, repo for code review
node dist/index.js --vault /path/to/vault --repo /path/to/repo
# Vault only
node dist/index.js --vault /path/to/vault
# Repo only
node dist/index.js --repo /path/to/repo
At least one of --vault or --repo is required. The vault and repo are independent directories — the vault is a knowledge base (Obsidian), the repo is a code repository (git).
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"basalt": {
"command": "node",
"args": [
"/absolute/path/to/basalt-mcp/dist/index.js",
"--vault", "/path/to/your/vault",
"--repo", "/path/to/your/repo"
]
}
}
}
Cursor
Add to .cursor/mcp.json in your project:
{
"mcpServers": {
"basalt": {
"command": "node",
"args": [
"/absolute/path/to/basalt-mcp/dist/index.js",
"--vault", "/path/to/your/vault",
"--repo", "/path/to/your/repo"
]
}
}
}
The server communicates over stdio using the MCP JSON-RPC protocol.
Security
The server treats every tool call as potentially hostile.
Vault tools — all filesystem access is sandboxed to the vault directory through multiple independent layers:
- 9-step write validation chain — null bytes, dot-paths, extension allowlist, path limits, vault containment, symlinked parent walk, atomic
O_NOFOLLOWwrite - Extension allowlist — only
.mdand.canvas(native Obsidian formats) - 3-layer symlink defense — glob-level exclusion, parent directory walk, kernel-level
O_NOFOLLOW - Error sanitization — never leaks system paths or OS details
- Resource limits — 10 MB read cap, 1 MB write cap, 50 filenames per request, 5 partial match results, 20 search match cap
Git tools — all git execution is sandboxed to the repo directory:
execFileSynconly — no shell, no command injection possible- Ref name allowlist — rejects shell metacharacters, backticks,
$(), pipes, semicolons - Path validation — blame file paths go through null byte check, repo containment, and symlink walk
- Output sanitization — repo path stripped from all output, 100KB output cap, 10s timeout
See SECURITY.md for the full threat model, design rationale, and all 118 tested attack vectors.
Development
npm test # run all 341 tests
npm run test:watch # watch mode
npm run lint # type-check without emitting
npm run dev # watch mode compilation
Project Structure
src/
├── index.ts Server entrypoint (--vault/--repo flags, stdio transport)
├── core/ Shared security framework
│ ├── validation.ts Assertion functions (7)
│ ├── vault.ts Immutable vault path management
│ ├── repo.ts Immutable repo path management + git validation
│ ├── contentBoundary.ts Boundary markers for untrusted content (spotlighting)
│ └── errors.ts Error sanitization
└── tools/
├── obsidian/ Obsidian vault tool module
│ ├── getAllFilenames.ts
│ ├── readMultipleFiles.ts
│ ├── getOpenTodos.ts
│ ├── updateFileContent.ts
│ ├── searchVault.ts
│ ├── appendToFile.ts
│ └── listFiles.ts
└── git/ Git tool module
├── exec.ts Safe git execution helper
├── gitStatus.ts
├── gitLog.ts
├── gitDiff.ts
└── gitBlame.ts
The architecture separates the security core from tool implementations. The core handles validation, sandboxing, and error sanitization. Tool modules plug into the core and inherit all protections. The two modules are independent — you can run either or both.
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。