Metadata-Version: 2.5
Name: deploykar-mcp
Version: 0.1.0
Summary: MCP server for DeployKar: deploy, monitor and debug your apps from your IDE.
Project-URL: Homepage, https://deploykar.com
Author: DeployKar
License-Expression: MIT
License-File: LICENSE
Keywords: deploy,deploykar,ide,mcp,model-context-protocol
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Build Tools
Requires-Python: >=3.10
Requires-Dist: httpx>=0.27
Requires-Dist: mcp<3,>=2.3
Description-Content-Type: text/markdown

# DeployKar MCP server

Deploy, monitor and debug your [DeployKar](https://deploykar.com) apps from your IDE's AI chat:
Kiro, Cursor, VS Code (Copilot), Claude Code, Windsurf, or any other MCP client.

> "Deploy my app" · "Why did my build fail?" · "Set DATABASE_URL to postgres://…" · "Scale the API to 3 instances"

Your IDE's assistant does the thinking. This server only translates its tool calls into DeployKar API
requests, using a personal API token.

## Setup (2 minutes)

You need:
- [uv](https://docs.astral.sh/uv/getting-started/installation/) installed (it provides the `uvx` command)
- a DeployKar account. Sign in at **http://187.127.179.204:7100**
- your app's code in a GitHub repository that DeployKar can access (connect GitHub once in the dashboard)

**1. Sign in**

First sign in to the DeployKar dashboard in your browser, then run:

```bash
uvx deploykar-mcp login
```

Your browser opens DeployKar's approval page. Choose **Deploy** (recommended) or **Read-only** access
and click **Approve**. The token is saved on your computer, readable only by you:
`~/.config/deploykar/credentials.json` (Windows: `%APPDATA%\deploykar\credentials.json`).

**2. Add DeployKar to your IDE**

For Claude Code, create a file named `.mcp.json` in your project folder (or run
`claude mcp add --scope user deploykar -- uvx deploykar-mcp@latest` to add it for all projects):

```json
{
  "mcpServers": {
    "deploykar": {
      "command": "uvx",
      "args": ["deploykar-mcp@latest"]
    }
  }
}
```

The same JSON works in other IDEs:

| IDE | Where |
|---|---|
| Cursor | `~/.cursor/mcp.json` |
| Kiro | `~/.kiro/settings/mcp.json` (or `.kiro/settings/mcp.json` in a workspace) |
| Windsurf | `~/.codeium/windsurf/mcp_config.json` |

VS Code (Copilot agent mode) uses `.vscode/mcp.json` with a slightly different shape:

```json
{
  "servers": {
    "deploykar": {
      "type": "stdio",
      "command": "uvx",
      "args": ["deploykar-mcp@latest"]
    }
  }
}
```

Open the folder in your IDE, approve the `deploykar` server when asked, and start chatting.
`@latest` means you get new versions automatically when your IDE restarts the server.

**Without the login command** (CI, remote machines, or if you prefer to paste a token): create a token
on DeployKar's API tokens page (`https://dev-32786578325.deploykar.com/auth/api/v1/api-tokens/authorize`)
and add it to the config. Don't commit a file that contains a token.

```json
{
  "mcpServers": {
    "deploykar": {
      "command": "uvx",
      "args": ["deploykar-mcp@latest"],
      "env": { "DEPLOYKAR_API_TOKEN": "dk_live_..." }
    }
  }
}
```

## What you can ask

- "Deploy this repo to DeployKar as a frontend"
- "Deploy my latest changes" (the assistant pushes first, then deploys and waits for the live URL)
- "Turn on auto-deploy for main"
- "Why did my last deploy fail? Fix it."
- "Show me the API's logs from the last few minutes"
- "Set DATABASE_URL to … and restart"
- "Scale the API to 3 instances"

## Tools

| Tool | What it does |
|---|---|
| `check_setup` | Signed-in account, token access level, GitHub connection (with an install link if missing) |
| `list_projects` | Your projects with status and live URL. Pass `repo_url` to find the project for the current repo |
| `deploy` | Deploy an existing project, or create one from a GitHub repo URL (frontend or backend) |
| `get_status` | Deployment status and live URL. `wait=true` follows the build; failures include the error lines |
| `get_logs` | Build logs (`source="build"`) or live backend logs (`source="runtime"`), with `errors_only` |
| `list_env_vars` | Environment variable names (never values) |
| `set_env_var` | Create or update environment variables; `apply_now=true` restarts/redeploys |
| `scale` | Set the number of instances (1-10) of a backend service |

## How deployments work

DeployKar builds from GitHub, not from your local files, exactly like deploying from the dashboard.
Whatever is pushed to the project's branch is what gets deployed, so the assistant commits and pushes
your changes (after asking you) before deploying. With auto-deploy enabled, every push to the branch
deploys automatically and the assistant just follows the deployment for the commit it pushed.

## Security

- API tokens are stored hashed by DeployKar, shown once, expire after 30, 90 or 365 days, and can be
  revoked at any time: `uvx deploykar-mcp logout`, or the API tokens page
  (`https://dev-32786578325.deploykar.com/auth/api/v1/api-tokens/manage`).
- Tokens can only reach a fixed set of endpoints. They can **never** delete projects or deployments,
  remove backends, or manage databases, domains, secret groups or other tokens.
- Read-only tokens can view projects, statuses and logs, but cannot deploy or read environment variables.
- Environment variable values are never returned to the assistant.
- Per-token rate limits apply (120 requests/minute, 30 deploy or scale actions/hour).

## Commands

```text
uvx deploykar-mcp            run the MCP server (your IDE does this)
uvx deploykar-mcp login      sign in via the browser (--no-browser to paste a token instead)
uvx deploykar-mcp whoami     show the current account and token
uvx deploykar-mcp logout     revoke and delete the saved token
```

Environment variables (all optional):

| Variable | Default |
|---|---|
| `DEPLOYKAR_API_TOKEN` | the token saved by `login` |
| `DEPLOYKAR_API_URL` | `https://dev-32786578325.deploykar.com/api/v1` |
| `DEPLOYKAR_AUTH_URL` | `https://dev-32786578325.deploykar.com/auth/api/v1` |
| `DEPLOYKAR_DASHBOARD_URL` | `http://187.127.179.204:7100` |

## Troubleshooting

- **"Not signed in" / "rejected the API token"**: run `uvx deploykar-mcp login` again, then restart
  the MCP server in your IDE.
- **The approval page asks you to sign in**: sign in at http://187.127.179.204:7100 in the same
  browser, then reload the approval page.
- **The server shows "Failed" or "Connection closed", or the IDE says `uvx` was not found**: your
  IDE can't find `uvx`. Restart the IDE completely after installing uv. If that doesn't help, put the
  full path to `uvx` in `"command"`:
  - macOS/Linux: run `which uvx` and use what it prints, e.g. `/Users/you/.local/bin/uvx`
  - Windows: run `where uvx` in PowerShell and use it with forward slashes, e.g.
    `C:/Users/you/.local/bin/uvx.exe`. (Git Bash's `which uvx` prints `/c/Users/...`, which
    Windows doesn't understand: write it as `C:/Users/...`.)
- **"This API token is read-only"**: sign in again and choose Deploy access.
- **Deployment built old code**: push your commits; DeployKar builds the latest commit on GitHub.
- **No build logs**: DeployKar keeps build logs for about an hour after a build.

## Development

```bash
uv run --group dev pytest
```

Releases are published to PyPI from GitHub (see `RELEASING.md` in the repository).

## License

MIT
