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 9,472 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 9,472 This file is loaded in full into every session.
When invoked 9,472 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.09472 $0.09472
Opus 5.5 $0.03789 $0.03789
Sonnet 5.5 $0.01894 $0.01894
Haiku 4.5 $0.00947 $0.00947

Measured 12d ago against content hash a2612afe796c, 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 12d 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 · 477 lines

How it starts

The opening of the file, as written. The whole thing — 477 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.7.0 Framework: @cyanheads/mcp-ts-core ^0.13.12 Engines: Bun ≥1.4.0, Node ≥24.0.0 MCP SDK: @modelcontextprotocol/server ^2.2.0 Zod: ^4.6.5

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_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 post-filters hits via svc.policy.filterReadable, and listTags collects per-note tags through it when policy.restrictsReads. Don't bypass this — OBSIDIAN_READ_PATHS / OBSIDIAN_WRITE_PATHS / OBSIDIAN_READ_ONLY are the single chokepoint, and path_forbidden is declared on every path-taking tool's errors[] contract.
  • 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 · 477 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. 12d ago Changed · +10 lines · +779 tokens per session a2612afe796c
  2. 13d ago Changed · +3 lines · +487 tokens per session 70fafee22348
  3. 25d ago Changed · +2 lines · +59 tokens per session 5baed97d2217
  4. 26d ago Changed · +4 lines · +163 tokens per session 530b844b3694
  5. 29d ago Changed · +37 lines · +730 tokens per session 474226c9efc6
  6. 1mo ago Changed · +1 lines · +451 tokens per session 3d125b057f73
  7. 1mo ago Changed · +1 lines · +78 tokens per session ab106ffa4434
  8. 1mo ago Changed edd007148091
  9. 1mo ago First seen · 419 lines · 6,725 tokens per session scan A c702851e6bc6

Subscribe to this mod's changes

obsidian-mcp-server AGENTS.md is an instructions file published in the GitHub repository cyanheads/obsidian-mcp-server (697 stars, last pushed 13d ago), licensed Apache-2.0. It adds 9,472 tokens to every session, about $0.0379 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

Other instructions, from other repositories

vscode buildNext.instructions.md

Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).

microsoft/vscode · 9,649 tokens

next.js AGENTS.md

AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.

vercel/next.js · 7,257 tokens

vscode oss-third-party-notices.instructions.md

Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, cache eligibility and rollout and applying the notice (cutover).

microsoft/vscode · 5,262 tokens

langchain AGENTS.md

AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.

langchain-ai/langchain · 4,680 tokens

vscode copilot-instructions.md

Copilot instructions for microsoft/vscode, covering vs code copilot instructions, project overview, root folders, core architecture (src/ folder) and built-in extensions (extensions/ folder).

microsoft/vscode · 2,731 tokens

deepseek-harness AGENTS.md

AGENTS.md instructions for deepseek-ai/deepseek-harness, covering agents.md, pre-stable apis and released session data, repository layout, commands and host sandbox failures.

deepseek-ai/deepseek-harness · 4,159 tokens