org-cli

Crates.ioorg-cli
lib.rsorg-cli
version0.0.5
created_at2025-10-07 08:42:13.039381+00
updated_at2026-01-05 20:26:25.957053+00
descriptionCommand-line tool for searching, reading, and managing org-mode knowledge bases with fuzzy text search and structured content access
homepage
repositoryhttps://github.com/szaffarano/org-mcp-server
max_upload_size
id1871349
size139,641
SebastiΓ‘n Zaffarano (szaffarano)

documentation

https://github.com/szaffarano/org-mcp-server

README

org-mcp-server

CI Coverage codecov License: MIT Rust Dependency Status

🚧 Work in Progress: This project is under active development.

A Model Context Protocol (MCP) server for org-mode knowledge management. Provides search, content access, and note linking capabilities for your org-mode files through the MCP protocol.

Features

MCP Resources

  • org:// β€” List all org-mode files in configured directories
  • org://{file} β€” Access raw content of {file}
  • org-outline://{file} β€” Get hierarchical structure of {file} as JSON
  • org-heading://{file}#{heading} β€” Access specific headings by path
  • org-id://{id} β€” Find content by org-mode ID properties
  • org-agenda:// β€” List all agenda items and tasks
  • org-agenda://today β€” Today's scheduled agenda items
  • org-agenda://week β€” This week's scheduled agenda items

MCP Tools

  • org-file-list β€” List all org files in configured directories
  • org-search β€” Search for text content across all org files using fuzzy matching
  • org-agenda β€” Query agenda items with filtering by dates, states, tags, and priorities

CLI Tool

  • org-cli config init β€” Create default configuration file
  • org-cli config show β€” Display current configuration
  • org-cli config path β€” Show configuration file location
  • org-cli list β€” List all .org files in configured directory
  • org-cli init β€” Initialize or validate an org directory
  • org-cli read β€” Read the contents of an org file
  • org-cli outline β€” Get the outline (headings) of an org file
  • org-cli heading β€” Extract content from a specific heading in an org file
  • org-cli element-by-id β€” Extract content from an element by ID across all org files
  • org-cli search β€” Search for text content across all org files using fuzzy matching
  • org-cli agenda list β€” List all tasks (TODO/DONE items)
  • org-cli agenda today β€” Show today's scheduled tasks
  • org-cli agenda week β€” Show this week's scheduled tasks
  • org-cli agenda range β€” Show tasks in custom date range

Configuration

The project uses a TOML configuration file located at ~/.config/org-mcp/config.toml (or $XDG_CONFIG_HOME/org-mcp/config.toml).

Configuration Hierarchy

Configuration is resolved in the following order (highest priority first):

  1. CLI flags β€” Command-line arguments override everything
  2. Environment variables β€” ORG_* prefixed variables
  3. Configuration file β€” TOML file in config directory
  4. Default values β€” Built-in fallbacks

Configuration File Format

[org]
# Root directory containing org-mode files
org_directory = "~/org/"
# Default notes file for new notes
org_default_notes_file = "notes.org"
# Agenda files to include
org_agenda_files = ["agenda.org", "projects.org"]
# Extra files for text search beyond regular org files
org_agenda_text_search_extra_files = ["archive.org"]
org_todo_keywords = [
    "TODO",
    "|",
    "DONE",
]

[logging]
# Log level: trace, debug, info, warn, error
level = "info"
# Log file location (MCP server only, CLI logs to stderr)
file = "~/.local/share/org-mcp-server/logs/server.log"

[cli]
# Default output format for CLI commands
default_format = "plain"  # plain | json

Environment Variables

Org-mode Configuration

  • ORG_ORG__ORG_DIRECTORY β€” Root directory for org files
  • ORG_ORG__ORG_DEFAULT_NOTES_FILE β€” Default notes file name
  • ORG_ORG__ORG_AGENDA_FILES β€” Comma-separated list of agenda files
  • ORG_ORG__ORG_AGENDA_TEXT_SEARCH_EXTRA_FILES β€” Comma-separated extra search files

Logging Configuration

  • ORG_LOGGING__LEVEL β€” Log level (debug, info, warn, error, trace)
  • ORG_LOGGING__FILE β€” Log file location

Server Configuration

  • ORG_SERVER__MAX_CONNECTIONS β€” Maximum number of concurrent connections (default: 10)

CLI Configuration

  • ORG_CLI__DEFAULT_FORMAT β€” Default output format for CLI commands (plain, json)

Configuration Commands

# Create default configuration file
org config init

# Show current resolved configuration
org config show

