@sfwapi/mcp
by sfwbot
README.md
# @sfwapi/mcp
MCP server for the [SFW API](https://sfwapi.dev): NSFW and nudity detection for images, GIFs and videos as tools for Claude Code, Claude Desktop, Cursor, VS Code, Codex and any other MCP client.
## Tools
| Tool | What it does |
|---|---|
| `analyze_url` | Analyse an image, GIF or video at a public URL |
| `analyze_file` | Analyse a local file on your machine (uploaded to the API) |
| `get_account` | Credit balance, plan limits and this month's usage (free) |
Every analysis result carries the content level (`0` Everyday, `1` Revealing, `2` Implied nudity, `3` Explicit), a `0-100` score per level, and flags for drawn content (`art`) and adult objects (`sex_object`). Pass `block_level` to get a blocked/allowed decision directly.
One credit per image or analysed GIF/video frame; failed calls are free; 500 free credits a month. Media is processed in memory and never stored.
### Example output
```text
Level 0 (Everyday). Scores 0-100: revealing 2, implied nudity 0, explicit 0. Allowed by the policy. 1 credit used, 499 left.
```
Structured JSON matching the HTTP API response is returned alongside the text summary.
## Install
Get a free key at [sfwapi.dev/console](https://sfwapi.dev/console) and put it in `SFWAPI_API_KEY`.
**Claude Code**
```bash
claude mcp add sfwapi -e SFWAPI_API_KEY=sk_live_... -- npx -y @sfwapi/mcp
```
**Cursor** (`.cursor/mcp.json`) and **Claude Desktop** (`claude_desktop_config.json`)
```json
{
"mcpServers": {
"sfwapi": {
"command": "npx",
"args": ["-y", "@sfwapi/mcp"],
"env": { "SFWAPI_API_KEY": "sk_live_..." }
}
}
}
```
**VS Code** (`.vscode/mcp.json`)
```json
{
"inputs": [
{ "type": "promptString", "id": "sfwapi-key", "description": "SFW API key", "password": true }
],
"servers": {
"sfwapi": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@sfwapi/mcp"],
"env": { "SFWAPI_API_KEY": "${input:sfwapi-key}" }
}
}
}
```
**Codex** (`~/.codex/config.toml`)
```toml
[mcp_servers.sfwapi]
command = "npx"
args = ["-y", "@sfwapi/mcp"]
env = { SFWAPI_API_KEY = "sk_live_..." }
```
## Hosted endpoint (no install)
`https://api.sfwapi.dev/mcp` serves the same tools over Streamable HTTP, without `analyze_file` (a hosted server cannot read your disk). Send the key as `Authorization: Bearer sk_live_...`:
```bash
claude mcp add --transport http sfwapi https://api.sfwapi.dev/mcp --header "Authorization: Bearer sk_live_..."
```
## Environment
| Variable | Description |
|---|---|
| `SFWAPI_API_KEY` | Required. Your SFW API key. |
| `SFWAPI_BASE_URL` | Optional. Defaults to `https://api.sfwapi.dev`. |
## Links
- Setup for every client: [sfwapi.dev/mcp](https://sfwapi.dev/mcp)
- Tool reference: [sfwapi.dev/docs/mcp](https://sfwapi.dev/docs/mcp)
- Claude Code plugin, Cursor rule and Codex `AGENTS.md`: [github.com/sfwbot/sfwapi-agent-tools](https://github.com/sfwbot/sfwapi-agent-tools)
- HTTP API docs: [sfwapi.dev/docs](https://sfwapi.dev/docs)
- Interactive playground: [api.sfwapi.dev/playground](https://api.sfwapi.dev/playground)
- Pricing: [sfwapi.dev/pricing](https://sfwapi.dev/pricing)
Node 20 or newer. MIT licence.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues