second-brain-mcp
second-brain-mcp
Сервер MCP только для чтения для любого хранилища Obsidian или обычного markdown, в котором протокол поиска обеспечивается сервером, а не запрашивается в текстовой форме.
Укажите папку с markdown-заметками, и любой MCP-клиент — Claude Code, Claude Desktop, Cursor и любой другой — сможет запрашивать эту базу знаний через четыре управляемых инструмента. Сервер физически не может записывать, не может выйти за пределы каталога хранилища и завершает сеанс после жёсткого лимита прочитанных страниц.
Зачем
Личные базы знаний в итоге оказываются привязаны к одному инструменту. Заметки живут в Obsidian, а ИИ-ассистент, который мог бы их использовать, живёт где-то ещё, поэтому приходится копировать и вставлять. А когда ассистент действительно получает доступ к файлам, «пожалуйста, читай только то, что нужно» — это вежливая просьба, а не правило.
Этот сервер решает обе проблемы:
Один коннектор — любое приложение. MCP — это USB-C для ИИ-инструментов: напишите коннектор к хранилищу один раз, и любой MCP-клиент сможет им пользоваться.
Протокол — закон, а не рекомендация. Поиск через индекс, жёсткий лимит чтения страниц, доступ только для чтения и песочница путей реализованы в коде. Существуют только управляемые операции.
Related MCP server: obsidian-gate
Установка
Требуется Node.js 18 или новее.
Вариант A — из npm
claude mcp add second-brain -- npx -y @nanthansr/second-brain-mcp /abs/path/to/your/vaultЭта единственная команда регистрирует сервер в Claude Code; npx автоматически загружает и запускает пакет. Для других клиентов см. блоки конфигурации ниже.
Вариант B — из исходников
git clone https://github.com/nanthansr/second-brain-mcp
cd second-brain-mcp
npm install && npm run build
npm test # 15-check integration suite - should end with SMOKE PASS
claude mcp add second-brain -- node /abs/path/to/second-brain-mcp/dist/index.js /abs/path/to/your/vaultClaude Desktop
Добавьте в claude_desktop_config.json (Settings → Developer → Edit Config):
{
"mcpServers": {
"second-brain": {
"command": "npx",
"args": ["-y", "@nanthansr/second-brain-mcp", "/abs/path/to/your/vault"]
}
}
}Cursor
Добавьте тот же блок в ~/.cursor/mcp.json (или Cursor Settings → MCP → Add new server).
Нет под рукой хранилища?
Полностью опустите аргумент хранилища, и сервер предложит встроенное вымышленное демонстрационное хранилище («Alex Rivera») — удобно, чтобы попробовать за 30 секунд:
claude mcp add second-brain-demo -- npx -y @nanthansr/second-brain-mcpПодключение к вашему хранилищу Obsidian
Ваше хранилище — это просто папка, которую вы выбрали, когда Obsidian спросил «Open folder as vault». Передайте абсолютный путь к этой папке в качестве аргумента:
ОС | Пример |
Windows |
|
macOS / Linux |
|
Примечания:
index.mdв корне хранилища открывает сценарий «сначала индекс» (get_index): страница-каталог с одной строкой на заметку. Если у вас его нет, всё по-прежнему работает — модель переключается наsearch_notes.Собственная конфигурация Obsidian (
.obsidian/) и любые другие скрытые папки невидимы для сервера.Сервер никогда ничего не изменяет — Obsidian может оставаться открытым во время его работы.
Использование
После подключения просто задавайте вопросы. Типичные сценарии (из реального сеанса с демонстрационным хранилищем):
«Над чем работает Алекс Ривера и кто такой Сэм?» →
get_index→read_note×3 (каждый вызов с пометкойread 1/5,read 2/5,read 3/5) → ответ с цитатами.
«Что изменилось в моём хранилище за эту неделю?» →
list_recent(days: 7)→ список с датами, сначала новые.
«Где у меня заметки про ценообразование?» →
search_notes(query: "pricing")→ подходящие страницы с фрагментами и номерами строк, без расхода лимита.
Клиенты, поддерживающие MCP-промпты, также получают vault-retrieval — шаблон слеш-команды, который закрепляет за моделью протокол «сначала индекс» для заданного вопроса.
Что получает клиент
Вид | Имя | Что делает | Лимит |
tool |
| Возвращает | бесплатно |
tool |
| Регистронезависимый поиск, возвращает страницы и фрагменты с номерами строк | бесплатно |
tool |
| Полное содержимое одной страницы по пути относительно хранилища | учитывается |
tool |
| Страницы, изменённые за последние N дней, сначала новые | бесплатно |
resource |
| Индекс как ресурс MCP | бесплатно |
prompt |
| Протокол «сначала индекс» как переиспользуемый шаблон промпта | — |
Предполагаемый поток повторяет то, как аккуратный человек работает с вики: прочитать каталог, открыть одну-две нужные страницы, ответить с цитатами. Поиск дёшев; чтение ограничено.
Конфигурация
Настройка | Как | По умолчанию |
Путь к хранилищу | первый аргумент CLI или переменная | встроенное |
Лимит чтения страниц | переменная | 5 за сеанс |
Модель безопасности
Только чтение по построению. В кодовой базе не существует инструментов записи, редактирования или удаления.
Песочница путей. Каждый путь сначала нормализуется через
path.resolve, затем проверяется относительно корня хранилища — попытки выхода за пределы (../…) отклоняются. Читать можно только файлы.md.Жёсткий лимит страниц. После N вызовов
read_note(по умолчанию 5) сервер отказывает в дальнейшем чтении и предлагает модели синтезировать ответ на основе уже прочитанного. Неудачные чтения не расходуют лимит.Ограничения размера. Заметки обрезаются на 50 КБ; результаты поиска и списки недавних ограничены по размеру.
Скрытые папки пропускаются.
.obsidian,.gitи другие скрытые папки невидимы.Код публичен, данные — нет. В репозитории только код сервера и вымышленное демонстрационное хранилище. Ваше настоящее хранилище — это любая папка, которую вы подключаете во время запуска; оно никогда не покидает ваш компьютер.
Частые вопросы
Покидают ли мои данные мой компьютер? Нет. Сервер запускается локально как дочерний процесс вашего MCP-клиента и читает файлы с диска. В нём нет сетевого кода.
Может ли он изменять или удалять мои заметки? Нет. Инструментов записи не существует. Это свойство кода, а не настройка.
Что происходит, когда модель исчерпывает лимит? Шестое чтение возвращает ошибку с предложением модели синтезировать ответ из уже прочитанных страниц. Новый разговор получает новый лимит.
Почему демонстрационный ответ говорил об «Алексе Ривере»? Вы работаете со встроенным вымышленным демонстрационным хранилищем. Передайте путь к своему хранилищу первым аргументом.
Разработка
npm run build # tsc -> dist/
npm test # build + 15-check smoke test (spawns the real server over stdio)Смоук-тест использует собственный клиент SDK против скомпилированного сервера — реальный протокол, без моков. Он проверяет все четыре инструмента, ресурс, промпт, отклонение выхода за пределы пути и то, что лимит чтения отказывает в чтении N+1-й страницы. CI запускает его на Linux и Windows, Node 20 и 22.
Любопытно, почему всё устроено именно так? См. docs/design-notes.md — транспорты, три примитива MCP, схемы как промпты, а также решения о песочнице и лимите.
Дорожная карта
Удалённый вариант (streamable HTTP), чтобы хранилище было доступно из хостинг-клиентов, с аутентификацией
Опциональное ограничение по папкам (обслуживать только
wiki/, скрыватьjournal/)
Участие
Приветствуются issue и pull request. Соблюдайте инварианты: никаких инструментов записи, никаких сетевых вызовов, смоук-тест остаётся зелёным и не ослабленным.
Лицензия
MIT · Изменения в CHANGELOG.md
Available Tools
4 toolsget_indexGet the vault indexA
Returns index.md, the catalog of every page in the vault (one line each). ALWAYS call this first to locate relevant pages, then read only the 1-2 pages that matter. Does not count against the page budget.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden. It discloses the output behavior (one line per page) and adds a meaningful operational trait: 'Does not count against the page budget,' which is beyond what the schema or title conveys. It could mention side-effect-free/read-only nature, but the context strongly implies a safe read.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Three short sentences deliver the core purpose, usage directive, and budget behavior in order of importance. No filler or redundant restating of the title.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a zero-parameter tool with no output schema, the description fully covers what the agent needs: what it returns, how to use it first, and why it is safe to invoke. There are no missing details that would prevent a correct call.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool has zero parameters and schema coverage is 100%, so there are no parameter semantics to document. The description adds useful meaning about the returned content, which is more than necessary for a parameterless tool.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb ('Returns') and resource ('index.md'), and precisely defines the output as 'the catalog of every page in the vault (one line each).' This clearly differentiates it from the sibling tools like search_notes or read_note.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Explicitly directs the agent to 'ALWAYS call this first' and then 'read only the 1-2 pages that matter,' giving a clear workflow. It does not explicitly name search_notes or list_recent as alternatives, but the sequential guidance is strong enough to establish when this tool should be used.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_recentList recently updated pagesA
Lists pages modified in the last N days (default 7), newest first. Good for 'what changed lately'. Does not count against the page budget.
| Name | Required | Description | Default |
|---|---|---|---|
| days | No | Look-back window in days (default 7) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden and does disclose useful behavioral traits: a default look-back window, newest-first ordering, and that it does not consume page budget. It does not describe the returned page format or any limits beyond the schema, but for a simple read-only list tool this is solid transparency.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two short sentences carry the core behavior, the primary use case, and a key operational constraint with no filler. The most important information is front-loaded, and every sentence earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple tool with one fully documented optional parameter and no output schema, the description covers the essential behaviors: what is listed, the time window, ordering, and budget impact. It could be more complete by describing what fields/details appear in the returned page list, but it is sufficient for an agent to select and invoke the tool correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100% and the single 'days' parameter is already documented with type, range, and default. The description only repeats the default window, adding no new semantic meaning beyond what the schema already provides, so the baseline score of 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states a specific verb ('Lists') and resource ('pages'), with a defined time window and sort order ('last N days (default 7), newest first'). It does not explicitly name or differentiate itself from sibling tools like search_notes or get_index, but the 'recently modified' framing makes its distinct purpose reasonably clear.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description gives clear usage context with 'Good for what changed lately' and adds a practical benefit ('Does not count against the page budget'). However, it does not mention when not to use it or point to alternative sibling tools, so it stops short of full routing guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
read_noteRead one pageA
Returns the full content of one markdown page by vault-relative path (e.g. wiki/people/sam-okafor.md). Counts against the hard page budget of 5 reads per session - locate pages via get_index or search_notes first, then read only what matters.
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Vault-relative path to a .md file |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden and discloses a key non-obvious behavior: the hard page budget of 5 reads per session. It also clarifies that the tool returns full content. It could additionally mention error behavior for missing paths or confirm it is a pure read, but it is already meaningfully transparent.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two sentences with no filler. The first sentence establishes the core function and path format; the second adds the budget constraint and recommended preceding workflow. Every sentence earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a single-parameter read tool with no output schema, the description is complete: it states what is returned, how to address the resource, and a critical usage constraint. It also routes the agent to the right discovery tools before reading.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so the baseline is 3. The description adds value with a concrete path example ('wiki/people/sam-okafor.md') and reinforces the vault-relative .md semantics, making the expected input format clearer to the agent.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a specific verb ('Returns the full content') and a precise resource ('one markdown page by vault-relative path'). With the title 'Read one page' and sibling tools like search_notes and list_recent, it is immediately distinguishable as a targeted read operation.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
It explicitly tells the agent to locate pages via get_index or search_notes first and to 'read only what matters', plus it warns about the hard 5-read budget. It does not explicitly mention list_recent or state when not to use this tool, so it falls just short of full exclusion guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
search_notesSearch the vaultA
Case-insensitive text search across every markdown page. Returns matching pages with line-numbered snippets. Use when the index does not answer 'where does this live'. Does not count against the page budget.
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Text to search for (literal, not regex) | |
| max_results | No | Max pages to return (default 10, cap 30) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the behavioral disclosure burden. It discloses case-insensitive matching, global scope, snippet return format, and the useful operational fact that it does not count against the page budget. It does not explicitly state read-only behavior, but this is strongly implied by 'search'.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Three sentences, each carrying distinct value: the core behavior, the return format, and the usage trigger plus budget note. It is front-loaded and free of filler.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple two-parameter search tool with no output schema, the description covers scope, matching behavior, return shape, and when to use it. Nothing essential for correct invocation is missing.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the parameters are already fully documented. The description adds context about case-insensitivity and scope but does not materially extend what the schema provides for query and max_results.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a specific verb ('search') and resource ('every markdown page'), with concrete details like case-insensitivity and line-numbered snippets. It is clearly distinct from sibling tools like get_index, read_note, and list_recent.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explicitly says to use it 'when the index does not answer where does this live', giving a clear trigger condition. It does not enumerate exclusions or compare against read_note/list_recent, but the context is unambiguous enough for an agent to route correctly.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
4 tool updates
v0.1.0- First observed
get_index - First observed
list_recent - First observed
read_note - First observed
search_notes
TDQS
Scored across 4 tools
Each tool has a clearly distinct role: index for catalog lookup, search for text search, read for content retrieval, and list_recent for recency. The descriptions even specify when to prefer one over another, removing ambiguity.
All tool names use snake_case with an imperative verb first, creating a predictable pattern. list_recent is slightly less parallel than list_recent_notes, but the deviation is minor and does not confuse the set.
Four tools is well-scoped for a retrieval-focused note vault: discovery via index/search/recent and content access via read. Each tool serves a distinct workflow step with no redundancy.
The surface fully covers read-oriented workflows: locating notes, finding content by text, checking recent changes, and reading full pages. The only notable gap is write/edit operations, but the tool descriptions consistently frame this as a read-only vault interface.
Maintenance
Related MCP Connectors
Search and reason over your Obsidian-style Markdown vault, right from ChatGPT.
Search, read, and safely update Markdown notes in your connected Phasoric knowledge vaults.
Agent-native notes, tasks, dev-docs, vaults, sync & handoffs. MCP + OpenAPI dual surface.
- GraniteOAuthmd.granite
Encrypted Markdown notes and team knowledge base. Search, read and write notes in vaults you allow.
Related MCP Servers
- AlicenseAqualityDmaintenanceProvides read-only access to an Obsidian vault, enabling file listing, content reading, and text search across notes via MCP.42Apache 2.0
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to read, search, write, and link notes in an Obsidian vault via MCP tools and resources.MIT
- AlicenseNot gradedqualityBmaintenanceEnables MCP clients to search, read, and list notes and tags in a Markdown vault using read-only tools.MIT
- FlicenseNot gradedqualityCmaintenanceEnables MCP clients to search, read, list, and append to markdown notes in a local Obsidian vault or folder of .md files.-