PE

Peacock for VS Code MCP Server Color API

Use the Peacock for VS Code MCP server to color editors via a Color API and learn how it interacts with APIs to theme your workspace.

Quick Install
npx -y @johnpapa/peacock-mcp

Overview

Peacock for VS Code MCP Server provides an HTTP-based Color API that lets external tools and automation control Peacock (the VS Code workspace coloring extension) using the Model Context Protocol (MCP) pattern. Instead of using the VS Code extension UI, CI scripts, pairing tools, or other services can call the server to apply, change, or clear workspace colors programmatically.

This server sits between your external systems and the Peacock extension (or an MCP-aware client). It accepts simple JSON requests to set theme colors, manage named favorites, and query current color state. For teams and automated workflows, it makes it straightforward to standardize visual context — for example, marking environments by color during deployments, pairing sessions, or multi-project development.

Features

  • Lightweight HTTP Color API for remote control of Peacock-like workspace theming
  • JSON endpoints to set, clear, and query editor/workspace colors
  • Simple startup and configuration via environment variables or command-line
  • Example client usage with curl and Node.js for quick integration
  • Suitable for automation, CI hooks, and collaboration tooling

Installation / Configuration

Clone the repository, install dependencies, and start the server. The examples assume Node.js is installed.

Install and run locally:

git clone https://github.com/johnpapa/peacock-mcp.git
cd peacock-mcp
npm install
npm run start

Run with environment variables:

# Set a custom port (default 3000)
PORT=4000 npm run start

# Example with a secret token to authenticate API calls
PORT=4000 API_TOKEN=your-token npm run start

Configuration options (common environment variables)

  • PORT: HTTP port to listen on (default: 3000)
  • API_TOKEN: optional bearer token required for API calls
  • LOG_LEVEL: logging verbosity (e.g., info, debug)

If you need to run the server as a background service or systemd unit, create a service file that runs npm run start in the project directory and sets the desired environment variables.

Available Resources

Endpoints (example)

MethodPathDescription
GET/statusReturns basic server health and current color state
GET/colorsLists named favorites and current applied color
POST/colorApply a color or named favorite (JSON body)
POST/clearClear the applied workspace color
POST/favoriteSave a color as a named favorite (JSON body)

Example request body for applying a color:

{
  "color": "#7fdbff",
  "name": "staging",
  "applyTo": ["activityBar", "titleBar"]
}

Authentication

  • If API_TOKEN is set, include an Authorization header: Authorization: Bearer your-token

Client examples

  • curl to set a color:
curl -X POST http://localhost:3000/color \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer your-token" \
  -d '{"color":"#ff99cc","name":"pairing","applyTo":["activityBar"]}'
  • Node.js sample using fetch:
import fetch from "node-fetch";

const res = await fetch("http://localhost:3000/color", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer your-token"
  },
  body: JSON.stringify({ color: "#ff99cc", name: "pairing" })
});
console.log(await res.json());

Links and references

  • Project repository: https://github.com/johnpapa/peacock-mcp
  • Peacock extension for VS Code: https://marketplace.visualstudio.com/items?itemName=johnpapa.vscode-peacock
  • MCP (Model Context Protocol) concept: see your organization’s MCP docs or the repository README for protocol details

Use Cases

  • Team environment mapping

    • Apply a specific color automatically when a developer checks out a release branch or opens a particular repo. Example: POST /color with name “production” to make the workspace visually distinct.
  • CI/CD integration

    • Add a job step that calls the Color API to tint VS Code instances used in staging systems or demos. This helps teams immediately recognize the environment they’re connected to.
  • Pair programming and mob sessions

    • Automation can change colors to indicate driver/navigator roles or session phases. For example, a pairing tool calls POST /color {“color”:“#ffd700”,“name”:“driver”} at session start.
  • Onboarding scripts and developer tools

    • Local setup scripts can seed named favorites (POST /favorite) to ensure all team members share the same visual palette for projects.
  • External dashboards and bots

    • ChatOps bots or internal dashboards can call the API to reflect the current workspace status (e.g., a bot triggers an orange color for testing windows).

Troubleshooting & Tips

  • Ensure the Peacock extension (or MCP-compatible client) is installed and configured to accept remote color commands if required.
  • If the server returns authorization errors, verify API_TOKEN and Authorization header.
  • Use GET /status and GET /colors to verify current server state and available favorites before applying changes.
  • Keep color usage consistent across team scripts by saving named favorites and documenting their intended meanings.

This server is designed to be a small, reliable bridge between automation and VS Code workspace theming. Use it to bring consistent visual context into developer workflows, CI pipelines, and collaboration tools.