Roam MCPのロゴ

Roam MCP

組織
Roam-Research

Official MCP and CLI for Roam Research

公開者Roam-Research
リポジトリroam-tools
言語TypeScript
フォーク
8
スター
56
利用可能なツール
25
通信方式stdio
カテゴリ
リンク
  • ツールをAIワークフローに接続

    Roam MCPは、対応するAIクライアントやAIエージェントから利用できるMCP機能を提供します。

  • 利用可能なツール(25個)

    呼び出し可能なアクションを以下で確認できます。サーバーから提供されている場合は、名前や説明も表示されます。

  • コピーして使える設定

    セットアップ用の設定例を使って、お好みのMCPクライアントにこのサーバーを設定できます。

  • オープンソースプロジェクトの注目度

    リンク先のリポジトリには56件のスターと8件のフォークがあります。

Roam MCP and CLI

The official Model Context Protocol (MCP) server and CLI for Roam Research. Connect Claude, Cursor, and other AI assistants to your Roam graph — read, write, search, and query.

Alpha Software: This project is in early development and subject to breaking changes.

[!CAUTION] Full Write Access: This MCP server gives Claude full read and write access to your Roam graph. Claude can create, modify, and delete pages and blocks. Changes may be difficult or impossible to undo. Roam does not have a traditional undo history that can reverse bulk operations or deletions made through the API.

Recommendations:

  • Back up your graph before use
  • Start with a test graph to understand Claude's behavior
  • Review what Claude plans to do before confirming write operations
  • Be specific in your instructions to avoid unintended changes

Prerequisites

  • Node.js v18 or later
  • Roam Research desktop app (the local API is not available in the web version)

How It Works

This MCP server connects to Roam's local HTTP API, which runs on your machine when the desktop app is open. If Roam isn't running when a tool is called, the server will automatically launch it via deep link and retry the connection.

Getting Started

1. Roam Desktop App

The local API requires the Roam desktop app (not the web version). Make sure it's installed and you can open your graph in it.

2. Connect a Graph

Interactive (recommended for first-time setup):

bash
npx @roam-research/roam-mcp connect

This will walk you through selecting a graph, choosing permissions, and approving the token in Roam. You can also use the CLI: install globally with npm install -g @roam-research/roam-cli, then use roam connect.

Non-interactive (for scripts and LLM agents):

bash
# example to connect to your graph called "my-graph-name" which you generally refer to as "My Team Graph"
npx @roam-research/roam-mcp connect --graph my-graph-name --nickname "My Team Graph" --access-level full

# example to connect to a public graph - our "help" graph
npx @roam-research/roam-mcp connect --graph help --public --nickname "Roam official help graph"
FlagDefaultDescription
--graph <name>—Graph name (enables non-interactive mode)
--nickname <name>Required with --graphShort name you'll use to refer to this graph
--access-level <level>fullfull, read-append, or read-only
--public—Public graph (read-only, hosted)
--type <type>hostedhosted or offline

Note: Both modes require a human to approve the token dialog in the Roam desktop app.

To remove a connection:

bash
npx @roam-research/roam-mcp connect --remove --graph my-graph-name
npx @roam-research/roam-mcp connect --remove --nickname "My Team Graph"

Run connect again to add more graphs or update permissions.

3. Connect to an MCP Client

Claude Desktop

Add to your Claude Desktop config file:

json
{
  "mcpServers": {
    "roam": {
      "command": "npx",
      "args": ["-y", "@roam-research/roam-mcp"]
    }
  }
}

Config file location:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

Restart Claude Desktop after saving.

Claude Code

bash
claude mcp add -s user roam-mcp -- npx -y @roam-research/roam-mcp

This makes Roam available in all your Claude Code sessions. To add it to a single project only, use -s local instead.

Multiple Graphs

Run connect multiple times to add additional graphs. Each graph gets a nickname (a short name like "work" or "team acme") for easy selection.

Graph Selection:

  • Single graph configured: Auto-selected, no action needed
  • Multiple graphs configured: Pass the graph parameter on each tool call with the nickname

Manual Configuration (Advanced)

Instead of using connect, you can manually create ~/.roam-tools.json:

json
{
  "version": 1,
  "graphs": [
    {
      "name": "your-graph-name",
      "type": "hosted",
      "token": "roam-graph-local-token-...",
      "nickname": "my-graph"
    }
  ]
}

To create a token manually: Roam Desktop → Settings → Graph → Local API Tokens → New Token.

FieldRequiredDescription
nameYesThe actual graph name in Roam (as shown in the URL)
typeNo"hosted" (default) for cloud graphs, "offline" for local-only
tokenYesLocal API token from Roam settings
nicknameYesSlug identifier for this graph (lowercase, hyphens, no spaces)
accessLevelNo"full" (default), "read-only", or "read-append"

accessLevel records what the token was granted; it is not enforced by the CLI or MCP server — Roam enforces the token's real permissions. Setting it by hand does not change what an agent can do. (A fourth value, "read-edit-own", is accepted by the config schema, and whatever level Roam grants is written to your config verbatim. Roam's local API does not currently grant that tier, so you are unlikely to see it in a locally-created token.)

Available Tools

Graph Management:

  • list_graphs - List all configured graphs with their nicknames
  • setup_new_graph - Set up a new graph connection, or list available graphs

Graph Guidelines:

  • get_graph_guidelines - Returns user-defined instructions and preferences for AI agents

Graph guidelines let you store preferences and context directly in your Roam graph that AI agents will follow. Create a page called [[roam/agent guidelines]] with your instructions. These might include naming conventions, preferred page structures, topics to focus on, or any other context that should guide how the AI interacts with your graph.

Content:

  • create_page - Create page with markdown content
  • update_page - Update page title or children view type
  • delete_page - Delete a page (errors with NOT_FOUND when nothing exists to delete; older Roam servers may instead report success without deleting)
  • create_block - Create blocks (by parent UID, page title, or daily note date — MM-DD-YYYY or today/yesterday/tomorrow; with optional nest-under)
  • append_to_daily_note - Append/capture markdown to a daily note (today by default, or MM-DD-YYYY / today/yesterday/tomorrow; optional nest-under section)
  • update_block - Update block content/properties
  • move_block - Move a block to a new location
  • delete_block - Delete a block (errors with NOT_FOUND when nothing exists to delete; older Roam servers may instead report success without deleting)
  • add_comment - Add a comment to a block (comment thread, not child block)
  • get_comments - Get comments on a block with author/date context

Read:

  • search - Search pages/blocks (empty query returns recently edited/viewed content)
  • semantic_search - Semantic (embeddings) search by meaning; requires embeddings enabled and a signed-in user
  • suggest_links - Suggest existing pages worth linking to from a passage of text (does not create links)
  • search_templates - Search Roam templates by name
  • roam_query - Execute a Roam query ({{query:}} blocks, not Datalog)
  • datalog_query - Execute a raw Datalog query against the graph's Datomic database
  • get_page - Get page content as markdown
  • get_block - Get block content as markdown
  • get_backlinks - Get references to a page/block

Navigation:

  • get_open_windows - Main window view and all sidebar windows
  • get_selection - Currently focused block and multi-selected blocks
  • open_main_window - Navigate to page/block
  • open_sidebar - Open in right sidebar

Shortcuts:

  • add_shortcut - Add a page to the left sidebar Shortcuts / starred pages (optional index to position it)
  • remove_shortcut - Remove a page from the left sidebar Shortcuts / starred pages

Files:

  • file_get - Fetch a file hosted on Roam (handles decryption for encrypted graphs)
  • file_upload - Upload a file to Roam (from local path, URL, or base64)
  • file_delete - Delete a file hosted on Roam

Developer:

  • reload_dev_extensions - Reload all developer-mode extensions in Roam Desktop (apply code changes without restarting)
  • call_extension_tool - Invoke an AI tool registered by a Roam extension or roam/js script (discover available tools via the extensionTools field of get_graph_guidelines)

Hiding content from the AI

Blocks tagged #.rm-hide or #.rm-private — and everything nested under them — are omitted from the content these tools return. The read tools that surface graph content to the AI (get_page, get_block, get_backlinks, search, semantic_search, roam_query) all skip hidden subtrees. (search_templates is the exception: template previews are NOT filtered, so hidden blocks inside a shared template can appear in its results.) Both the hashtag (#.rm-hide) and link ([[.rm-hide]]) forms work; .rm-private is Roam's existing "hidden from other users" tag, while .rm-hide hides from the AI specifically.

This is a convenience filter, not a security guarantee. The filtering is applied only to the AI content tools above. The raw datalog_query tool reads the database directly and does not apply it, so a capable agent could still surface hidden blocks through datalog. Don't rely on these tags for anything truly sensitive — treat them as "keep it out of the AI's way," not "keep it secret."

Agent skill: roam-syntax

