Skip to main content

Purple Codens MCP Server

PyPI version Python License: MIT

⚠️ DEPRECATED: purple-codens-mcp is deprecated as of 0.3.2. MCP support for the Codens family has been consolidated into a single package, codens-mcp. Please migrate:

pip uninstall purple-codens-mcp
pip install codens-mcp

See help.codens.ai for the migration guide. This package will receive no further feature work and only critical fixes, if any.

MCP (Model Context Protocol) server for Purple Codens — AI Development Orchestration.

Install this package to manage Purple Codens projects from any repository using Claude Code.

📖 Full agent reference: help.codens.ai (JA) / help.codens.ai/en (EN). Covers Quick Start, Device Code Flow login (incl. the purple-codens-mcp login CLI as a reliable workaround when the agent-side codens_login hangs), four practical use cases, all 30 tools, error semantics, pricing, and troubleshooting. AI crawlers can ingest llms.txt or the full plain-text dump at llms-full.txt.

Installation

pip install purple-codens-mcp

Or from source:

cd purple-codens/purple-codens-mcp
pip install -e .

Claude Code Integration

Add to .claude/settings.json in your repository:

{
  "mcpServers": {
    "purple-codens": {
      "command": "purple-codens-mcp",
      "args": ["--api-url", "https://api.purple.codens.ai"]
    }
  }
}

Available Tools

Auth

Tool Description
purple_login(api_url, email, password) Log in and store JWT in ~/.purple-codens/credentials.json
purple_whoami(api_url) Return current user and organization info

Project Setup

Tool Description
purple_analyze_repo(cwd?) Scan local repo: detect CLAUDE.md, rules, test commands, CI workflows, git remote
purple_init_project(api_url, name, ...) Create project, link repo, import instructions — all in one call
purple_list_projects(api_url) List all projects in the organization

Repository

Tool Description
purple_add_repository(api_url, project_id, github_owner, github_repo, branch, workflow_type) Link a GitHub repository to a project
purple_list_repositories(api_url, project_id) List repositories linked to a project

Instruction Files

Tool Description
purple_import_instructions(api_url, project_id, repository_id) Pull CLAUDE.md + .claude/rules/ from GitHub into Purple Codens
purple_list_instructions(api_url, project_id) List instruction files for a project
purple_sync_instructions(api_url, project_id, cwd?) Diff local files with Purple Codens and update changed ones

Workflow & Run Management

Tool Description
purple_create_workflow(api_url, organization_id, project_id, name, spec) Create a new workflow
purple_get_run_status(api_url, organization_id, run_id) Get current status of a workflow run
purple_subscribe_run_events(api_url, run_id, max_events?, timeout_seconds?) Subscribe to SSE events for a run (org_id resolved from auth token)
purple_inject_message(api_url, organization_id, project_id, run_id, message) Inject an instruction into a heartbeat run
purple_list_runs(api_url, organization_id, project_id?, status?) List workflow runs scoped to org, optionally filtered
purple_cancel_run(api_url, organization_id, run_id, reason?) Cancel a running workflow

Log Retrieval

Tool Args Description
purple_get_run_logs api_url, organization_id, run_id Get VPS job logs for a workflow run
purple_get_task_log_url api_url, organization_id, project_id, task_id Get S3 presigned log URL for a task's latest Claude Code job

purple_get_run_logs — response shape

{
  "status": "success",
  "run_id": "<run_id>",
  "total": 2,
  "jobs": [
    {
      "job_id": "job_abc",
      "status": "completed",
      "log_url": "https://s3.amazonaws.com/...?X-Amz-Expires=3600&...",
      "started_at": "2026-05-14T10:00:00Z",
      "finished_at": "2026-05-14T10:05:00Z"
    }
  ]
}

Each log_url is an S3 presigned URL valid for 1 hour.

purple_get_task_log_url — response shape

{
  "status": "success",
  "log_url": "https://s3.amazonaws.com/...?X-Amz-Expires=3600&...",
  "note": "Presigned URL is valid for 1 hour."
}

When no log exists yet, log_url is null (status remains "success").

Example: inspect a failed run

# 1. Check run status
status = purple_get_run_status(api_url=URL, organization_id=ORG, run_id=RUN)
# → {"status": "success", "run": {"status": "failed", ...}}

# 2. Fetch all job logs for that run
logs = purple_get_run_logs(api_url=URL, organization_id=ORG, run_id=RUN)
# → {"status": "success", "total": 1, "jobs": [{"log_url": "https://..."}]}

# 3. Download the log (URL valid for 1 hour)
import httpx
log_text = httpx.get(logs["jobs"][0]["log_url"]).text

Typical Workflow

# In Claude Code, after adding the MCP server to settings.json:

1. purple_login       → authenticate
2. purple_analyze_repo → inspect current repo
3. purple_init_project → create project + link repo + import instructions
4. purple_list_projects → confirm project created
5. purple_sync_instructions → keep instructions in sync as CLAUDE.md evolves

Credential Storage

JWT tokens are stored in ~/.purple-codens/credentials.json with 0600 permissions (owner read/write only). Tokens are keyed by api_url so multiple Purple Codens instances are supported.

On 401 responses, credentials are automatically cleared and an AuthenticationError is raised prompting re-login.

Development

cd purple-codens/purple-codens-mcp

# Install in editable mode with dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Run tests with coverage
pytest --cov=src --cov-report=term

Changelog

See CHANGELOG.md.

Release files for purple-codens-mcp 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for purple-codens-mcp 0.3.2
File Size Uploaded
purple_codens_mcp-0.3.2.tar.gz 20.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for purple-codens-mcp 0.3.2
File Interpreter ABI Platform
purple_codens_mcp-0.3.2-py3-none-any.whl Python 3 none any Details

Total release size: 46.8 kB

Release files / purple_codens_mcp-0.3.2.tar.gz

Download URL purple_codens_mcp-0.3.2.tar.gz
Size 20.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6be76dfe32be3c8c9126f66aae01c8425d5de20c48bd78dd932977676abcb833
BLAKE2b-256 checksum
How to use checksums
e0012f781a0ab87a3e499a1b31a353160a4c859689a65f6f49060a09a8b4db86
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release files / purple_codens_mcp-0.3.2-py3-none-any.whl

Download URL purple_codens_mcp-0.3.2-py3-none-any.whl
Size 26.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0e20df034780a4c82e3bc7cba71960d59794f3050673ba74bc4942188333dd96
BLAKE2b-256 checksum
How to use checksums
8aff4d9f93da93ea14418aae3f72bba1c2357fc39bec845d0f4b17b4e0bee646
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release history Release notifications | RSS feed

This release

0.3.2 This release

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page