Metadata-Version: 2.5
Name: qeda-mcp
Version: 0.1.0
Summary: Official MCP server for Qeda Cloud: let AI agents deploy, run and manage apps on Qeda.
Project-URL: Homepage, https://qeda.io
Project-URL: Repository, https://github.com/Qeda-io/qeda-mcp
Project-URL: Issues, https://github.com/Qeda-io/qeda-mcp/issues
Author: Qeda
License-Expression: Apache-2.0
License-File: LICENSE
License-File: NOTICE
Keywords: ai-agents,claude,cursor,deployment,mcp,model-context-protocol,paas,qeda
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Build Tools
Classifier: Topic :: System :: Systems Administration
Requires-Python: >=3.10
Requires-Dist: httpx<1,>=0.27
Requires-Dist: mcp<2,>=1.30
Description-Content-Type: text/markdown

# Qeda MCP

<!-- mcp-name: io.github.Qeda-io/qeda-mcp -->

Official MCP server for Qeda Cloud. Let AI agents like Claude Code and Cursor deploy apps from GitHub, read build logs and manage databases on Qeda.

> **Status: beta.** Read, deploy, run, domain and template tools. The hosted server with OAuth is built and being rolled out; Mobile Money top-ups come next.

## What an agent can do today

| Tool | What it does |
| --- | --- |
| `list_projects` | Lists your Qeda projects: id, your role, running and stopped services. |
| `get_deployment` | Status, URL, commit, build time and cluster health of a deployment (latest one by default), plus recent deployments. |
| `get_build_logs` | Status, error message and the last build log lines of a deployment. Pass the returned cursor as `after_id` to follow a build in progress. |
| `list_github_accounts` | GitHub accounts (personal and organizations) this connection may use, as chosen in Settings → MCP Server. |
| `list_repos` | Repositories of one account (`account="Qeda-io"`) that Qeda can deploy; `search` looks across up to 150 of them. |
| `detect_stack` | How Qeda will build a repository: runtime, commands, port, databases and variables it needs, version alerts. Deploys nothing. |
| `get_wallet` | Balance, daily spending, days left, whether new deploys are blocked, cost of each running project. |
| `create_project` | Creates an empty project. |
| `deploy_from_git` | Deploys a GitHub repository into a project (stack detected; build/start/port overridable). Follow it with `get_build_logs`. |
| `redeploy` | Rebuilds from the latest commit, or rolls back to a given deployment. **Preview first**, acts only with `confirm=true`. |
| `cancel_deployment` | Cancels a build in progress. **Preview first**, acts only with `confirm=true`. |
| `get_runtime_logs` | Output of the running app (build left out); `search`, `errors_only`, cursor to follow. |
| `get_runtime_errors` | The app's errors grouped: each distinct error once, with its count and an example. |
| `list_env` | Environment variables. Secret values are never shown. |
| `set_env` | Adds or changes variables, keeps the others. `secret=true` makes them write-only. |
| `unset_env` | Removes variables. **Preview first**, acts only with `confirm=true`. |
| `apply_env_changes` | Restarts the service with its variables (or rebuilds). **Preview first**, acts only with `confirm=true`. |
| `add_database` | Attaches PostgreSQL, MySQL, MongoDB, Redis, RabbitMQ or S3 storage; created on the next redeploy. |
| `list_deployments` | Deployment history, newest first, with the ids to roll back to. |
| `get_domains` | The generated address and custom domains, with DNS status and the records still to create. |
| `add_domain` | Attaches a custom domain and returns the DNS records to create. HTTPS is automatic once verified. |
| `verify_domain` | Checks a custom domain's DNS again. |
| `remove_domain` | Detaches a custom domain. **Preview first**, acts only with `confirm=true`. |
| `set_subdomain` | Renames the generated address; the old one stops working. **Preview first**, acts only with `confirm=true`. |
| `get_usage` | CPU and memory actually used: live, hourly average and peak (up to 14 days). Not a bill. |
| `list_templates` | Ready-made apps that deploy without a build. |
| `deploy_template` | Deploys a template into an empty project, with its databases. |
| `delete_project` | Deletes a project and its data for good. **Preview first**, acts only with `confirm_name` set to the project's exact name. |

