Skip to content

nils010485/outlinecli

Repository files navigation

Outline CLI

A powerful terminal client for Outline that brings your knowledge base to your command line.

Python Version License

Disclaimer: This project is not affiliated with, endorsed by, or connected to Outline in any way. This is an independent open-source project.

Features

  • Beautiful UI: Rich terminal interface with colors, tables, and progress indicators
  • Document Management: Create, read, update, and delete documents
  • Powerful Search: Full-text search with ranking and context preview
  • Collection Support: Browse and organize documents by collections
  • Quick Actions: Fast document access by title or ID
  • Markdown Support: Full markdown rendering and editing
  • Vim Integration: Edit documents with your favorite editor
  • Configuration Management: Secure credential storage
  • Interactive Mode: User-friendly menu-driven interface
  • MCP Support: Model Context Protocol server for AI integration

Installation

from source:

git clone https://github.com/nils010485/outlinecli.git
cd outlinecli
pip install .

Dependencies

The tool requires Python 3.8+ and automatically installs these dependencies:

  • requests - HTTP client for API calls
  • rich - Beautiful terminal output
  • click - Command line interface framework
  • python-dotenv - Environment variable management
  • markdown - Markdown processing
  • mcp - Model Context Protocol server

Usage

First Time Setup

outlinecli setup

This will prompt you for:

  • Your Outline server URL
  • Your API key (found in Outline settings)

Interactive Mode

outlinecli interactive

Launch a user-friendly menu interface for all operations.

Command Line Usage

Documents

# List recent documents
outlinecli list --limit 50

# Search documents
outlinecli search "query"

# Quick search and view by title
outlinecli quick "my document title"

# View a document (by ID or search)
outlinecli show "document-id-or-query"

# Edit a document
outlinecli edit "document-id-or-query"

# Delete a document (with confirmation)
outlinecli delete "document-id-or-query"

Collections

# List all collections
outlinecli collections

Notes

# Create a quick note
outlinecli note --title "My Note" --content "Note content"

# Create a note with vim editor
outlinecli vimnote

MCP Server (AI Integration)

Outline CLI includes an MCP (Model Context Protocol) server that allows AI assistants like Claude to interact with your Outline knowledge base.

Start MCP Server

outlinecli mcp

Add to Claude Desktop/Claude Code

To use this MCP server with Claude Desktop or Claude Code:

claude mcp add --transport stdio outline -- /path/to/source/outlinecli/.venv/bin/outlinecli mcp

Available MCP Tools

Document Reading (Token-efficient):

Tool Description
list_titles_only List documents with id, title, and updatedAt only
list_collections List all collections with id, name, description, and documentCount
search_titles Search in document titles only
flex_search Search by keywords in titles (mode: "or" or "and")
search_documents Full-text search with relevance ranking
get_document_meta Get document metadata without content text
get_document_content Get document content text only (no metadata)
get_document_preview Get first N characters of document content
get_document Get complete document with text
search_in_document Search keywords in a document, return excerpts with context

Document Modification (Precise edits without full content transfer):

Tool Description
insert_after Insert text after a specific string
insert_before Insert text before a specific string
replace_text Replace specific or all occurrences of a string
delete_between Delete text between two markers
append Add text to the end of a document
prepend Add text to the beginning of a document
update_document Replace entire document content

Document Management:

Tool Description
create_document Create a new document
create_subdocument Create a subdocument under a parent document
delete_document Delete a document (accepts ID or search query)

Server & Metadata:

Tool Description
get_domain Get the configured Outline domain URL
get_collection Get collection details
get_server_info Get information about the currently active server (name, domain)

Multi-Server Support

Outline CLI supports managing multiple Outline servers from a single installation. This is useful when you work with multiple Outline instances (e.g., personal, work, staging).

Server Management

All server management is done through the interactive setup command:

outlinecli setup

The TUI (Terminal User Interface) provides the following options:

  1. Add a new server - Configure a new Outline server with a name, URL, and API key
  2. Edit existing server - Update URL, API key, or name of an existing server
  3. Delete a server - Remove a server configuration (cannot delete active server)
  4. Set active server - Switch the active server
  5. List all servers - View all configured servers with active indicator

Switching Between Servers

# List all configured servers (shows active server)
outlinecli switch

# Switch to a specific server
outlinecli switch production

# Quick switch and verify
outlinecli switch staging && outlinecli collections

MCP Server with Multi-Server Support

The MCP server supports two modes of operation:

1. Active Server Mode (Default)

# MCP follows the current active server set by 'outlinecli switch'
outlinecli mcp

# Claude Desktop configuration (follows switch)
claude mcp add --transport stdio outline -- /path/to/outlinecli mcp

2. Forced Server Mode

# Force MCP to use a specific server (overrides active)
outlinecli mcp staging

# Claude Desktop configuration (locked to staging)
claude mcp add --transport stdio outline-staging -- /path/to/outlinecli mcp staging

Important: MCP cannot change servers itself. It either follows the active server or uses the server specified at startup. This prevents AI assistants from accidentally switching contexts.

Configuration File

Servers are stored in ~/.outline/servers.json with secure permissions (0o600):

{
  "active": "production",
  "servers": {
    "production": {
      "url": "https://docs.company.com",
      "api_key": "olix_xxxxx..."
    },
    "staging": {
      "url": "https://staging-docs.company.com",
      "api_key": "olix_yyyyy..."
    },
    "personal": {
      "url": "https://app.getoutline.com",
      "api_key": "olix_zzzzz..."
    }
  }
}

Migration from Old Format

If you have an existing ~/.outline/config file from a previous version, it will be automatically migrated to the new format on first run:

  • Old configuration is backed up to ~/.outline/.config.bak
  • A new server named "default" is created with your existing credentials
  • No manual intervention required

Environment Variables

Environment variables still work and override the active server configuration:

export OUTLINE_BASE_URL="https://your-outline-instance.com"
export OUTLINE_API_KEY="your-api-key"

Configuration

The client stores configuration in ~/.outline/servers.json with secure file permissions (0o600).

For single-server setups or overrides, you can also use environment variables:

export OUTLINE_BASE_URL="https://your-outline-instance.com"
export OUTLINE_API_KEY="your-api-key"

Or create a .env file:

OUTLINE_BASE_URL=https://your-outline-instance.com
OUTLINE_API_KEY=your-api-key

Examples

Search and Edit Workflow

# Search for documents
outlinecli search "project planning"

# View specific document
outlinecli show "doc-id-here"

# Edit document
outlinecli edit "doc-id-here"

# Or use quick title search
outlinecli quick "meeting notes"

Create New Documents

# Quick note creation
outlinecli note --title "Meeting Notes" --content "## Team Meeting

- Discussed project timeline
- Decided on next steps
- Action items assigned"

# Or use vim for complex documents
outlinecli vimnote

Tips

  • Use outlinecli quick for fast document access by title
  • The interactive mode is great for exploring your knowledge base
  • Document IDs work with all commands for direct access
  • Search results show ranking quality (●●●●● = Excellent match)
  • Use vim integration for complex document editing

Troubleshooting

API Connection Issues

  1. Verify your Outline server URL is accessible
  2. Check your API key has proper permissions
  3. Ensure your Outline instance allows API access

Common Issues

  • "Not configured": Run outlinecli setup first
  • "API request failed": Check your network connection and credentials
  • Editor not found: Set the EDITOR environment variable

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

Created and maintained by Nils Begou

About

A CLI and MCP server for getoutline server

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages