obsidian-mcp-server: Instructions file for Codex

AGENTS.md

obsidian-mcp-server AGENTS.md is an instructions file for Codex, OpenCode from cyanheads/obsidian-mcp-server. It costs 11,608 tokens per session, scanned A, original, Apache-2.0.

Project instructions for building and maintaining an Obsidian MCP server, a service that lets coding agents work with Obsidian notes through the Model Context Protocol.

In plain words
What is it for?
Use it when setting up the server, designing or adding tools, resources, prompts, and services, writing tests, or deciding what to do next.
Why use it?
It gives the agent the server's rules, patterns, available tools, and suggested next steps, reducing guesswork when changing the code.

Instructions file for CodexOpenCode

Written for Codex and OpenCode: the file is AGENTS.md. Also seen: reads .claude/ paths; mentions .claude-plugin; mentions CLAUDE.md.

This is cyanheads/obsidian-mcp-server's own configuration. It tells Codex and OpenCode how to work on obsidian-mcp-server itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything obsidian-mcp-server configures →

Reuse

Borrowing it

Nothing to install: this file belongs to cyanheads/obsidian-mcp-server. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/cyanheads/obsidian-mcp-server/main/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/cyanheads/obsidian-mcp-server

Made for: Codex, OpenCode.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for obsidian-mcp-server AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/cyanheads/obsidian-mcp-server/agents-md/github.svg)](https://agentmods.dev/instructions/cyanheads/obsidian-mcp-server/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/cyanheads/obsidian-mcp-server/agents-md"><img src="https://agentmods.dev/badge/instructions/cyanheads/obsidian-mcp-server/agents-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for obsidian-mcp-server AGENTS.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/cyanheads/obsidian-mcp-server/agents-md"><img src="https://agentmods.dev/badge/instructions/cyanheads/obsidian-mcp-server/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 11,608 This file is loaded in full into every session.
When invoked 11,608 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.11608 $0.11608
Opus 5.5 $0.04643 $0.04643
Sonnet 5.5 $0.02322 $0.02322
Haiku 4.5 $0.01161 $0.01161

Measured 22d ago against content hash 1f1a30d0fa6e, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

obsidian-mcp-server AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 22d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

Copies of this mod

8 near-identical copies found in the catalogue:

AGENTS.md · 502 lines

How it starts

The opening of the file, as written. The whole thing — 502 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Agent Protocol

Server: obsidian-mcp-server Version: 3.9.0 Framework: @cyanheads/mcp-ts-core ^0.13.22 Engines: Bun ≥1.4.4, Node ≥24.0.0 MCP SDK: @modelcontextprotocol/server ^2.4.0 Zod: ^4.6.7

Read the framework docs first: node_modules/@cyanheads/mcp-ts-core/CLAUDE.md contains the full API reference — builders, Context, error codes, exports, patterns. This file covers server-specific conventions only.


What's Next?

When the user asks what to do next, what's left, or needs direction, suggest relevant options based on the current project state:

  1. Re-run the setup skill — ensures CLAUDE.md, skills, structure, and metadata are populated and up to date with the current codebase
  2. Run the design-mcp-server skill — if the tool/resource surface hasn't been mapped yet, work through domain design
  3. Add tools/resources/prompts — scaffold new definitions using the add-tool, add-app-tool, add-resource, add-prompt skills
  4. Add services — scaffold domain service integrations using the add-service skill
  5. Add tests — scaffold tests for existing definitions using the add-test skill
  6. Field-test definitions — exercise tools/resources/prompts with real inputs using the field-test skill, get a report of issues and pain points
  7. Run devcheck — lint, format, typecheck, and security audit
  8. Run the security-pass skill — audit handlers for MCP-specific security gaps: output injection, scope blast radius, input sinks, tenant isolation
  9. Run the polish-docs-meta skill — finalize README, CHANGELOG, metadata, and agent protocol for shipping
  10. Run the maintenance skill — investigate changelogs, adopt upstream changes, and sync skills after bun update --latest

Tailor suggestions to what's actually missing or stale — don't recite the full list every time.


Core Rules

  • Logic throws, framework catches. Tool/resource handlers are pure — throw on failure, no try/catch. Plain Error is fine; the framework catches, classifies, and formats. Use error factories (notFound(), validationError(), etc.) when the error code matters.
  • Use ctx.log for request-scoped logging. No console calls.
  • The delete confirmation is opt-in; when on, it is gated on a consent record. OBSIDIAN_DELETE_ELICITATION (default false) decides whether obsidian_delete_note confirms through ctx.requestInput. Off is the default for two reasons: a client that declares elicitation but cannot render the form declines every round automatically, which the server cannot tell from a real decline (#151), and the round forces a stateful HTTP session, which locks out MCP_SESSION_MODE=stateless. Off, OBSIDIAN_WRITE_PATHS / OBSIDIAN_DENY_PATHS / OBSIDIAN_READ_ONLY bound what a delete can reach — the same bound obsidian_write_note with overwrite: true has — and destructiveHint stays for client-side approval. The mode is the operator's choice alone: never derive it from ctx.clientCapabilities or from a decline. On, the handler redeems (reads and deletes) the ctx.state record named by ctx.inputs.state() before anything else, checks write scope on the resolved path before it reads the note or asks, and acts on the ctx.inputs answer only when that record deep-equals { operation, clientId, subject, target, contentHash } for this call; otherwise it stores a fresh record (ttl: 600) and return ctx.requestInput(...) with the record id as requestState. An answer alone is never proof the user was asked. Never await user input mid-handler.
  • All Obsidian access goes through getObsidianService(). No direct fetch() calls to the Local REST API in tools/resources — the service centralizes auth, TLS, timeouts, and ctx.signal propagation.
  • Secrets in env vars only. OBSIDIAN_API_KEY is required; never hardcoded.
  • Cut noise. Add only what earns its place: no speculative generality, no guards for states the framework already prevents (Zod-validated params, classified errors), no abstraction until a third caller proves it, no option nothing sets.
  • Command-palette tools are opt-in. obsidian_list_commands and obsidian_execute_command are callable only when OBSIDIAN_ENABLE_COMMANDS=true — Obsidian commands are opaque and can be destructive. When the flag is unset, the entry point wraps both with disabledTool() so they're absent from tools/list (LLM can't invoke) but visible in the operator-facing manifest with a hint to enable them.
  • Path-policy gating goes through PathPolicy. Every path-taking method on ObsidianService calls policy.assertReadable / assertWritable before the upstream HTTP call; listFiles gates with assertListable and filters entries with filterListing (readable entries plus folders on the way to the scope), so every listing consumer inherits the scope; obsidian_search_notes filters hits via svc.policy.filterReadable. OBSIDIAN_DENY_PATHS wins over every allow rule, and setting it turns on restrictsReads, so a deny list alone routes listings, tag counts, and JSONLogic through the scoped paths. Under policy.restrictsReads, searchJsonLogic never sends the caller's tree upstream: one /search/ guarded by readScopePattern fetches the readable notes' contexts (plus, when the tree names content, one GET /vault/{path} per readable note through the service-wide #bodyReads pacer, at most BODY_READ_CONCURRENCY (32) in flight, evaluated in batches of at most 32 MiB), filterReadable gates them, and the note contexts carry no links / backlinks / unresolvedLinks (a tree whose fixed var, missing, or missing_some key names one fails link_fields_unavailable before any request; a computed key reads null). createJsonLogicEvaluation runs the tree on a worker thread with the plugin's operators, bounded by depth, a per-note build budget, a per-search kept-result budget, a 10 s evaluation deadline, and SCOPED_SEARCH_DEADLINE_MS (45 s) over the whole search (logic_too_costly; a note too deep to hand to the worker is note_too_deep), so no hit, result, or error reads a note outside the scope. Text mode under restrictsReads never calls /search/simple/: one guarded /search/ names the readable candidates, one GET per candidate body, and SimpleSearch (simple-search.ts, a port of Obsidian's prepareSimpleSearch) builds the hits and windows under the same 45 s deadline (text_search_too_costly; context_length_too_large counts the response the plugin would send for the readable matches alone, every match's offsets and framing with its window, against V8's longest string). A scoped walk evaluates once: pageText and pageJsonLogic store the hit list a first page computed in one store (5 min past the last read, WALK_STORE_CHARS (32 Mi characters) across walks, least recently read evicted first), and the walk id rides nextCursor; a text entry is keyed by query, contextLength, and maxMatchesPerHit (never the scope, fixed per process, nor pathPrefix, applied per page) and holds copied windows, since a window sliced from a note body keeps the whole body alive. Under restrictsReads the omnisearch mode is withheld (omnisearchAvailability): absent from the mode enum, the description, and instructions, and nothing reaches the Omnisearch URL, the startup probe included, since Omnisearch ranks and selects its results over the whole vault. listTags reads per-note tags from the same readable contexts, with no evaluation. An active / periodic target is gated on the path it resolves to, under the target's label: resolveTarget / pinTarget return a PathTarget whose resolvedFrom the asserts take, so a denial names (active file) or daily note for 2026-10-01, never a path the caller did not send, and a tool that reads a target then writes it writes to that pinned path rather than resolving the target again. Don't bypass this — OBSIDIAN_READ_PATHS / OBSIDIAN_WRITE_PATHS / OBSIDIAN_DENY_PATHS / OBSIDIAN_READ_ONLY are the single chokepoint, and path_forbidden is declared on every path-taking tool's errors[] contract. A denied_path denial carries no activeScope, and no agent-facing surface (error data, instructions) names a deny prefix; only the startup log lists them.
  • Close the loop on issues. When implementing work tracked by a GitHub issue, comment on the issue with what landed and close it. Do both — a comment without a close leaves stale issues open; a close without a comment leaves no record of what shipped. The comment is for future readers — state the concrete changes, not the conversation that produced them.

Read the full file on GitHub · 502 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 22d ago Changed · +2 lines · +606 tokens per session 1f1a30d0fa6e
  2. 1mo ago Changed · +3 lines · +356 tokens per session 2bad90fc5eca
  3. 1mo ago Changed · +12 lines · +680 tokens per session 172f55f96fac
  4. 1mo ago Changed · +8 lines · +494 tokens per session fad6f114e2cc
  5. 1mo ago Changed · +10 lines · +779 tokens per session a2612afe796c
  6. 1mo ago Changed · +3 lines · +487 tokens per session 70fafee22348
  7. 2mo ago Changed · +2 lines · +59 tokens per session 5baed97d2217
  8. 2mo ago Changed · +4 lines · +163 tokens per session 530b844b3694
  9. 2mo ago Changed · +37 lines · +730 tokens per session 474226c9efc6
  10. 2mo ago First seen · 421 lines · 7,254 tokens per session scan A 3d125b057f73

Subscribe to this mod's changes

obsidian-mcp-server AGENTS.md is an instructions file published in the GitHub repository cyanheads/obsidian-mcp-server (722 stars, last pushed 23d ago), licensed Apache-2.0. It adds 11,608 tokens to every session, about $0.0464 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

obsidian-mcp-server AGENTS.md compared with instructions from other repositories

obsidian-mcp-server AGENTS.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
obsidian-mcp-server AGENTS.mdcyanheads/obsidian-mcp-serverInstructions file72223d agoApache-2.0A11,608Codex, OpenCode
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file196ktodayMITA9,887GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file144ktodayMITA7,230Codex, OpenCode
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file196ktodayMITA5,685GitHub Copilot
langchain AGENTS.mdlangchain-ai/langchainInstructions file150ktodayMITA4,680Codex, OpenCode
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file196ktodayMITA3,303GitHub Copilot
deno copilot-instructions.mddenoland/denoInstructions file109ktodayMITA3,077GitHub Copilot