Tavis.M365CopilotChat 1.0.0

dotnet tool install --global Tavis.M365CopilotChat --version 1.0.0
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local Tavis.M365CopilotChat --version 1.0.0
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=Tavis.M365CopilotChat&version=1.0.0
                    
nuke :add-package Tavis.M365CopilotChat --version 1.0.0
                    

M365 Copilot Chat CLI

Command-line tool for interacting with Microsoft 365 Copilot Chat API. Supports both one-shot queries and multi-turn interactive conversations.

Features

  • Interactive Login: Sign in with your Microsoft 365 account using Entra ID
  • Encrypted Token Cache: Tokens are securely cached and refreshed automatically
  • One-Shot Mode: Execute a single query and receive a response
  • Interactive REPL Mode: Maintain multi-turn conversations with context (coming soon)
  • Streaming Responses: Real-time Server-Sent Events streaming

Prerequisites

  • .NET 8.0 SDK or later
  • Microsoft 365 Copilot license
  • Microsoft 365 account with appropriate permissions

Installation

Build from Source

# Clone repository
git clone https://github.com/microsoft/copilot-cli.git
cd copilot-cli

# Install Kiota CLI tool locally
dotnet tool restore

# Discover and install Kiota dependencies
dotnet kiota info -l csharp

# Generate SDK from OpenAPI spec
dotnet kiota generate

# Build project
dotnet build

# Run tool
dotnet run -- "Your query here"

Install as Global Tool

dotnet pack
dotnet tool install --global --add-source ./nupkg copilot-cli

Configuration

First-Time Setup

  1. Sign in with your Microsoft 365 account:

    dotnet run -- login
    
  2. A browser window will open for you to authenticate with Microsoft Entra ID

  3. Tokens are cached securely:

    • Windows: Encrypted using DPAPI (Data Protection API)
    • macOS: Stored in macOS Keychain
    • Linux: Stored in Linux Secret Service (GNOME Keyring, KWallet, etc.)
  4. Tokens refresh automatically - you don't need to re-authenticate unless you explicitly log out

Sign Out

To clear cached tokens:

dotnet run -- logout

Usage

One-Shot Mode

Send a single query and exit:

# First, authenticate
dotnet run -- login

# Then send queries
dotnet run -- "What are my upcoming meetings today?"
dotnet run -- "Summarize my recent emails from Sarah"

Interactive Mode (Coming Soon)

Start an interactive conversation session:

dotnet run

Type exit or quit to end the session.

Exit Codes

  • 0 - Success
  • 1 - Authentication error (missing or invalid token)
  • 2 - Permission denied (insufficient Graph API permissions)
  • 3 - Network error
  • 4 - Invalid input
  • 5 - Conversation error

Development

See quickstart.md for detailed usage instructions.

License

MIT

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
1.0.0 282 11/24/2025