Roam MCP

Roam MCP

MCP server for Roam Research that enables AI assistants like Claude and Cursor to read, write, search, and query your Roam graph with full write access.

Category
访问服务器

README

Roam MCP

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):

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):

# 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"
Flag Default Description
--graph <name> — Graph name (enables non-interactive mode)
--nickname <name> Required with --graph Short name you'll use to refer to this graph
--access-level <level> full full, read-append, or read-only
--public — Public graph (read-only, hosted)
--type <type> hosted hosted or offline

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

To remove a connection:

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:

{
  "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

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:

{
  "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.

Field Required Description
name Yes The actual graph name in Roam (as shown in the URL)
type No "hosted" (default) for cloud graphs, "offline" for local-only
token Yes Local API token from Roam settings
nickname Yes Slug identifier for this graph (lowercase, hyphens, no spaces)
accessLevel No "full" (default), "read-only", or "read-append"

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
  • create_block - Create blocks (by parent UID, page title, or daily note date; with optional nest-under)
  • update_block - Update block content/properties
  • move_block - Move a block to a new location
  • delete_block - Delete a block
  • 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)
  • 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

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

CLI

Install globally for quick access:

npm install -g @roam-research/roam-cli
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:

Package Description
@roam-research/roam-tools-core Transport-agnostic core library (tools, operations, types, dispatch)
@roam-research/roam-tools-local Local Roam Desktop transport (client, config reader, connect) — internal dependency of MCP and CLI
@roam-research/roam-mcp MCP server — connect Claude/Cursor/etc. to Roam
@roam-research/roam-cli CLI — setup and direct tool access

See CHANGELOG.md for release history.

Development

To work on this project from source:

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

Development commands:

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.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选