{
  "name": "m365-api",
  "version": "0.1.5",
  "type": "module",
  "description": "Local API adapter for Microsoft 365 Copilot Code models and reasoning effort",
  "engines": {
    "node": ">=24"
  },
  "scripts": {
    "start": "node scripts/cli.mjs start",
    "start:background": "node scripts/cli.mjs start",
    "test": "node --test test/*.test.mjs",
    "auth:import": "node scripts/cli.mjs auth:import",
    "auth:login": "node scripts/cli.mjs login",
    "claude:install": "node scripts/cli.mjs setup",
    "claude:configure": "node scripts/cli.mjs claude:configure",
    "claude:desktop:configure": "node scripts/cli.mjs claude:desktop:configure",
    "claude:mcp:allow": "node scripts/cli.mjs claude:mcp:allow",
    "check": "node --check src/server.mjs && node --check src/client.mjs && node --check src/auth.mjs && node --check src/anthropic.mjs && node --check src/response-parameters.mjs && node --check src/partial-text.mjs && node --check src/text-smoother.mjs && node --check src/device-login.mjs && node --check src/browser-login.mjs && node --check src/claude-config.mjs && node --check src/claude-discovery.mjs && node --check src/conversation-store.mjs && node --check src/transcript-state.mjs && node --check src/reply-cache.mjs && node --check src/compaction.mjs && node --check src/upstream-context.mjs && node --check src/images.mjs && node --check src/files.mjs && node --check src/completions.mjs && node --check public/app.js && node --check scripts/install-claude.mjs && node --check scripts/configure-claude.mjs && node --check scripts/configure-claude-desktop.mjs && node --check scripts/login.mjs && node --check scripts/start.mjs && node --check scripts/ensure-dependencies.mjs && node --check scripts/spawn-background.mjs && node --check src/gateway-config.mjs && node --check scripts/service.mjs && node --check scripts/cli.mjs && node --check src/installation.mjs && node --check src/release.mjs && node --check scripts/package-install.mjs && node --check scripts/package-launcher.mjs && node --check scripts/postinstall.mjs && node --check scripts/prepare-package.mjs && node --check scripts/runtime-check.mjs && node --check scripts/runtime-update.mjs && node --check scripts/release-artifact.mjs && node --check scripts/smoke-package.mjs && node --check scripts/github-release.mjs && node --check scripts/pack-release.mjs && node --check scripts/github-api.mjs && node --check scripts/daily-release.mjs && node --check scripts/startup-update.mjs && node --check scripts/installer-prompt.mjs",
    "setup": "node scripts/cli.mjs setup",
    "stop": "node scripts/cli.mjs stop",
    "restart": "node scripts/cli.mjs restart",
    "status": "node scripts/cli.mjs status",
    "update": "node scripts/cli.mjs update",
    "startup": "node scripts/cli.mjs startup",
    "startup:remove": "node scripts/cli.mjs startup:remove",
    "start:foreground": "node scripts/cli.mjs start --foreground",
    "prepack": "node scripts/prepare-package.mjs",
    "postinstall": "node scripts/postinstall.mjs",
    "runtime:check": "node scripts/runtime-check.mjs"
  },
  "dependencies": {
    "@modelcontextprotocol/sdk": "1.32.1",
    "@playwright/cli": "0.1.22",
    "@playwright/mcp": "0.0.83",
    "ajv": "8.20.0",
    "ajv-formats": "3.0.1"
  },
  "bin": {
    "m365-api": "scripts/cli.mjs"
  },
  "license": "MIT",
  "repository": {
    "type": "git",
    "url": "https://github.com/shaowei_microsoft/m365-api.git"
  },
  "homepage": "https://m365api.claxlink.top",
  "bugs": {
    "url": "https://github.com/shaowei_microsoft/m365-api/issues"
  },
  "files": [
    "src/",
    "scripts/",
    "public/",
    "README.md",
    "README.zh-CN.md",
    "LICENSE",
    ".env.example",
    ".github/assets/",
    "package-mode.json",
    "templates/",
    "docs/reference.md",
    "docs/reference.zh-CN.md",
    "docs/publishing.md",
    "docs/publishing.zh-CN.md",
    "CONTRIBUTING.md",
    "CONTRIBUTING.zh-CN.md"
  ],
  "bundleDependencies": true,
  "publishConfig": {
    "access": "public"
  },
  "readme": "[![简体中文](.github/assets/lang-zh-CN.svg)](https://github.com/shaowei_microsoft/m365-api/blob/main/README.zh-CN.md)\n\n# m365-api\n\nConnect Microsoft 365 Copilot Code to Claude CLI, Claude Desktop, and OpenAI-compatible clients.\n\n## Quick start (Windows PowerShell)\n\nInstall **Node.js 24+, Edge**, and your preferred Claude client. Your work account must have access to the [Microsoft 365 Copilot Code page](https://copilot.cloud.microsoft/code?origindomain=microsoft365&es=SSR&redirfrom=mcmToCcm#/sessions).\n\n```powershell\nnpm install -g m365-api --allow-scripts=m365-api\n```\n\nGlobal installation automatically runs setup: choose a port, initially **8787**; a saved port is reused without asking. It configures the discovered Claude clients, enables Windows sign-in startup, starts the gateway, and prints the absolute configuration paths. To rerun setup or change the port:\n\n```powershell\nm365-api setup --port 8787\n```\n\nIf your network cannot reach npmjs, install the same package with its bundled dependencies from the distribution site:\n\n```powershell\nnpm install -g https://m365api.claxlink.top/releases/latest.tgz --allow-scripts=https://m365api.claxlink.top/releases/latest.tgz --no-audit --no-fund --foreground-scripts\n```\n\nThe first startup attempts silent Microsoft sign-in. If interaction or MFA is required:\n\n```powershell\nm365-api login --headed\nm365-api start\n```\n\n## Installation behavior\n\nGlobal Windows npm installation deploys the runtime and command, then automatically runs setup. Runtime deployment does not scan or change old source PATH registrations, discover or back up legacy startup targets, or automatically migrate old deployments. Existing managed data is retained. Setup writes the current VBS startup entry directly.\n\nIf client configuration or first-use sign-in needs attention, the command stays installed and the console explains how to finish with `m365-api setup`. npm installs using `--ignore-scripts` require `m365-api setup` afterwards. Portable mode (`M365_API_PORTABLE=1`), local dependency installs, and non-Windows installs skip automatic host setup. Explicit source migration is available separately with `m365-api migrate --legacy-root <path>`; it is never run automatically.\n\n## Usage\n\n```powershell\nclaude --model opus --effort max\nclaude --model sonnet --effort max\n```\n\nIn Claude Desktop, restart and use the selected `m365-api` profile, displayed as **M365APP**. Open **Code** and select a local project.\n\n| Interface | Default address |\n|---|---|\n| Web interface / Claude base URL | http://127.0.0.1:8787 |\n| OpenAI base URL | http://127.0.0.1:8787/v1 |\n\nUse the address shown by setup or status if you selected another port. Upload files through the web interface or compatible Claude / Anthropic file APIs; see [reference](docs/reference.md).\n\n## Common commands\n\n| Action | Command |\n|---|---|\n| Configure clients and start | `m365-api setup` |\n| Start / stop / restart | `m365-api start` / `m365-api stop` / `m365-api restart` |\n| Show status and configuration paths | `m365-api status` |\n| Check for an update | `m365-api update --check-only` |\n| Download, verify and apply an update | `m365-api update` |\n| Run in the foreground | `m365-api start --foreground` |\n| Preview client configuration | `m365-api setup --check-only` |\n| Enable / disable startup | `m365-api startup` / `m365-api startup:remove` |\n| Sign in interactively | `m365-api login --headed` |\n\nStopping interrupts active requests and does not disable startup. Setup enables Windows sign-in startup automatically; use `m365-api startup:remove` to disable it. Development-only command registration and test commands are available from Git checkouts.\n\nWith startup enabled, npm installations check the saved distribution address at each Windows sign-in, apply a verified update if available, then start the gateway. If the check or update fails, the preserved runtime still starts. Results are saved in `.local/startup-update.log`. Upgrading an older package also upgrades its existing startup launcher at the next start.\n\n## Updates and data\n\nnpm installations keep data under **%LOCALAPPDATA%\\m365-api** on Windows. The saved settings are in `.env`; credentials, conversations and attachments are under `.local`. `M365_API_HOME` selects another data directory. Setup and status show the actual absolute configuration path.\n\n`m365-api update` downloads a complete runtime from **m365api.claxlink.top**, verifies its SHA-512 digest, stages it alongside the current version and performs a self-check before switching. It requires no Git or npm-registry access. A running gateway is restarted and health-checked; failure attempts to restore the previous version and service. User data is shared across runtime versions. Interactive updates ask for `y/n` confirmation before interrupting connected clients. Unattended login updates preserve the running gateway when clients are connected. Preview does not change files or stop the gateway.\n\nTo use another distribution source, run `m365-api update --source <HTTPS URL>`. Package installation inherits your npm registry settings; the runtime distribution address is configured separately. Node.js and Edge remain system prerequisites.\n\nFor source development, configuration, file APIs and limitations, see the [reference](docs/reference.md) and [contribution guide](CONTRIBUTING.md).\n",
  "readmeFilename": "README.md"
}