# Show configuration file path
org config path

Usage Examples

Basic Commands

# List all org files using configuration
org list

# List with JSON output
org list --format json

# Search across all configured org files
org search "project planning"

# Search with custom parameters
org search "TODO" --limit 5 --format json --snippet-size 75

# Override root directory for a single command
org --root-directory ~/documents/org search "meeting notes"

Agenda Commands

# List all tasks (TODO/DONE items)
org agenda list

# List tasks with specific TODO states
org agenda list --states TODO,IN_PROGRESS

# Filter tasks by priority
org agenda list --priority A

# Filter by tags
org agenda list --tags work,urgent

# Show today's scheduled tasks
org agenda today

# Show this week's tasks
org agenda week

# Show tasks in custom date range
org agenda range --start 2025-10-20 --end 2025-10-27

# JSON output for agenda
org agenda list --format json --limit 10

Architecture

Multi-crate Rust workspace:

  • org-core β€” Business logic and org-mode parsing
  • org-mcp-server β€” MCP protocol implementation
  • org-cli β€” CLI interface for testing and direct usage

Built with:

Setup

Pre-built Binaries

Download the latest pre-built binaries from GitHub Releases:

# Download org-cli
curl -LO https://github.com/szaffarano/org-mcp-server/releases/latest/download/org-cli-x86_64-unknown-linux-gnu.tar.gz
tar xzf org-cli-x86_64-unknown-linux-gnu.tar.gz
sudo mv org-cli /usr/local/bin/

# Download org-mcp-server
curl -LO https://github.com/szaffarano/org-mcp-server/releases/latest/download/org-mcp-server-x86_64-unknown-linux-gnu.tar.gz
tar xzf org-mcp-server-x86_64-unknown-linux-gnu.tar.gz
sudo mv org-mcp-server /usr/local/bin/

Pre-built binaries are available for multiple platforms. Check the releases page for all available downloads.

Cargo Install

Install from crates.io using Cargo:

# Install CLI tool
cargo install org-cli --locked

# Install MCP server
cargo install org-mcp-server --locked

Using Nix Flakes

# Run directly with nix
nix run github:szaffarano/org-mcp-server

# Install to profile
nix profile install github:szaffarano/org-mcp-server

# Development environment
nix develop github:szaffarano/org-mcp-server

From Source

# Clone and build
git clone https://github.com/szaffarano/org-mcp-server
cd org-mcp-server
cargo build --release

# Run MCP server
cargo run --bin org-mcp-server

# Test with CLI
cargo run --bin org-cli -- list

MCP Server Integration

AI Agent Configuration

Add the following to your agent configuration (e.g., ~/.config/opencode/opencode.json, ~/.claude.json, etc.):

{
  "mcpServers": {
    "org-mode": {
      "command": "/path/to/org-mcp-server",
      "args": [],
      "env": {}
    }
  }
}

Or if installed via Nix:

{
  "mcpServers": {
    "org-mode": {
      "command": "nix",
      "args": ["run", "github:szaffarano/org-mcp-server"],
      "env": {}
    }
  }
}

Environment Variable Configuration

You can configure the MCP server through environment variables in your agent configuration:

{
  "mcpServers": {
    "org-mode": {
      "command": "/path/to/org-mcp-server",
      "args": [],
      "env": {
        "ORG_ORG__ORG_DIRECTORY": "/path/to/your/org/files",
        "ORG_LOGGING__LEVEL": "info",
        "ORG_SERVER__MAX_CONNECTIONS": "20"
      }
    }
  }
}

Development

# Run all tests
cargo test

# Run specific crate tests
cargo test -p org-core

# Format and lint
cargo fmt
cargo clippy

# Run examples
cargo run --example <name>

Roadmap

Phase 1: Core Functionality βœ…

  • File discovery and listing
  • Basic content access via MCP resources
  • Org-mode parsing with orgize
  • ID-based element lookup
  • CLI tool for testing
  • Full-text search across org files

Phase 2: Advanced Features 🚧

  • Configuration file support with TOML format
  • Environment variable configuration
  • Unified CLI interface with global configuration
  • Tag-based filtering and querying
  • Agenda-related Functionality
  • Link following and backlink discovery (org-roam support)
  • Metadata caching for performance

Phase 3: Extended Capabilities πŸ“‹

  • Content creation and modification tools
  • Media file reference handling
  • Integration with org-roam databases
  • Real-time file watching and updates
  • Advanced query language

License

MIT License - see LICENSE file for details.

Commit count: 95

cargo fmt