Metadata-Version: 2.4
Name: faved-mcp
Version: 0.1.0
Summary: MCP server for Faved, the open-source bookmark manager
Author: bc1pzzfnxl
License: MIT
Project-URL: Homepage, https://github.com/bc1pzzfnxl/faved-mcp
Project-URL: Repository, https://github.com/bc1pzzfnxl/faved-mcp
Project-URL: Issues, https://github.com/bc1pzzfnxl/faved-mcp/issues
Keywords: mcp,faved,bookmarks,tags,agents
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Topic :: Internet :: WWW/HTTP
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: mcp>=2.0
Requires-Dist: httpx>=0.27
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == "dev"
Requires-Dist: respx>=0.21; extra == "dev"
Dynamic: license-file

# faved-mcp

An MCP server for [Faved](https://github.com/denho/faved), the open-source bookmark manager.

It exposes Faved's bookmarks, hierarchical tags (folders), metadata, imports and exports as MCP tools, so any MCP client (Claude Desktop, Cursor, Hermes, custom agents) can read and organize a collection without screen-scraping or direct SQLite access.

- Works against any Faved instance: self-hosted or cloud.
- API-only: no database coupling, no Faved core changes.
- Read-only by default; write tools are opt-in.
- Ships both as a Python package and as a Docker layer on top of the official Faved image.

## Status

v0.1.0: 18 tools, API-only, read-only by default. Tests cover the client and every tool group; the stdio and HTTP transports are verified end to end.

## Install

```bash
pip install faved-mcp
faved-mcp setup
```

`setup` asks for your Faved URL, the username and password you already use, checks the
login, and writes `~/.config/faved-mcp/config.json` (mode 600). Then point your MCP
client at `faved-mcp`; no other configuration is needed.

Environment variables override the file, for Docker and CI:

```bash
export FAVED_URL=https://faved.example.com
export FAVED_USERNAME=alice
export FAVED_PASSWORD=...
faved-mcp
```

HTTP mode, for containers and remote clients:

```bash
export FAVED_MCP_TOKEN=$(openssl rand -hex 32)
faved-mcp --transport http --host 0.0.0.0 --port 8090
# MCP endpoint: http://host:8090/mcp  (Authorization: Bearer $FAVED_MCP_TOKEN)
```

## Configuration

| Variable | Default | Meaning |
|---|---|---|
| `FAVED_URL` | `http://localhost` | Base URL of the Faved instance |
| `FAVED_USERNAME` | — | Faved account used by the server |
| `FAVED_PASSWORD` | — | Its password |
| `FAVED_MCP_TRANSPORT` | `stdio` | `stdio` or `http` |
| `FAVED_MCP_HOST` | `127.0.0.1` | HTTP bind address |
| `FAVED_MCP_PORT` | `8090` | HTTP port |
| `FAVED_MCP_TOKEN` | — | Bearer token required in HTTP mode |
| `FAVED_MCP_ENABLE_WRITE` | `false` | Enable mutating tools |
| `FAVED_MCP_ALLOW_LOCAL_PATHS` | `false` | Allow `import_bookmarks` to read a server-side file path |
| `FAVED_MCP_TIMEOUT` | `15` | Upstream timeout, seconds |

`faved-mcp setup` stores your existing Faved login in the config file; environment variables take precedence. A `reader` account gives read-only access at the API level; an `owner` account is required for write tools. A separate service account is optional, not mandatory. Never expose the HTTP transport publicly without `FAVED_MCP_TOKEN`.

## Docker

Build the layer that adds the MCP server beside Apache in the official Faved image:

```bash
docker build --load -t faved-mcp:0.1.0 .
# or keep your pinned/patched base:
docker build --load --build-arg BASE_IMAGE=faved-app:2.10.1-ro1 -t faved-mcp:0.1.0 .
```

On a BuildKit docker-container builder, `--load` is required or the image stays in the build cache.

```bash
docker run --rm -p 8080:80 -p 8090:8090 \
  -e FAVED_USERNAME=mcp -e FAVED_PASSWORD=... \
  -e FAVED_MCP_TOKEN=$(openssl rand -hex 32) \
  -e FAVED_MCP_ENABLE_WRITE=false \
  -v faved-data:/var/www/html/storage \
  faved-mcp:0.1.0
```

A compose example is in [docker-compose.example.yml](docker-compose.example.yml).

The container runs `supervisord` with Apache and `faved-mcp` (HTTP, port 8090, `/mcp`). `FAVED_URL` defaults to `http://127.0.0.1`, so the MCP server talks to the Faved instance in the same container. Publish 8090 only on an internal network; exposing it is the operator's decision.

## Development

```bash
python3 -m venv .venv
.venv/bin/pip install -e '.[dev]'
PYTHONPATH=src .venv/bin/pytest -q
.venv/bin/python scripts/smoke_stdio.py   # stub Faved + MCP stdio handshake
```

## Client configuration

```json
{
  "mcpServers": {
    "faved": {
      "type": "http",
      "url": "https://faved-mcp.example.com/mcp",
      "headers": { "Authorization": "Bearer <FAVED_MCP_TOKEN>" }
    }
  }
}
```

Authentication, the dedicated Faved account and WAN exposure are explained in [docs/DEPLOY.md](docs/DEPLOY.md).

## Tools

See [docs/TOOLS.md](docs/TOOLS.md) for the full contract. Summary:

Read: `faved_status`, `list_bookmarks`, `get_bookmark`, `search_bookmarks`, `list_tags`, `get_tag`, `collection_stats`, `find_duplicates`, `fetch_url_metadata`.

Write (opt-in): `add_bookmark`, `update_bookmark`, `delete_bookmarks`, `tag_bookmarks`, `create_tag`, `update_tag`, `delete_tag`.

Import/export: `import_bookmarks`, `export_bookmarks`.

## License

MIT, same as Faved.