The skills/roam-syntax/ directory contains an Agent Skill that teaches AI agents Roam's syntax and the MCP read/write model: Roam-flavored markdown (it differs from standard markdown — e.g. italics are __text__), how to read the <roam .../>-tagged output the read tools return, and how to write content back without corrupting block references. Agents connected through this MCP server get a compact version of the same guidance automatically (the roamSyntax field of get_graph_guidelines plus the tool descriptions); the skill adds depth — full syntax, {{...}} components, queries, and worked read→edit→write examples — for agent platforms that support skills (Claude Code, Claude.ai, Codex, …). To use it, copy skills/roam-syntax/ into your agent's skills directory (e.g. .claude/skills/).

CLI

Install globally for quick access:

bash
npm install -g @roam-research/roam-cli
bash
roam list-graphs
roam connect                                                    # Interactive setup
roam connect --graph <name> --nickname <name>                   # Non-interactive
roam search --query "my notes" --graph <name-or-nickname>
roam get-page --title "My Page" --graph <name-or-nickname>

If you only have one graph configured, the --graph flag is optional.

Run roam --help to see all available commands. You can also use npx @roam-research/roam-cli without installing globally.

Packages

This repository is a monorepo with four packages:

PackageDescription
@roam-research/roam-tools-coreTransport-agnostic core library (tools, operations, types, dispatch)
@roam-research/roam-tools-localLocal Roam Desktop transport (client, config reader, connect) — internal dependency of MCP and CLI
@roam-research/roam-mcpMCP server — connect Claude/Cursor/etc. to Roam
@roam-research/roam-cliCLI — setup and direct tool access

See CHANGELOG.md for release history.

Development

To work on this project from source:

bash
git clone https://github.com/Roam-Research/roam-tools.git
cd roam-tools
npm install
npm run build

Development commands:

bash
npm run mcp              # Run MCP server in dev mode (tsx)
npm run cli -- connect   # Run CLI in dev mode
npm run typecheck        # Type-check (force rebuild, checks all packages)
npm run lint             # Lint with ESLint
npm run format:check     # Check formatting with Prettier
npm run version:check    # Verify all package versions are consistent
npm run version:bump 0.5.0  # Bump all packages to a new version

See architecture for how the four packages divide responsibility and the core contract external consumers depend on, and npm packaging design for why the packages are structured this way.

Contributing

This project is changing rapidly. At this time, we prefer suggestions and feedback over pull requests. Please open an issue or join the #ai-in-roam channel on slack to discuss ideas before submitting code.

インストール

TypingMind
前提条件:

Node.js 18+

{
  "mcpServers": {
    "roam-research-roam-tools": {
      "command": "npx",
      "args": [
        "-y",
        "roam-tools"
      ]
    }
  }
}

