Skip to main content
Glama

AFK Mode

Monitor and respond to VS Code Copilot from your phone.

When Copilot's agent mode runs long tasks, it frequently pauses for user input. If you step away, the session stalls. AFK Mode bridges Copilot and your phone through an MCP server — so you can watch progress, get notifications, and respond to prompts without being at your desk.

Quick Start

One-command setup

Run this in your project folder:

npx afk-mode-mcp --setup

This creates .vscode/mcp.json and .github/prompts/afk-workflow.prompt.md — done. Copilot will start AFK Mode automatically when it needs it.

Usage

  1. Ask Copilot: "Show me the AFK app link" → scan the QR code on your phone

  2. Toggle AFK Mode on in the app

  3. Start a task with /afk-workflow — Copilot routes all progress and decisions to your phone

Push notifications work automatically — no extra setup needed.

Manual setup (alternative)

If you prefer to configure manually, add this to .vscode/mcp.json in your workspace:

{
  "servers": {
    "afk-mode-mcp": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "afk-mode-mcp"],
      "env": {
        "AFK_PORT": "7842"
      }
    }
  }
}

Related MCP server: CloudZIR MCP Server

How It Works

AFK Mode is a single Node.js process that serves two roles simultaneously:

  1. MCP Server (stdio) — Exposes tools that Copilot calls to report progress and request decisions

  2. Web App Server (HTTP + WebSocket) — Serves a React PWA and maintains a real-time connection with your phone

┌──────────────┐     stdio      ┌──────────────────────┐    WebSocket     ┌──────────────┐
│  VS Code     │◄──────────────►│  MCP + Web Server    │◄────────────────►│  Mobile Web  │
│  Copilot     │                │  (single process)    │    HTTP (static) │  App (PWA)   │
│  Agent Mode  │                │                      │◄────────────────►│              │
└──────────────┘                └──────────────────────┘                  └──────────────┘
  1. Copilot starts the MCP server → HTTP/WebSocket server starts automatically on port 7842

  2. Ask Copilot "Show me the AFK app link" → it calls get_current_web_app_url and renders a QR code

  3. Scan the QR code on your phone → the PWA connects via WebSocket

  4. Toggle AFK Mode on in the app → Copilot routes interactions through your phone

  5. Copilot sends progress updates and decision prompts to your phone in real time

  6. Toggle AFK Mode off → Copilot goes back to the normal VS Code chat panel

MCP Tools

The server exposes 4 tools to Copilot:

Tool

Purpose

get_current_web_app_url

Returns the connection URL + QR code for pairing your phone

get_afk_status

Checks if AFK mode is on and a client is connected

notify_session_progress

Sends a progress update to the phone (info, warning, error, success, milestone)

get_user_decision

Asks the user a question and blocks until they respond (confirm, choice, text, or diff review)

notify_session_progress

Sends real-time progress to the phone. Categories control the icon and urgency:

  • info — general status (ℹ️)

  • success — task completed (✅)

  • error — something failed (❌)

  • milestone — significant achievement (🎯)

  • warning — needs attention (⚠️)

Supports optional progress bars ({ current, total, label }) and file change lists.

get_user_decision

Blocks Copilot until the user responds on their phone. Decision types:

  • confirm — Yes/No

  • choice — Pick from a list of options

  • text — Free-form text input

  • diff — Review a code diff and approve/reject

Includes a configurable timeout (default 5 minutes) with an optional default value.

Web App Features

  • Dashboard — AFK toggle, live progress feed with category icons and progress bars

  • Decision prompts — Modal overlay with countdown timer, vibration alert

  • Diff viewer — Unified diff with syntax coloring for code review decisions

  • History — Searchable/filterable log of all progress entries (persisted in localStorage)

  • Settings — Verbosity, sound, vibration, theme (light/dark/system)

  • PWA — Installable to home screen, works offline via service worker (network-first caching)

Push Notifications

Push notifications alert you on your phone even when the browser tab is in the background (e.g., for errors or pending decisions). They work out of the box — no configuration required.

Push uses the Web Push standard with VAPID (Voluntary Application Server Identification). VAPID is an open W3C standard — no Google account, Firebase setup, or API keys required.

How it works

  1. Server auto-generates a VAPID key pair on each startup

  2. Client fetches the public key from /api/vapid-key and subscribes via the Push API

  3. Browser returns an FCM/Mozilla/Apple push endpoint — stored on the server

  4. Server sends encrypted payloads to the endpoint when needed

  5. Service worker receives the push and shows a system notification

Since VAPID keys are generated per session (and push subscriptions are in-memory), each developer runs an isolated instance — no shared secrets, no cross-talk between team members.

