faved-mcp
# 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.
The package is also attached to the [v0.1.0 release](https://github.com/bc1pzzfnxl/faved-mcp/releases/tag/v0.1.0) if you prefer a pinned wheel:
```bash
pip install https://github.com/bc1pzzfnxl/faved-mcp/releases/download/v0.1.0/faved_mcp-0.1.0-py3-none-any.whl
faved-mcp setup
```
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_CONFIG` | `~/.config/faved-mcp/config.json` | Setup file written by `faved-mcp setup` |
`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.
TDQS
Scored across 18 tools
Most tools target a distinct resource+action pair (bookmarks vs tags vs import/export vs diagnostics), and descriptions clarify the boundaries well. Minor overlap remains between list_bookmarks and search_bookmarks (filters vs text ranking), and between update_bookmark and tag_bookmarks (both can replace tag sets), plus collection_stats vs find_duplicates/list_tags counts.
The dominant convention is snake_case verb_noun (list_bookmarks, get_tag, create_tag, delete_tag, import_bookmarks), applied consistently across the set. Deviations are minor: faved_status and collection_stats are noun phrases rather than verb-led, but still readable and unambiguous.
18 tools is slightly above the comfortable range but each maps to a real operation (bookmark CRUD, tag CRUD, bulk tagging, import/export, stats, duplicate detection, status). Nothing feels redundant enough to cut, though a couple of diagnostic tools could be consolidated.
Full lifecycle coverage: bookmarks can be listed, searched, read, added, updated, deleted (with dry run), bulk-tagged, exported, and imported, and tags have complete CRUD including subtree moves and detach/delete semantics. Auxiliary needs like duplicate cleanup, collection statistics, and URL metadata preview are also present, leaving no obvious dead ends.