利用可能なツール

  • list_graphs

    List all configured graphs with their nicknames. Also provides setup instructions for connecting additional graphs.

  • setup_new_graph

    Set up a new Roam graph for access, or list available graphs. Call without arguments to see which graphs are available in Roam Desktop. Call with graph and nickname to connect a specific graph — ask the user what they'd like to call the graph before choosing a nickname. The user will see an approval dialog in Roam desktop app and must approve the token request. If the graph is already configured, returns the existing configuration without making changes.

  • get_graph_guidelines

    IMPORTANT: Call this tool first when starting to work with a graph, before performing any other operations. Returns user-defined instructions and preferences for AI agents. The user may have specified naming conventions, preferred structures, or constraints that should guide your behavior. After receiving the response, follow the nextSteps field — it contains orientation actions you should take before proceeding.

  • create_page

    Create a new page in Roam, optionally with markdown content.

    Note: Call get_graph_guidelines first when starting to work with a graph.

  • create_block

    Create blocks from markdown content. Target by parentUid, pageTitle, or dailyNotePage (page created if needed). Use nestUnder to insert under a specific child block. Supports nested bulleted lists via markdown indentation.

    Note: Call get_graph_guidelines first when starting to work with a graph.

  • update_block

    Update an existing block's content or properties.

    Note: Call get_graph_guidelines first when starting to work with a graph.

  • delete_block

    Delete a block and all its children.

    Note: Call get_graph_guidelines first when starting to work with a graph.

  • move_block

    Move a block to a new location.

    Note: Call get_graph_guidelines first when starting to work with a graph.

  • add_comment

    Add a comment to a block (comment thread, NOT a child block). Prefer comment for simple text; use commentMarkdown for structured content. Same-day calls on the same block append to your existing comment.

    Note: Call get_graph_guidelines first when starting to work with a graph.

  • get_comments

    Get comments on a block with author, timestamps, and edit info. If singleEditableUid is set, the comment can be edited with update_block. Only works for blocks, not pages.

    Note: Call get_graph_guidelines first when starting to work with a graph.

  • delete_page

    Delete a page and all its contents.

    Note: Call get_graph_guidelines first when starting to work with a graph.

  • update_page

    Update a page's title or children view type. Set mergePages to true if renaming to a title that already exists.

    Note: Call get_graph_guidelines first when starting to work with a graph.

  • search

    Search for pages and blocks by text. Returns paginated results with markdown content and optional breadcrumb paths. Call with an empty query to get recently edited and viewed content — useful for understanding what the user is currently working on.

    Note: Call get_graph_guidelines first when starting to work with a graph.

  • search_templates

    Search Roam templates by name. When the user mentions 'my X template' or 'the X template', use this tool to find it. Templates are user-created reusable content blocks tagged with [[roam/templates]]. Returns template name, uid, and content as markdown.

    Note: Call get_graph_guidelines first when starting to work with a graph.

  • roam_query

    Execute a Roam query ({{query: }} or {{[[query]]: }} blocks, NOT Datalog). Two modes: (1) UID mode - pass a block UID containing a query component to run it with saved settings/filters; (2) Query mode - pass a raw query string like "{and: [[TODO]] {not: [[DONE]]}}". Returns paginated results with markdown content.

    Note: Call get_graph_guidelines first when starting to work with a graph.

  • get_page

    Get a page's content as markdown. Returns content with metadata tags containing UIDs - use these for follow-up operations but strip them when showing content to the user. Show remaining content verbatim, never paraphrase. Use maxDepth for large pages.

    Note: Call get_graph_guidelines first when starting to work with a graph.

  • get_block

    Get a block's content as markdown. Returns content with metadata tags containing UIDs - use these for follow-up operations but strip them when showing content to the user. Show remaining content verbatim, never paraphrase. Use maxDepth for large blocks.

    Note: Call get_graph_guidelines first when starting to work with a graph.

  • get_backlinks

    Get paginated backlinks (linked references) for a page or block, formatted as markdown. Returns total count and results with optional breadcrumb paths.

    Note: Call get_graph_guidelines first when starting to work with a graph.

  • get_open_windows

    Get the current view in the main window and all open sidebar windows.

    Note: Call get_graph_guidelines first when starting to work with a graph.

  • get_selection

    Get the currently focused block and any multi-selected blocks.

    Note: Call get_graph_guidelines first when starting to work with a graph.

  • open_main_window

    Navigate to a page or block in the main window.

    Note: Call get_graph_guidelines first when starting to work with a graph.

  • open_sidebar

    Open a page or block in the right sidebar.

    Note: Call get_graph_guidelines first when starting to work with a graph.

  • file_get

    Fetch a file hosted on Roam (handles decryption for encrypted graphs).

    Note: Call get_graph_guidelines first when starting to work with a graph.

  • file_upload

    Upload a file to Roam. Returns the Firebase storage URL. Usually you'll want to create a new block with the file as markdown: ![](url). Provide ONE of: filePath (preferred - local file, server reads directly), url (remote URL, server fetches), or base64 (raw data, fallback for sandboxed clients).

    Note: Call get_graph_guidelines first when starting to work with a graph.

  • file_delete

    Delete a file hosted on Roam.

    Note: Call get_graph_guidelines first when starting to work with a graph.

Roam MCPのMCPを複数のAIモデルで活用

TypingMindはワークスペース単位でMCPツールに接続します。そのため、一度Roam MCPに接続すれば、モデルごとに個別に設定することなく、TypingMind内のさまざまなAIモデルで利用できます。 このMCPは、デバイス上のTypingMind MCPコネクタを通じてローカルで動作します。

ローカルコネクタのセットアップガイド

MCPサーバーが、お使いのコンピューター上のローカルファイル、アプリ、非公開リソースにアクセスする必要がある場合は、この方法を使います。

1

MCP設定を開く

TypingMindで「設定」→「詳細設定」→「Model Context Protocol」の順に進み、「コネクタを設定」を選択してください。

  1. ブラウザでTypingMindを開いてください。
  2. 設定アイコンをクリックしてください。
  3. 「詳細設定」に移動してください。
  4. 「Model Context Protocol」セクションを開いてください。
  5. 「コネクタを設定」をクリックし、「このデバイス」を選択してください。