Security

  • Session token — 256-bit random token generated per server instance, required for the initial WebSocket connection

  • Single device — Only one phone can connect at a time (409 Conflict for second connections)

  • Reconnect tickets — Rotating one-time tickets for seamless reconnection after network drops (expires after 5 minutes, invalidated after use)

  • Local network only — The server binds to your machine's local IP; no internet exposure

Environment Variables

Variable

Default

Description

AFK_PORT

7842

HTTP/WebSocket server port

Development (for contributors)

git clone <repo-url> && cd afk-mode-mcp
pnpm install

# Run server with hot reload
pnpm dev:server

# Run webapp dev server (Vite, port 5173)
pnpm dev:webapp

# Build everything
pnpm build

# Start production server
pnpm start

# Lint and format
pnpm lint             # Check for lint errors
pnpm lint:fix         # Auto-fix lint errors
pnpm format           # Format all source files
pnpm format:check     # Check formatting without writing

Tech Stack

  • Server: Node.js, Express 5, WebSocket (ws), @modelcontextprotocol/sdk

  • Web App: React 19, Vite 7, MUI (Material UI) 7, Emotion

  • Build: tsup (server), Vite (webapp)

  • Lint: ESLint 10 with typescript-eslint + React Hooks plugin

  • Format: Prettier

  • Push: web-push with VAPID

  • QR: qrcode (data-URI PNG)

Available Tools

4 tools
get_afk_statusA

Returns the current AFK mode status. Call this before every interaction to decide whether to route through AFK MCP tools or native chat. If afkMode is true and clientConnected is true, route through notify_session_progress / get_user_decision. If afkMode is true but clientConnected is false, fall back to native chat and warn the user. If afkMode is false, use native VS Code chat as usual.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes the tool's behavior by explaining the return values (afkMode and clientConnected status) and their implications for routing decisions. However, it lacks details on error handling, response format, or any rate limits, leaving some behavioral aspects unspecified.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured and front-loaded, starting with the core purpose. Each sentence adds value by explaining usage scenarios and routing logic. However, it could be slightly more concise by combining some conditional statements, though all content is relevant and earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (simple status check with 0 parameters) and lack of annotations/output schema, the description is largely complete. It covers purpose, usage, and behavioral implications. However, it does not specify the exact return format (e.g., JSON structure) or error cases, which could enhance completeness for an AI agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters, with 100% schema description coverage. The description does not need to add parameter semantics, so a baseline of 4 is appropriate. It appropriately focuses on the tool's purpose and usage without unnecessary parameter details.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description explicitly states the tool's purpose: 'Returns the current AFK mode status.' It uses a specific verb ('Returns') and resource ('AFK mode status'), clearly distinguishing it from sibling tools like 'get_user_decision' or 'notify_session_progress' which perform different actions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance on when to use this tool: 'Call this before every interaction to decide whether to route through AFK MCP tools or native chat.' It also details specific conditions (e.g., 'If afkMode is true and clientConnected is true...') and mentions alternatives like 'native chat' and sibling tools, offering clear context for decision-making.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_current_web_app_urlA

Returns the connection URL and QR code for the AFK Mode web app. Call this when the user asks for the AFK app link or QR code.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It describes the return content (URL and QR code) but lacks details on format (e.g., image vs. text), potential errors, or authentication needs. It's adequate but not rich in behavioral context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

It's front-loaded with the core purpose in the first sentence and usage guidance in the second, with zero wasted words. Every sentence adds clear value without redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple, parameterless tool with no output schema, the description covers purpose and usage well. However, without annotations or output schema, it could benefit from more detail on return format or error handling, slightly limiting completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters, and schema description coverage is 100%, so no parameter documentation is needed. The description appropriately doesn't discuss parameters, earning a baseline score of 4 for this context.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verbs ('returns') and resources ('connection URL and QR code for the AFK Mode web app'), and distinguishes it from siblings by focusing on app access rather than status, decisions, or notifications.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It provides explicit guidance on when to use this tool ('when the user asks for the AFK app link or QR code'), which clearly differentiates it from sibling tools like get_afk_status (status checks) or get_user_decision (decision-making).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_user_decisionA

Sends a decision request to the mobile client and blocks until the user responds or timeout expires. Only call when AFK mode is active. Use type 'confirm' for yes/no, 'choice' for selecting from options, 'text' for free-text input, 'diff' for approving code changes.

