Metadata-Version: 2.5
Name: bluesurf-mcp
Version: 0.1.0
Summary: Servidor MCP local de solo lectura para leer tickets de BlueSurf
Author: BluePeople
License: MIT License
        
        Copyright (c) 2026 BluePeople
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: bluesurf,mcp,tickets
Requires-Python: >=3.10
Requires-Dist: httpx>=0.27
Requires-Dist: keyring>=25
Requires-Dist: mcp>=2.0
Provides-Extra: dev
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: python-dotenv>=1.0; extra == 'dev'
Description-Content-Type: text/markdown

# bluesurf-mcp

Servidor MCP local de **solo lectura** para que Claude u otros agentes IA lean
tickets de **BlueSurf**. Un solo paquete PyPI incluye el núcleo
(`bluesurf_client`) y el adaptador MCP (`bluesurf_mcp`).

**Solo lectura por diseño:** no hay operaciones de escritura.

## Instalación

```bash
pip install bluesurf-mcp
```

En este monorepo, modo editable:

```bash
pip install -e ./bluesurf-mcp
```

## Guardar credenciales (`login` / `logout`)

La contraseña no tiene que ir en `mcp.json`. Una vez, en una terminal:

```bash
bluesurf-mcp login
```

Pide usuario y contraseña, valida contra BlueSurf y guarda la contraseña en el
almacén del sistema (Credential Manager en Windows, Keychain en macOS, Secret
Service en Linux). El username queda en un JSON local, sin la contraseña.

```bash
bluesurf-mcp logout
```

borra lo guardado.

## Configuración (variables de entorno)

El entorno **gana** sobre lo guardado con `login`. Útil para CI o para
sobrescribir sin tocar el almacén.

Claves canónicas `BLUESURF_*`; se aceptan `SURF_*` como fallback.

- `BLUESURF_BASE_URL` — URL base (opcional; default `https://surf.bluepeople.com`).
- `BLUESURF_COOKIE` — cookie de sesión ya válida → usa `CookieAuth`.
- `BLUESURF_USERNAME` + `BLUESURF_PASSWORD` — credenciales → usa `CredentialsAuth`.

Precedencia: cookie en env → usuario/contraseña en env → `bluesurf-mcp login`.

El núcleo (`bluesurf_client`) no persiste secretos.

## Correr el servidor

```bash
bluesurf-mcp
```

Se comunica por **stdio** (el transporte estándar para MCP local). Sin
argumentos no pide contraseña: usa env o las credenciales de `login`.

## Registrar el MCP en un cliente

### Claude Code / Cursor (`.mcp.json` o config de usuario)

Tras `bluesurf-mcp login`:

```json
{
  "mcpServers": {
    "bluesurf": {
      "command": "bluesurf-mcp"
    }
  }
}
```

Si `bluesurf-mcp` no está en el `PATH`, usa la ruta absoluta al ejecutable del
venv o `python -m bluesurf_mcp`.

Las variables `BLUESURF_*` en `env` siguen siendo válidas como override; no hace
falta poner la contraseña ahí.

## Tools expuestas (solo lectura)

- `mis_proyectos` — proyectos del usuario (id, smallCode, code, name).
- `buscar_mis_tickets(project, include_closed=False)` — tickets asignados al usuario.
- `obtener_ticket(code)` — detalle de un ticket por su código (p. ej. `PROJ-123`).

## Usar el cliente desde Python

El paquete de import del núcleo es `bluesurf_client`:

```python
from bluesurf_client import BlueSurfClient, CredentialsAuth  # o CookieAuth
```