「このデバイス」が選択されたTypingMindのMCPコネクタ設定画面
2

コネクタのコマンドを実行

「このデバイス」を選択し、TypingMindからコマンドをコピーしてターミナルで実行してください。MCPの使用中は、プロセスを実行したままにしてください。

  1. TypingMindに表示されるセットアップコマンドをコピーしてください。
  2. macOSではターミナルを、WindowsではWindows Terminalを開いてください。
  3. コマンドを貼り付けて実行してください。
  4. ターミナルで続行の確認を求められた場合は、パッケージのインストールを承認してください。
  5. MCPツールの使用中は、ターミナルウィンドウを開いたまま、プロセスの実行を継続してください。
3

Roam MCPをサーバーとして追加

コネクタのステータスが「準備完了」になったら、「サーバーを編集」をクリックし、MCPサーバーの設定を貼り付けてください。

  1. コネクタのステータスが「準備完了」になるまでお待ちください。
  2. 「サーバーを編集」をクリックしてください。
  3. Roam MCPのMCPサーバー設定を貼り付けてください。
  4. サーバー一覧を保存してください。
  5. コネクタのステータスが「準備完了」のままか確認するには、画面を更新してください。
稼働中のサーバーと「サーバーを編集」ボタンが表示されたTypingMindのMCP設定画面
{
  "mcpServers": {
    "roam-research-roam-tools": {
      "command": "npx",
      "args": [
        "-y",
        "roam-tools"
      ]
    }
  }
}
4

複数のモデルで同じ接続を使用

サーバー一覧を保存し、「プラグイン」を開いてRoam MCPのMCPツールを有効にしてください。その後、TypingMindで対応するAIモデルを選択し、チャットでツールを使うか、AIエージェントに割り当ててください。

  1. TypingMindの「プラグイン」ページを開いてください。
  2. Roam MCPのMCPツールを有効にしてください。
  3. チャットを開始し、使用するAIモデルを選択してください。
  4. MCPツールをチャットで使うか、AIエージェントに割り当ててください。
  5. MCPに再接続することなく、必要に応じて別のAIモデルに切り替えられます。
選択したAIモデルと有効なMCPツールを使用したTypingMindのチャット
Roam MCPを使ってこのタスクを手伝ってもらえますか?
Roam MCP
はい、読みました。
Roam MCPで調べた結果をお伝えします。

よくある質問

Roam MCP MCPサーバーは何に使いますか?

Roam MCPは、対応するAIクライアントを外部ツールやコンテキストに接続するためのMCPサーバーです。TypingMindでは、このMCPサーバーを一度追加するだけで、AIワークスペース内でそのツールを利用できるようになります。

TypingMindでは、複数のAIモデルでRoam MCP MCPを利用できますか?

はい。TypingMindはワークスペース単位でMCPツールに接続するため、モデルごとにMCPサーバーを設定する必要はありません。Claude、ChatGPT、Geminiや、TypingMindで設定したその他のAIモデルでRoam MCPを利用できます。

TypingMindでRoam MCP MCPを使うメリットは何ですか?

TypingMindは、複数のAIモデル、プロンプト、プラグイン、AIエージェント、APIキー、MCPツールを1つのワークスペースにまとめられる、LLMチャット向けのトップクラスのフロントエンドです。Roam MCPを接続すると、TypingMindでチャットのワークフローを整理しながら、お好みのモデルでそのMCPツールを利用できます。

Roam MCP MCPをTypingMindに接続するにはどうすればよいですか?

Roam MCPはTypingMindのローカルMCPコネクタ経由で動作します。MCPサーバーがコンピューター上のローカルファイル、デスクトップアプリ、コマンドラインツール、プライベートリソースにアクセスする必要がある場合に最適です。

TypingMindでRoam MCP MCPのどのようなツールを利用できますか?

Roam MCPは25個のMCPツールを提供しています。TypingMindのプラグインページで有効にすると、チャットで使用したり、AIエージェントに割り当てたりできます。

Roam MCP MCPを使うには、APIキーをTypingMindと共有する必要がありますか?

いいえ。TypingMindはローカルファーストの設計で、モデルプロバイダー、APIキー、プロンプト、MCP設定をご自身で管理できます。Roam MCPで認証が必要な場合は、接続の作成時に、そのMCPサーバーに必要なヘッダー、OAuth設定、またはローカル設定を追加してください。

関連するMCPサーバー

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