ParametersJSON Schema
NameRequiredDescriptionDefault
sessionIdYesThe session ID
promptYesThe question for the user
typeYesThe type of decision
optionsNoFor "choice" type: list of options
diffNoFor "diff" type: file diff information
defaultValueNoDefault value used if timeout fires
timeoutSecondsNoTimeout in seconds (default: 300)

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden and does well by disclosing key behaviors: it blocks until response/timeout, has timeout handling, and requires AFK mode. It doesn't mention error cases or response format, but covers essential operational context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, zero waste. First sentence states core functionality, second provides critical usage rules and type guidance. Every phrase earns its place with essential information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a complex 7-parameter tool with no annotations or output schema, the description provides strong context on when/how to use it and behavioral constraints. It could mention response format or error handling, but covers the most critical aspects given the complexity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description adds minimal value by mentioning type usage examples, but doesn't provide additional semantics beyond what's in the schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verbs ('sends', 'blocks') and resources ('decision request to mobile client'), and distinguishes it from siblings by specifying it's for user decisions during AFK mode, unlike status-checking or notification tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly states when to use ('Only call when AFK mode is active') and provides clear alternatives for different decision types ('Use type 'confirm' for yes/no, 'choice' for selecting from options, etc.'), helping the agent choose appropriately.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

notify_session_progressA

Sends a progress update to the connected mobile client. Only call this when AFK mode is active (afkMode: true and clientConnected: true). Returns immediately. Use category 'milestone' for significant steps, 'error' for failures, 'info' for routine updates.

ParametersJSON Schema
NameRequiredDescriptionDefault
sessionIdYesThe session ID
summaryYesShort human-readable summary
detailNoExtended detail (shown in detailed verbosity)
categoryYesCategory of the progress update
progressNoOptional structured progress
filesChangedNoOptional list of files touched
toolsUsedNoOptional list of tools called

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden and does well by disclosing key behavioral traits: it specifies the prerequisite conditions (AFK mode active), indicates immediate return behavior ('Returns immediately'), and explains how different categories should be used. However, it doesn't mention potential side effects like network errors or client response handling.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three tightly focused sentences with zero waste: first states purpose and prerequisites, second describes return behavior, third provides category usage guidance. Every sentence earns its place by adding essential information not found elsewhere.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 7 parameters, 100% schema coverage, and no output schema, the description provides excellent contextual completeness by covering prerequisites, behavioral traits, and usage guidelines. The only minor gap is lack of information about return values or error conditions, but this is reasonable given the tool's complexity level.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, providing comprehensive parameter documentation. The description adds minimal value beyond the schema, only mentioning category usage guidelines which partially overlap with the enum description. Baseline 3 is appropriate when the schema does most of the work.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Sends a progress update') and target ('to the connected mobile client'), distinguishing it from sibling tools like get_afk_status or get_user_decision that perform different functions. It goes beyond restating the name by specifying the communication context.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly states when to use ('Only call this when AFK mode is active (afkMode: true and clientConnected: true)') and provides detailed guidance on category usage ('Use category 'milestone' for significant steps, 'error' for failures, 'info' for routine updates'), offering clear alternatives within the tool itself.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

TDQS

A4.6/5.0
Disambiguation5/5

Each tool has a distinct and non-overlapping purpose: get_afk_status checks the operational mode, get_current_web_app_url provides connection details, get_user_decision handles user input, and notify_session_progress sends updates. There is no ambiguity in tool selection for an agent.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern with snake_case (e.g., get_afk_status, notify_session_progress). The naming is predictable and uniform across all four tools.

Tool Count5/5

With 4 tools, the server is well-scoped for managing AFK mode interactions. Each tool serves a clear role in the workflow, and the count is appropriate without being excessive or insufficient for the domain.

Completeness5/5

The tool set provides complete coverage for the AFK mode domain: status checking, connection setup, user decision-making, and progress notifications. There are no obvious gaps, and the tools support a full lifecycle from setup to interaction.

Maintenance

ActivityInactive
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    Not graded
    maintenance
    An enterprise-grade MCP server providing integrated system prompts and context management for consistent AI behavior across development and infrastructure tasks. It enables users to access specialized prompts for code quality standards and security-first deployment guidance.
  • A
    license
    Not graded
    quality
    D
    maintenance
    An MCP server that enables AI agents to send notifications and request user input via Discord during long-running tasks. It allows users to remotely interact with their AI assistants and provide feedback through the Discord messaging platform.
    26
    2
    MIT
  • A
    license
    Not graded
    quality
    A
    maintenance
    An enterprise-grade MCP server that enables AI coding assistants to securely connect with external tools, APIs, databases, and cloud services through a unified interface, offering structured engineering workflows and multi-client support.
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/paulbennet/afk-mode-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server