Skip to main content
Glama
Alpacon MCP Server

Alpacon MCP Server

by alpacax
README.md
# Alpacon MCP Server

> **Let AI agents operate your infrastructure under your control.** Claude, Cursor, and other AI tools run commands and transfer files on your own and your customers' servers through Alpacon. Alpacon checks each command at runtime, holds risky ones for human approval, and records every action routed through it for audit.

An MCP (Model Context Protocol) server that connects AI assistants to Alpacon. Execute commands, transfer files, monitor metrics, and manage servers across your own and customer environments using natural language.

[![Python Version](https://img.shields.io/badge/python-3.12%2B-blue.svg)](https://python.org)
[![MCP Compatible](https://img.shields.io/badge/MCP-Compatible-green.svg)](https://modelcontextprotocol.io)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)

## โœจ What is Alpacon MCP server?

[Alpacon](https://www.alpacax.com/alpacon/) gives people and AI agents one identity for every server. The Alpacon MCP server puts an agent's work under the same controls that govern a person's work. Alpacon checks each command at runtime and runs it, refuses it, or holds it until a human approves it in the web console or Slack. A Work Session ties commands and file transfers to a stated reason, a set of servers, and an expiry. Alpacon records every action that goes through it for audit. Agents reach servers over Alpacon's outbound-only tunnels, with no VPN to join and no SSH keys to hand out.

### ๐ŸŽฏ Key benefits

- **Real-time command validation**: Alpacon checks each command an agent runs and holds risky ones until a human approves them in the web console or Slack
- **Same controls as your team**: AI agents sign in through Alpacon's identity layer and get the same RBAC, audit trails, and session recording as people
- **No credential management**: No SSH keys or VPN configs to distributeโ€”one identity, every server
- **Natural language operations**: "Show me CPU usage for all web servers in production"
- **AI-powered troubleshooting**: "Investigate why server-web-01 is slow and suggest fixes"
- **Multi-workspace support**: Access servers across your own and customer environments with a single interface
- **Compliance-ready**: Every AI operation is logged with full session recording and audit trails

## ๐ŸŒŸ Core features

### ๐Ÿ” **Session-scoped control**
The personal-token Work Session requirement needs an Alpacon server release that enforces it. This MCP release changes guidance; it does not add server-side enforcement.

- Work Sessions that scope command execution and REST file-transfer creation to an active, approved, auditable window for personal API tokens and OAuth/browser callers; service tokens retain their endpoint-specific authorization rules
- Authenticate once, access every authorized server
- Role-based access control (RBAC) with time-limited permissions
- Full audit trail for every AI operation
- Automatic session recording for compliance

### ๐Ÿ”ง **Secure remote operations**
- Command execution on one server or many, gated by the token's ACL
- File upload/download via WebFTP with S3 presigned URLs
- Structured denials that tell the agent how to get authorized instead of failing blind

### ๐Ÿ“Š **Real-time monitoring**
- CPU, memory, disk, and network metrics
- Performance trend analysis and top server identification
- Custom alert rule management
- Comprehensive health dashboards

### ๐Ÿ’ป **System administration**
- User, group, and IAM management
- Package inventory and system information
- Network interface and disk analysis
- Event tracking and search

## ๐Ÿš€ Quick start

### For first-time users (recommended)

**Just run this command and follow the interactive setup:**

```bash
uvx alpacon-mcp
```

That's it! The setup wizard will:
1. โœ… Ask for your region (default: ap1)
2. โœ… Ask for your workspace name
3. โœ… Ask for your API token
4. โœ… Save configuration automatically
5. โœ… Test the connection
6. โœ… Show you the Claude Desktop config to copy

**No manual file editing required!**

### Get your API token

Before running the setup, get your API token:

1. Visit `https://alpacon.io`
2. Log in to your account
3. Click your account card at the bottom of the left sidebar, then **My API tokens**.
4. Create new token or copy existing one
5. **Configure ACL permissions** (important for command execution)
6. Copy the token (starts with `alpat-...`)

### Connect to your MCP client

After setup completes, add the configuration to your MCP client:

```json
{
  "mcpServers": {
    "alpacon": {
      "command": "uvx",
      "args": ["alpacon-mcp"]
    }
  }
}
```

**Client-specific locations:**
- **Claude Desktop**:
  - macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
  - Windows: `%APPDATA%\Claude\claude_desktop_config.json`
- **Cursor**: `.cursor/mcp.json` in your project
- **VS Code**: MCP extension settings

**Restart or reconnect your MCP client** and you're ready! ๐ŸŽ‰

---

## ๐ŸŒ Remote MCP server (hosted, no install)

Don't want to run anything locally? Alpacon hosts a managed MCP server at **`https://mcp.alpacon.io/mcp`** using the streamable-http transport. Just point your AI client at the URL and sign in through your browser.

### Why use the hosted server?

- **No install**: No `uvx`, no Python, no local process to keep running
- **No API token**: You authenticate through your browser (OAuth), not by pasting a token into a config file
- **No `token.json`**: Nothing to create, store, or rotate on your machine
- **No region/workspace config**: The workspaces you can access come from your loginโ€”you just say which one to use in your prompt (e.g. *"list servers in the `production` workspace"*)
- **Always up to date**: Run the latest tools without upgrading anything

### How authentication works

The first time your client connects, it opens a browser window for you to log in to Alpacon (Auth0). After you sign in, the client receives a short-lived token and uses it for every requestโ€”the same identity, RBAC, and audit trail as the Alpacon web console. If an action needs a fresh MFA, the result explains how to complete MFA and what can be retried. For a call that is safe to retry in full, a client on protocol 2026-07-28 or later that declares URL elicitation asks to open the MFA page and retries afterward. Other clients and partially completed calls keep a link in the result; follow its retry instructions. If your session lacks the workspace's sign-in MFA, the client reopens the browser to sign in again.

Because access is granted per login, you **do not** set `region`, `workspace`, or any API token in your client config. Instead, you name the **workspace** in your prompt (e.g. *"in the `production` workspace"*)โ€”tools require it, and the AI passes it along. The **region** is resolved automatically from your authorized workspaces, so you rarely need to mention it.

Desktop notifications are available only when the server runs locally over stdio.

### Add it to your AI client

**Claude Code** (CLI):
```bash
claude mcp add --transport http alpacon https://mcp.alpacon.io/mcp
```
On first use, Claude Code opens your browser to sign in. Verify with `claude mcp list`.

**Claude Desktop**โ€”add a custom connector (Settings โ†’ Connectors โ†’ Add custom connector) with the URL `https://mcp.alpacon.io/mcp`, or use the `mcp-remote` bridge in `claude_desktop_config.json`:
```json
{
  "mcpServers": {
    "alpacon": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://mcp.alpacon.io/mcp"]
    }
  }
}
```

**Cursor**โ€”add to `.cursor/mcp.json`:
```json
{
  "mcpServers": {
    "alpacon": {
      "url": "https://mcp.alpacon.io/mcp"
    }
  }
}
```

**VS Code** (native MCP)โ€”add to `.vscode/mcp.json`:
```json
{
  "servers": {
    "alpacon": {
      "type": "http",
      "url": "https://mcp.alpacon.io/mcp"
    }
  }
}
```

> **Tip**: Any MCP client that supports remote/streamable-http servers can connectโ€”just give it the URL `https://mcp.alpacon.io/mcp`. Clients that only support local (stdio) servers should use the `mcp-remote` bridge shown above for Claude Desktop.

### Agent plugin

Claude Code, Codex, Copilot CLI, and Cursor can install the hosted server as a plugin instead of a bare URL. Besides the connection, the plugin carries the rules for using the tools, which a bare URL cannot:

- `.mcp.json`: names `https://mcp.alpacon.io/mcp` over HTTP. The server stays hosted; nothing runs on your machine, and the first tool call opens the browser sign-in.
- `using-alpacon` skill: teaches the agent that `server_id` is a UUID from `list_servers`, that commands run inside a Work Session, that a `pending_approval` result waits for a person (and that a held command runs on its own once approved), and that a write with `outcome_unknown: true` is checked before it is retried. Reference files it loads on demand hold the details.
- Vulnerability skills: `vuln-diagnose` reads the installed version on each server and reports it `affected`, `not_affected`, or `unknown`; `vuln-remediate` runs one reviewed recipe with `execute_file`, one server at a time, and stops at the first run that does not reach the fixed version; `vuln-verify` checks the fixed version is installed and lists services and kernels still running old code. `vuln-patch` chains the three; a request that names no CVE takes its pending security updates path on Debian and Ubuntu, which lists the security updates a server has pending, kept-back kernel updates and held packages included, and applies only the ones the person chooses. `vuln-mitigate` is for servers that cannot be patched yet: it writes one config-tested PHP-FPM drop-in from the vendor advisory, one server at a time, and lists the services that must reload for it to apply; the vulnerability stays present. None of them runs a restart or reboot itself; a package's own upgrade script may still restart its service.
- A `PreToolUse` hook on Bash: refuses a command that runs the `alpacon` CLI, so Claude stays on the MCP tools when a call fails. It needs `python3` on the `PATH`.

```bash
/plugin marketplace add alpacax/alpacon-mcp
/plugin install alpacon@alpacon-mcp
```

To try a local checkout for one session, run `claude --plugin-dir plugins/alpacon`.

#### Codex, Copilot CLI, and Cursor

The same plugin directory installs in three other agents. Each one loads the skill and the server, and asks for the browser sign-in on the first tool call:

- Codex: reads the Claude manifest. Run `codex plugin marketplace add alpacax/alpacon-mcp` and `codex plugin add alpacon@alpacon-mcp`. Codex runs a plugin's hook only after you trust it in `/hooks`. An MCP server you already named `alpacon` in `config.toml` takes the plugin's place, so remove or rename it first.
- Copilot CLI: reads the Claude manifest. Run `copilot plugin marketplace add alpacax/alpacon-mcp` and `copilot plugin install alpacon@alpacon-mcp`. The hook refuses the command, but the agent sees only that the hook exited with code 2, not the reason.
- Cursor: reads `.cursor-plugin/plugin.json`, which points at the same `.mcp.json` and runs the same hook script on `beforeShellExecution`. Run `cursor-agent --plugin-dir plugins/alpacon` from a checkout, or copy the directory to `~/.cursor/plugins/local/alpacon` for the desktop app.

Do not add a root `plugin.json` (the Agent Plugins manifest) to the plugin: Codex then reads that manifest instead and stops running the hook.

### Hosted vs. localโ€”which should I use?

| | Hosted (remote MCP) | Local (`uvx alpacon-mcp`) |
|---|---|---|
| Setup | Add a URL, sign in via browser | Install + configure token |
| Authentication | Browser OAuth (Auth0) | API token in `token.json`/env |
| Region/workspace | Resolved from login; named in prompt | Configured per token |
| Maintenance | None (managed) | Self-managed upgrades |
| Best for | Quick start, most users | Air-gapped/custom deployments, self-hosting |

---

## ๐Ÿ“‹ CLI commands reference

```bash
uvx alpacon-mcp                                # Start server (auto-setup if needed)
uvx alpacon-mcp setup                          # Run setup wizard (shows token file path)
uvx alpacon-mcp setup --local                  # Use project config instead of global
uvx alpacon-mcp setup --token-file ~/my.json   # Use custom file location
uvx alpacon-mcp test                           # Test your connection
uvx alpacon-mcp list                           # Show configured workspaces
uvx alpacon-mcp add                            # Add another workspace (shows path)
uvx alpacon-mcp --toolsets servers,commands,webftp   # Register only these toolsets
```

---

### Toolsets (selective tool registration)

Local (stdio) mode can register a subset of toolsets to stay within
client tool limits and reduce per-request token cost. Remote mode
(streamable-http with JWT auth, i.e. `ALPACON_MCP_AUTH_ENABLED=true`)
always registers all tools and relies on the client's tool search
optimization.

```json
{
  "mcpServers": {
    "alpacon": {
      "command": "uvx",
      "args": ["alpacon-mcp", "--toolsets", "servers,commands,webftp,metrics"]
    }
  }
}
```

The `ALPACON_MCP_TOOLSETS` environment variable is also supported; the CLI
argument wins when both are set. Default: `all` (register everything).

Available toolsets (1:1 with tool modules): `servers`, `commands`, `webftp`,
`metrics`, `alerts`, `events`, `system-info`, `iam`, `security`, `audit`,
`approvals`, `webhooks`, `packages`, `certs`, `tokens`, `ledger` (stdio
only). Workspace, health,
and Work Session tools are always registered regardless of selection, as are
the MCP prompts; their names (`workspace`, `health`, `work-sessions`,
`prompts`) are accepted in `--toolsets` but have no effect. Any other
unrecognized name fails at startup.

Narrow selections cut real capability: the workflow prompts still reference
tools such as `execute_command` and `webftp_upload_file`, so an agent
following them will hit "tool not found" if you excluded `commands` or
`webftp`. Select the toolsets your workflows actually use. A few resources
also cross module boundaries: `alpacon://servers/.../overview` is backed by
`system_info_tools`, so `--toolsets servers` alone silently drops itโ€”add
`system-info` to keep it.

---

## ๐Ÿ”ง Advanced installation options

### Option A: install UV (if not already installed)
```bash
curl -LsSf https://astral.sh/uv/install.sh | sh
```

### Option B: manual configuration

If you prefer to manually configure tokens:

**Global Configuration** (recommended):
```bash
mkdir -p ~/.alpacon-mcp
echo '{
  "ap1": {
    "production": "alpat-ABC123xyz789...",
    "staging": "alpat-DEF456uvw012..."
  }
}' > ~/.alpacon-mcp/token.json
```

**Project-Local Configuration**:
```bash
mkdir -p config
echo '{
  "ap1": {
    "my-workspace": "alpat-ABC123xyz789..."
  }
}' > config/token.json
```

**Environment Variables**:
```bash
export ALPACON_MCP_AP1_PRODUCTION_TOKEN="alpat-ABC123xyz789..."
uvx alpacon-mcp
```

**Pinning a workspace API host** (optional):

By default the API host is derived from the workspace name as
`https://{workspace}.{region}.alpacon.io`. A workspace's URL slug is a mutable
label, and a freed slug can later be reused by a different workspace, so
re-deriving the host from a stale label could resolve to the wrong
workspace's host. Pin a fixed base URL with the object form of a token entry
insteadโ€”the old host stays alive as an alias, so a pinned URL keeps working
across a slug change:

```bash
echo '{
  "us1": {
    "production": {
      "token": "alpat-ABC123xyz789...",
      "url": "https://production.us1.alpacon.io"
    }
  }
}' > ~/.alpacon-mcp/token.json
```

Or via environment variable (wins over the config file):
```bash
export ALPACON_MCP_US1_PRODUCTION_URL="https://production.us1.alpacon.io"
```

### Option C: run from a checkout
```bash
git clone https://github.com/alpacax/alpacon-mcp.git
cd alpacon-mcp
uv venv && source .venv/bin/activate
uv sync
python main.py
```

---

## ๐Ÿ”Œ Connect to other AI tools

> Prefer not to install anything? Skip this section and use the [hosted remote MCP server](#-remote-mcp-server-hosted-no-install) insteadโ€”just point your client at `https://mcp.alpacon.io/mcp` and sign in via browser.

### Cursor IDE

Create `.cursor/mcp.json` in your project root:

```json
{
  "mcpServers": {
    "alpacon": {
      "command": "uvx",
      "args": ["alpacon-mcp"]
    }
  }
}
```

### VS Code with MCP extension

Install the MCP extension and add to settings:

```json
{
  "mcp.servers": {
    "alpacon": {
      "command": "uvx",
      "args": ["alpacon-mcp"]
    }
  }
}
```

**Note**: Token configuration is automatically discovered from:
1. `~/.alpacon-mcp/token.json` (global - recommended)
2. `./config/token.json` (project-local)
3. Environment variables

## ๐Ÿ’ฌ Usage examples

### Server health monitoring
> *"Give me a comprehensive health check for server web-01 including CPU, memory, and disk usage for the last 12 hours"*

### Performance analysis
> *"Show me the top 5 servers with highest CPU usage and analyze performance trends"*

### System administration
> *"List all users who can login on server web-01 and check for any users with sudo privileges"*

### Automated troubleshooting
> *"Server web-01 is responding slowly. Help me investigate CPU, memory, disk I/O, and network usage to find the bottleneck"*

### Command execution
> *"Execute 'systemctl status nginx' on server web-01 and check the service logs"*

### File management
> *"Upload my config.txt file to /home/user/ on server web-01 and then download the logs folder as a zip"*

### Audited work under approval
> *"Open a Work Session for restarting nginx on web-01, and once it's approved run the restart and close the session"*

## ๐Ÿ”ง Available tools

### ๐Ÿ–ฅ๏ธ Server management
- **list_servers**: List all servers in workspace
- **get_server**: Get detailed server information
- **get_server_overview**: Comprehensive server overview (hardware, OS, network, disks)
- **update_server**: Rename or relabel a server entry, or toggle its own offline-alert delivery
- **get_collection_profile**: What a server collects and at what cadence, and what it does not collect
- **unregister_server**: Unregister a host from the workspace
- **star_server**: Pin or unpin a server for yourself
- **list_server_notes** / **get_server_note** / **create_server_note** / **update_server_note** / **delete_server_note**: Server documentation notes
- **restart_agent** / **upgrade_agent** / **install_pam** / **update_information**: Alpacon agent
  lifecycle, the agent's companion `alpamon-pam` package included. This is the complete set of
  actions this endpoint accepts; a host-level power operation (OS package upgrade, reboot,
  shutdown) goes through a Work Session and `execute_command` instead
- **list_registration_tokens** / **create_registration_token** / **delete_registration_token** / **get_registration_guide**: Register new hosts with Alpamon

### ๐Ÿ“Š Monitoring & metrics
- **get_cpu_usage**: CPU utilization metrics
- **get_memory_usage**: Memory consumption data
- **get_disk_usage**: Disk space metrics
- **get_disk_io**: Disk I/O performance metrics
- **get_network_traffic**: Network bandwidth usage
- **get_top_servers**: Top servers by metric type(s)
- **list_latest_metrics**: Latest CPU, memory, disk usage, disk I/O and network reading for many servers at once (requires alpacon-server 2.37.0+)
- **get_alert_rules**: Alert rules configuration
- **get_server_metrics_summary**: Comprehensive health overview for one server

### ๐Ÿ’ป System information
- **get_system_info**: Hardware specifications and details
- **get_os_version**: Operating system information
- **list_system_users**: User account management
- **list_system_groups**: Group membership details
- **list_system_packages**: Installed software inventory
- **get_network_interfaces**: Network configuration
- **get_disk_info**: Storage device information
- **get_system_time**: System time and uptime

### ๐Ÿ”ง Remote operations

#### Command API (requires ACL permission)
- **execute_command**: Execute a command on a server and wait for the result, or with `wait=false` return its `command_id` at once
- **execute_file**: Run a script on a server as a verified file, optionally writing it there first or reading its bytes from there in the same call
- **list_commands**: List recent command history
- **check_command_status**: Read one command's state and result by `command_id` without waiting
- **execute_command_multi_server**: Execute on multiple servers simultaneously
- **state_command_purpose**: Answer the verification gate's purpose demand on a held command, then wait for the re-judgment

#### WebFTP (file management)
- **webftp_session_create**: Create file transfer session
- **webftp_upload_file**: Upload files using S3 presigned URLs
- **webftp_upload_content**: Upload base64-encoded content without a local file
- **webftp_download_file**: Download files/folders (folders as .zip)
- **webftp_bulk_upload** / **webftp_bulk_download**: Multi-file transfers in one operation
- **webftp_check_status**: Check the status of an in-flight transfer
- **webftp_uploads_list** / **webftp_downloads_list**: Transfer history
- **webftp_sessions_list**: Active FTP sessions

### ๐Ÿ—‚๏ธ Work sessions
- **work_session_create**: Open an auditable, approval-gated session for infrastructure work
- **work_session_get** / **work_session_list**: Inspect sessions and their status
- **work_session_update** / **work_session_extend**: Adjust scope, servers, or expiry
- **work_session_timeline**: Chronological record of commands, transfers, and sudo grants, read by cursor over up to 10 requests; check `pagination.complete` before treating it as the whole session
- **work_session_records**: One page of one websh terminal recording in the session, keyed by the `id` of a `websh_session` item on the timeline; follow `data.next` as `cursor`, since a short page is not the end
- **work_session_close** / **work_session_analyze**: Close a session and run AI security analysis

Personal API tokens and OAuth/browser callers use an active, approved Work Session for command execution and REST file-transfer creation. Service tokens retain their endpoint-specific authorization rules. Ordinary reads and Work Session requests keep their existing permissions; a Work Session does not grant interactive channel access to a token.

### ๐Ÿ”” Alert management
- **list_alerts**: List alerts with optional filtering
- **get_alert**: Get alert details
- **acknowledge_alert**: Record an acknowledgement against an alert
- **attach_alert_rule**: Attach an alert rule to a server
- **detach_alert_rule**: Detach an alert rule from a server
- **create_alert_rule**: Create monitoring thresholds, including who is notified (`notify_email`, `notify_slack_channel`)
- **update_alert_rule**: Update alert rule configuration, including notification destinations
- **delete_alert_rule**: Delete an alert rule
- **get_alert_rule_recipients**: Preview who a rule would notify, as counts onlyโ€”never names
- **preview_alert_rule**: Replay a rule, saved or not, over up to seven days of stored samples to see how many alerts it would have raised, how many would have interrupted someone, and who would receive them; stores nothing
- **list_rule_overrides** / **get_rule_override**: Per-server departures from a workspace alert rule
- **create_rule_override** / **update_rule_override** / **delete_rule_override**: Manage a per-server override

### ๐Ÿ›ก๏ธ Security ACLs
- **list_command_acls** / **create_command_acl** / **update_command_acl** / **delete_command_acl**: Which commands a token may run
- **list_server_acls** / **create_server_acl** / **update_server_acl** / **delete_server_acl** / **bulk_server_acl**: Which servers a token may reach
- **list_file_acls** / **create_file_acl** / **update_file_acl** / **delete_file_acl**: Which paths a token may transfer

### ๐Ÿ“œ Command pre-approval ledger
- **get_ledger_capability**: Whether the workspace uses the ledger, and whether you are a Command ACL admin of it
- **list_ledger_entries** / **issue_ledger_entries**: Pre-approved commands a token may run without a human approval
- **revoke_ledger_entry** / **revoke_ledger_entries** / **disable_ledger_entry** / **enable_ledger_entry**: Withdraw or pause an entry
- **list_ledger_admins** / **grant_ledger_admin** / **revoke_ledger_admin**: Who may change the ledger

These are served over stdio, and in remote mode once the operator enables them, and need a separate browser sign-in on first use; see `docs/api-reference.md`.

### ๐Ÿ”‘ MFA
- **show_mfa**: Show the user an Authenticate button for a fresh MFA check, in a client that renders MCP Apps
- **get_mfa_completion**: Whether that MFA check is complete; called by the panel, not the model

These are served in remote mode only; see `docs/api-reference.md`.

### โœ… Approvals & sudo
- **list_approval_requests** / **get_approval_request**: Pending and historical approval requests
- **explain_approval_decision**: Why an agent cannot approve, and who can
- **list_sudo_policies** / **request_sudo_policy**: Elevated-privilege policies; requesting one needs a human approval

Approving or rejecting a request is deliberately human-only and happens out of band (web console or Slack).

### ๐Ÿ“ฆ Package management
- **list_system_package_entries** / **install_system_package** / **remove_system_package**: OS packages
- **list_python_packages** / **install_python_package** / **remove_python_package**: Python packages

### ๐Ÿ“œ Certificates
- **list_certificate_authorities** / **create_certificate_authority** / **get_certificate_authority** / **update_certificate_authority** / **delete_certificate_authority**: CAs
- **list_sign_requests** / **create_sign_request** / **get_sign_request** / **approve_sign_request** / **deny_sign_request** / **retry_sign_request** / **delete_sign_request**: Signing requests
- **list_certificates** / **get_certificate** / **revoke_certificate**: Issued certificates
- **list_revoke_requests** / **get_revoke_request** / **approve_revoke_request** / **deny_revoke_request** / **retry_revoke_request** / **cancel_revoke_request**: Revocation requests

### ๐Ÿ”— Webhooks & subscriptions
- **list_webhooks** / **get_webhook** / **create_webhook** / **update_webhook** / **delete_webhook**: Webhook endpoints
- **list_event_subscriptions** / **create_event_subscription** / **delete_event_subscription**: Which events get delivered

### ๐ŸŽซ API tokens
- **list_api_tokens** / **get_api_token** / **create_api_token** / **update_api_token** / **delete_api_token** / **duplicate_api_token**: Token lifecycle
- **list_api_token_scopes** / **list_api_token_presets**: Available scopes and presets

These tools need a JWT/OAuth session (hosted server), a browser session, or a login-source tokenโ€”an API token from `token.json` gets a 403 from the server. Scopes and presets are readable either way.

### ๐Ÿ“‹ Events & logging
- **list_events**: Browse server events and logs
- **get_event**: Get event details by ID
- **search_events**: Search and filter events

### ๐Ÿ“ Audit logs
- **list_activity_logs**: Audit user and system actions
- **get_activity_log**: Get activity log details
- **list_server_logs**: Server command execution logs
- **list_webftp_logs**: WebFTP file transfer logs
- **list_session_analyses** / **get_session_analysis_detail**: AI security analysis with MITRE ATT&CK mapping

### ๐Ÿ” Identity and access management (IAM)

**User management**:
- **list_iam_users**: List workspace IAM users with pagination
- **get_iam_user**: Get detailed user information
- **create_iam_user**: Create a new IAM user
- **update_iam_user**: Update a user's email, name, or active status
- **delete_iam_user**: Remove users from workspace
- **invite_workspace_user**: Send an email invitation to join the workspace

**Group and membership management**:
- **list_iam_groups** / **get_iam_group** / **create_iam_group** / **update_iam_group** / **delete_iam_group**: Groups
- **list_iam_memberships** / **add_iam_member** / **remove_iam_member**: Who belongs to which group, and in what role

**Applications** (machine service accounts):
- **list_iam_applications** / **get_iam_application** / **create_iam_application** / **update_iam_application** / **delete_iam_application**: Application lifecycle
- **assign_application_system_users** / **unassign_application_system_users**: Bind OS-level accounts to an application

### โš™๏ธ Workspace
- **list_workspaces**: List available workspaces
- **get_current_user**: Get the currently authenticated user
- **get_workspace_access_control**: Get access control settings (read-only)
- **get_workspace_security**: Get authentication/security settings (JWT/SSO auth only, SaaS only)
- **list_workspace_mfa_methods**: List allowed MFA methods (JWT/SSO auth only, SaaS only)
- **get_workspace_preferences**: Get workspace-wide preferences, including the `agent_rollout_policy` (mode + upgrade window)
- **update_workspace_preferences**: Update workspace-wide preferences (partial), including `agent_rollout_policy`
- **health_check**: MCP server health, version, and authentication mode

### ๐Ÿงฉ Resources and prompts

Most read tools are also exposed as read-only `alpacon://` resourcesโ€”for example `alpacon://servers/{region}/{workspace}`, `alpacon://metrics/{region}/{workspace}/{server_id}/cpu`, or `alpacon://audit/activity/{region}/{workspace}`โ€”so a client can pull data without a tool call.

Four MCP prompts teach the operating discipline: `work_session_workflow` (open a scoped session), `guarded_execution` (act inside it), `incident_response` (triage first, then remediate), and `security_audit` (pick the right audit lens).

## ๐ŸŒ Supported platforms

| Platform | Status | Notes |
|----------|--------|-------|
| **Claude Desktop** | โœ… Full Support | Recommended client |
| **Cursor IDE** | โœ… Full Support | Native MCP integration |
| **VS Code** | โœ… Full Support | Requires MCP extension |
| **Continue** | โœ… Full Support | Via MCP protocol |
| **Other MCP Clients** | โœ… Compatible | Standard protocol support |

## ๐Ÿ“– Documentation

- ๐Ÿ“š **[Complete Documentation](docs/README.md)** - Full documentation index
- ๐Ÿš€ **[Getting Started Guide](docs/getting-started.md)** - Step-by-step setup
- โš™๏ธ **[Configuration Guide](docs/configuration.md)** - Advanced configuration
- ๐Ÿ”ง **[API Reference](docs/api-reference.md)** - Complete tool documentation
- ๐Ÿ’ก **[Usage Examples](docs/examples.md)** - Real-world scenarios
- ๐Ÿ› ๏ธ **[Installation Guide](docs/installation.md)** - Platform-specific setup
- ๐Ÿ” **[Troubleshooting](docs/troubleshooting.md)** - Common issues and solutions
- ๐Ÿ” **[MFA Re-authentication Flow](docs/mfa-reauth-flow.md)** - How the hosted server re-verifies MFA

## ๐Ÿš€ Advanced usage

### Multi-workspace management
```bash
# Configure tokens for multiple workspaces (ap1 region)
python -c "
from utils.token_manager import TokenManager
tm = TokenManager()
tm.set_token('ap1', 'company-prod', 'ap1-company-prod-token')
tm.set_token('ap1', 'company-staging', 'ap1-company-staging-token')
tm.set_token('ap1', 'company-dev', 'ap1-company-dev-token')
"
```

### Custom config file
```bash
# Use custom config file location
export ALPACON_MCP_CONFIG_FILE="/path/to/custom-tokens.json"
uvx alpacon-mcp
```

### Docker deployment
```bash
# Build and run with Docker
docker build -t alpacon-mcp .
# The default command is main_http.py (needs AUTH0_*); this runs the stdio server
# from the mounted token instead, which the container's uid 200 must be able to read
docker run -i -v $(pwd)/config:/app/config:ro \
  -e ALPACON_MCP_CONFIG_FILE=/app/config/token.json alpacon-mcp python main.py
```

## ๐Ÿ”’ Security & best practices

- **Zero-trust architecture**: Every request authenticated and authorized through Alpacon's identity layer
- **Session recording**: Command execution and WebFTP transfers are recorded for audit
- **Workspace-based access control**: Separate tokens per workspace with RBAC
- **ACL configuration required**: Configure token permissions in Alpacon web interface for command execution
- **Audit logging**: All operations logged with full traceability

### โš ๏ธ Command execution limitations

**Important**: command execution tools can only run **pre-approved commands** configured in your token's ACL settings:

1. **Visit token details** in Alpacon web interface (click on your token)
2. **Configure ACL permissions** for allowed commands, servers, and operations
3. **Commands not in ACL** will be rejected with 403/404 errors
4. **Contact your administrator** if you need additional command permissions

## ๐Ÿค Contributing

We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.

- ๐Ÿ› **Bug reports**: Use GitHub issues
- ๐Ÿ’ก **Feature requests**: Open discussions
- ๐Ÿ“ **Documentation**: Help improve guides
- ๐Ÿ”ง **Code contributions**: Submit pull requests

## ๐Ÿ“„ License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

The Alpacon name and logo, including `plugins/alpacon/assets/icon.svg`, are trademarks of AlpacaX and are not covered by the MIT License.

---

**Ready to give your AI agents secure infrastructure access?**
- ๐Ÿ“– Start with our [Getting Started Guide](docs/getting-started.md)
- ๐Ÿ”ง Explore the [API Reference](docs/api-reference.md)
- ๐Ÿ’ฌ Join our community discussions

*Built with โค๏ธ by [AlpacaX](https://www.alpacax.com/) for the Alpacon ecosystem*