Every tool carries MCP annotations (read-only, write, destructive), so clients can ask the user before acting. Deploy tools need a token with write access.

Ask your agent: *"Why did my last deploy of qeda-pay fail?"* It finds the project, reads the logs and points to the failing line.

## Use it with Claude Code

1. In the Qeda dashboard, open **Settings → MCP Server**, create a connection and choose its rights and GitHub repositories. Copy the token: it is shown once.
2. Install [uv](https://docs.astral.sh/uv/).
3. Add the server:

```sh
claude mcp add qeda -e QEDA_API_TOKEN=qeda_... -- uvx qeda-mcp
```

Other MCP clients (Cursor, Claude Desktop, VS Code…) take the same command in their JSON config:

```json
{
  "mcpServers": {
    "qeda": {
      "command": "uvx",
      "args": ["qeda-mcp"],
      "env": { "QEDA_API_TOKEN": "qeda_..." }
    }
  }
}
```

`uvx` downloads the latest release from PyPI the first time. From a clone, use `uv run --directory /path/to/qeda-mcp qeda-mcp` instead.

Never commit a file that contains your token.

| Variable | Default | Purpose |
| --- | --- | --- |
| `QEDA_API_TOKEN` | required | Your `qeda_` API token. |
| `QEDA_API_URL` | `https://api.qeda.io` | Point to another Qeda environment. |

## How it works

The server is only a client of the public Qeda API. It calls the same routes as the dashboard, with your own token, and has no access to the database or the cluster. What a token may call is decided by the API, not by this server.

## Hosted server

`qeda-mcp --transport streamable-http` runs the remote server that MCP clients reach at `https://mcp.qeda.io/mcp`. It holds no credential of its own: every request brings its own token, and each tool call uses that token against the Qeda API.

- **OAuth.** Clients that support it (Claude, Cursor, ChatGPT…) find Qeda's authorization server through `/.well-known/oauth-protected-resource/mcp`. The person approves the agent in the dashboard, and the client receives a short-lived access token. A request without a valid token gets `401` with a `WWW-Authenticate` header that points to that metadata, as the MCP authorization spec requires.
- **API tokens.** A client that can only send a fixed header may send `Authorization: Bearer qeda_...`.
- **Verification.** A token is checked against the Qeda API (`GET /users/me`), and a success is cached for 60 seconds. The API enforces expiry, revocation, scopes, GitHub access and the token's resource on every call.
- **Scaling.** The server is stateless (no MCP session kept between requests), so any replica can serve any request. `GET /healthz` answers `ok`.

| Variable | Default | Purpose |
| --- | --- | --- |
| `QEDA_PUBLIC_URL` | required | The endpoint as clients reach it, e.g. `https://mcp.qeda.io/mcp`. It is the OAuth resource identifier and must appear in the backend's `OAUTH_RESOURCES`. |
| `QEDA_API_URL` | `https://api.qeda.io` | The Qeda API the tools call. |
| `QEDA_AUTH_ISSUER` | `QEDA_API_URL` | Qeda's OAuth authorization server. |
| `HOST` / `PORT` | `0.0.0.0` / `8000` | Where to listen. |

A `Dockerfile` builds the image (`docker build -t qeda-mcp .`).

## Development

```sh
uv sync
uv run pytest
```

Tests mock the Qeda API: no network, no real token.

Releases: bump `version` in `pyproject.toml` and in `server.json` (twice), merge, then publish a GitHub release tagged `vX.Y.Z`. The `Publish to PyPI` workflow tests, builds and publishes it through PyPI Trusted Publishing: no PyPI token is stored anywhere. It then lists the new version in the [official MCP Registry](https://github.com/modelcontextprotocol/registry) as `io.github.Qeda-io/qeda-mcp` (GitHub OIDC, no secret either).

## License and trademarks

The code is licensed under the [Apache License 2.0](LICENSE). "Qeda", "Qeda Cloud" and the Qeda logo are trademarks of Qeda: the license does not grant the right to use them (see [NOTICE](NOTICE)). You may say that a fork works with Qeda Cloud, not name it or present it as Qeda's.

---

Built by [Qeda](https://qeda.io), the deployment platform you pay for with Mobile Money.
