anilist-mcp-server 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,107 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here. The format is based on
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres
5
+ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [Unreleased]
8
+
9
+ ### Added
10
+
11
+ - Initial release: an MCP server for AniList's GraphQL API, talking to
12
+ `https://graphql.anilist.co` directly through a first-party client instead
13
+ of a third-party wrapper (see AGENTS.md's "Why this server exists").
14
+ - Add `get_notifications`: the authenticated user's AniList notifications
15
+ (airing episodes, activity/thread likes/replies/mentions, new followers,
16
+ media/staff/character data-submission updates) — AniList's `Notification`
17
+ union has 20 possible types, each surfaced with its own distinguishing
18
+ reference (`media`/`user`/`thread`/`staff`/`character`) alongside the
19
+ common `id`/`type`/`context`/`createdAt` fields.
20
+ - Add 45 tools covering anime/manga search and details (incl. per-title
21
+ characters/voice-actors, staff, reviews, related media, score/status
22
+ statistics, and airing schedule), standalone characters/staff/studios,
23
+ genres/tags, recommendations, forum threads, activity feeds, and personal
24
+ AniList list management (add/update/remove entries, favourites, follow,
25
+ posting/deleting activity, deleting threads, account settings). Anime/manga
26
+ variants of the same operation (e.g. `get_anime`/`get_manga`,
27
+ `search_anime`/`search_manga`, `favourite_anime`/`favourite_manga`) are
28
+ unified into a single tool taking a `type`/`kind` parameter instead of
29
+ duplicating the tool per media type.
30
+ - Add `login_anilist`/`submit_anilist_redirect`: an Authorization Code Grant
31
+ OAuth flow with localhost auto-capture (falls back to manual redirect paste
32
+ for remote/headless hosts), matching the sibling servers' login UX.
33
+ - Cache read-only GraphQL queries in-memory (`CACHE_TTL_MS`, keyed per-account
34
+ — not just whether the caller was authenticated) instead of re-hitting
35
+ AniList on every call.
36
+ - Add five MCP Prompts (`recommend_similar`, `seasonal_overview`,
37
+ `hidden_gems`, `catch_up_activity`, `check_notifications`) — reusable
38
+ multi-step plans a client can offer as one-click flows instead of the user
39
+ chaining tool calls manually.
40
+ - Declare an `outputSchema` on every tool, describing its `structuredContent`
41
+ shape so clients can validate/introspect tool results instead of only
42
+ getting an opaque JSON blob.
43
+ - Publish a one-click `.mcpb` bundle as a release asset for MCP clients that
44
+ support drag-and-drop install (e.g. Claude Desktop), alongside the source
45
+ install path.
46
+ - Run on MCP TypeScript SDK v2 beta (`@modelcontextprotocol/server`, pinned
47
+ to an exact `2.0.0-beta.x`) — see AGENTS.md for the plan to bump to the
48
+ first stable v2 release.
49
+
50
+ ### Fixed
51
+
52
+ - Fix `seasonal_overview`'s prompt instructions to drop the `status_in:
53
+ ["RELEASING"]` filter when a specific past/future `season`+`year` is given,
54
+ instead of always applying it — a past season's titles are long since
55
+ `FINISHED`, so the old instructions would have told the model to search for
56
+ results that can never match.
57
+ - Have `catch_up_activity`'s prompt instructions check both the anime AND
58
+ manga CURRENT list groups, instead of only anime.
59
+ - Never cache `get_notifications` — its `resetNotificationCount` argument is
60
+ a real one-time side effect and its result must reflect the current
61
+ notification list, so a repeated call within the read-cache window no
62
+ longer silently skips the badge reset or returns a stale list.
63
+ - Classify `add_list_entry`/`update_list_entry`'s advancedScores validation
64
+ failures (unmatched category names, unresolvable media type) as a proper
65
+ `bad_request` tool error instead of an unclassified internal error, so the
66
+ specific, actionable message reaches the caller instead of a generic
67
+ "Unexpected error" wrapper.
68
+ - Surface a gated tool's actual "run login_anilist" guidance instead of a
69
+ generic "credentials rejected" message when no token is configured —
70
+ previously any `unauthorized` error was mapped to the same templated text
71
+ regardless of whether it came from AniList itself or from our own
72
+ pre-flight check, discarding the specific fix instructions.
73
+ - Return the actual saved/deleted data from `add_list_entry`/
74
+ `update_list_entry`/`remove_list_entry`, the favourite/follow/activity/
75
+ thread mutation tools, and `update_user`, instead of the raw GraphQL
76
+ response envelope.
77
+ - Reject `remove_list_entry`/`delete_activity`/`delete_thread` when AniList
78
+ reports `deleted: false` (already gone, or not owned by the caller), instead
79
+ of reporting a successful deletion that didn't actually happen.
80
+ - Reject `get_user_activity`/`catch_up_activity` with a clear "no such user"
81
+ error when the given username doesn't resolve to any AniList account,
82
+ instead of silently falling back to the site-wide global activity feed.
83
+ - Report `get_studio` as a real tool error (not a disguised success result)
84
+ when neither `id` nor `name` is given.
85
+ - Send the logged-in user's token on read tools (get_media, search_media,
86
+ get_user_profile, get_user_list, etc.) when one is configured, so
87
+ viewer-relative fields (`isFavourite`, `isFollowing`, `isFollower`) and the
88
+ caller's own private list entries resolve correctly instead of always
89
+ looking logged-out.
90
+ - Generate and verify an OAuth `state` value in `login_anilist`, rejecting a
91
+ callback/redirect that doesn't match the login attempt that started it —
92
+ and don't clear that check prematurely if the token exchange itself fails.
93
+ - Disable retries on the OAuth token exchange, since an authorization code is
94
+ single-use and a retry would just replay an already-consumed code; report a
95
+ clear "run login_anilist again" message on a rejected code instead of a
96
+ generic "bad request" one.
97
+ - Convert `add_list_entry`/`update_list_entry`'s `score` to AniList's raw
98
+ 0-100 scale before sending, instead of assuming every account's configured
99
+ `scoreFormat` is 0-10 — previously a non-decimal-10 account would have its
100
+ score silently written on the wrong scale.
101
+ - Order `advancedScores` against the account's actual configured
102
+ advanced-scoring categories for the entry's real anime/manga type (fetched
103
+ live, uncached) and convert it to AniList's raw 0-100 scale, instead of
104
+ sending it in the input object's own key order on a 0-10 scale — previously
105
+ every write was silently off by 10x, and an account with overlapping
106
+ anime/manga category names could have a score filed under the wrong
107
+ category entirely.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Grinv
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,261 @@
1
+ # AniList MCP Server
2
+
3
+ An [MCP](https://modelcontextprotocol.io) server for **[AniList](https://anilist.co)**.
4
+ It works with any MCP-compatible client or agent (Claude Desktop/Code, Cursor,
5
+ VS Code, Cline, Continue, and others) — the server speaks the standard MCP
6
+ stdio protocol.
7
+
8
+ ## What it does
9
+
10
+ Talks directly to AniList's public GraphQL API (`https://graphql.anilist.co`):
11
+
12
+ - **Reads — no credentials needed.** Search and browse anime/manga,
13
+ characters, staff, studios; genres/tags; recommendations; forum threads;
14
+ activity feeds; public/unlisted user profiles and lists.
15
+ - **Your own AniList account — requires a one-time login.** Manage your own
16
+ anime/manga list (add/update/remove entries), favourites, follows, your
17
+ notifications, and post/delete your own activity and threads.
18
+
19
+ ## What you need (and what it gets you)
20
+
21
+ Nothing is required to get started — you can skip straight to
22
+ [Install](#install). Everything below is optional:
23
+
24
+ | You set... | You get... |
25
+ | -------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
26
+ | _(nothing)_ | Search, details, genres/tags, recommendations, threads, activity, public profiles/lists — works immediately. |
27
+ | An AniList **Client ID + Client Secret** ([2 minutes, free →](#connect-your-anilist-account)), plus running `login_anilist` once | Everything above, plus your **own AniList account**: manage your list, favourites, follows, activity, and threads. |
28
+
29
+ Without a login, the personal/mutation tools reply with a clear message
30
+ telling you how to get one — everything else keeps working regardless.
31
+
32
+ ## Example queries
33
+
34
+ Once it's connected, just ask your agent in natural language.
35
+
36
+ **No credentials needed:**
37
+
38
+ ```
39
+ "Search for the anime Frieren and show its score, genres and synopsis."
40
+ "What recommendations does AniList have for fans of Steins;Gate?"
41
+ "Show me today's birthday characters."
42
+ "What genres and tags does AniList use for anime?"
43
+ "Show the public profile and stats for user <username>."
44
+ "What's in <username>'s AniList anime list marked as watching?"
45
+ ```
46
+
47
+ **With your AniList account** (after a one-time `login_anilist`; see
48
+ [Connect your AniList account](#connect-your-anilist-account)):
49
+
50
+ ```
51
+ "Add Frieren to my AniList plan-to-watch list."
52
+ "Set Cowboy Bebop to completed on my AniList with a score of 9."
53
+ "Follow user <username> for me."
54
+ "Post a text update to my AniList activity feed."
55
+ "What are my unread AniList notifications?"
56
+ ```
57
+
58
+ ## Tools
59
+
60
+ | Tool | Auth |
61
+ | ----------------------------------------------------------------------------------------------------- | ----- |
62
+ | `get_genres`, `get_media_tags`, `get_site_statistics`, `get_studio` | none |
63
+ | `get_media`, `get_media_statistics`, `get_media_characters`, `get_media_staff` | none |
64
+ | `get_media_reviews`, `get_media_relations`, `get_anime_schedule` | none |
65
+ | `get_character`, `get_staff`, `get_todays_birthdays` | none |
66
+ | `get_recommendation`, `get_recommendations_for_media` | none |
67
+ | `search_media`, `search_character`, `search_staff`, `search_studio`, `search_user`, `search_activity` | none |
68
+ | `get_thread`, `get_thread_comments` | none |
69
+ | `get_user_profile`, `get_user_stats`, `get_full_user_info`, `get_user_recent_activity` | none |
70
+ | `get_activity`, `get_user_activity` | none |
71
+ | `get_user_list` | none |
72
+ | `favourite` | token |
73
+ | `add_list_entry`, `update_list_entry`, `remove_list_entry` | token |
74
+ | `post_text_activity`, `post_message_activity`, `delete_activity` | token |
75
+ | `delete_thread` | token |
76
+ | `get_authorized_user`, `follow_user`, `update_user` | token |
77
+ | `get_notifications` | token |
78
+ | `login_anilist`, `submit_anilist_redirect` | login |
79
+
80
+ `token` = needs an AniList login (run `login_anilist` once).
81
+
82
+ ## Prompts
83
+
84
+ Reusable multi-step plans your client can offer as one-click flows:
85
+ `recommend_similar`, `seasonal_overview`, `hidden_gems`, `catch_up_activity`,
86
+ `check_notifications`.
87
+
88
+ ## Install
89
+
90
+ ### As an `.mcpb` bundle (one-click, e.g. Claude Desktop)
91
+
92
+ Download [**`anilist-mcp-server.mcpb`**](https://github.com/Grinv/anilist-mcp-server/releases/latest/download/anilist-mcp-server.mcpb)
93
+ (always the latest release) and open it with your MCP client. It prompts for an optional
94
+ AniList **Client ID** and **Client Secret** — set them and run the `login_anilist` tool to
95
+ enable the personal-list/social tools (see
96
+ [Connect your AniList account](#connect-your-anilist-account)). Leave them
97
+ blank to use just the credential-free read tools.
98
+
99
+ ### From source
100
+
101
+ ```sh
102
+ git clone https://github.com/Grinv/anilist-mcp-server
103
+ cd anilist-mcp-server
104
+ npm ci
105
+ npm run build
106
+ ```
107
+
108
+ This produces a self-contained `dist/index.js`. Point your client at it (see below).
109
+
110
+ ## Connect it to an MCP client
111
+
112
+ Add the server to your client's MCP config (Claude Desktop/Code, Cursor, VS Code,
113
+ Cline, …):
114
+
115
+ ```json
116
+ {
117
+ "mcpServers": {
118
+ "anilist": {
119
+ "command": "node",
120
+ "args": ["/absolute/path/to/anilist-mcp-server/dist/index.js"],
121
+ "env": {
122
+ "ANILIST_CLIENT_ID": "...",
123
+ "ANILIST_CLIENT_SECRET": "..."
124
+ }
125
+ }
126
+ }
127
+ }
128
+ ```
129
+
130
+ Or with the Claude Code CLI:
131
+
132
+ ```sh
133
+ claude mcp add anilist -e ANILIST_CLIENT_ID=... -e ANILIST_CLIENT_SECRET=... -- node /absolute/path/to/anilist-mcp-server/dist/index.js
134
+ ```
135
+
136
+ The `env` block is **optional** — omit it to use only the credential-free read
137
+ tools; the personal/mutation tools will return a clear error until you log in.
138
+ To enable them, set `ANILIST_CLIENT_ID` + `ANILIST_CLIENT_SECRET` and run the
139
+ **`login_anilist`** tool once (a one-time browser authorization; the token is
140
+ then stored and reused). The server does not read a `.env` file, so pass
141
+ config via this `env` block (or your shell environment). See
142
+ [docs/auth.md](docs/auth.md) for the full login walkthrough and
143
+ [docs/clients.md](docs/clients.md) for more clients.
144
+
145
+ ## Connect your AniList account
146
+
147
+ The search/browse tools work with **no setup**. To use the personal/mutation
148
+ tools, authorize your account once. It takes about two minutes.
149
+
150
+ **Step 1 — Register an AniList app (one minute).**
151
+
152
+ 1. Go to <https://anilist.co/settings/developer> and click **Create New Client**.
153
+ 2. **Name:** anything.
154
+ 3. **Redirect URL:** enter exactly
155
+ ```
156
+ http://localhost:8082/callback
157
+ ```
158
+ _(If port 8082 is already used on your machine, pick another port here and set
159
+ `ANILIST_OAUTH_PORT` to the same number — see [Configuration](#configuration).)_
160
+ 4. Save. Copy the **Client ID** and **Client Secret**.
161
+
162
+ **Step 2 — Give the credentials to the server.**
163
+
164
+ ```json
165
+ "env": { "ANILIST_CLIENT_ID": "...", "ANILIST_CLIENT_SECRET": "..." }
166
+ ```
167
+
168
+ Restart the server/client so it picks up the values.
169
+
170
+ **Step 3 — Log in (one click).**
171
+
172
+ In your assistant, run the **`login_anilist`** tool (or just say _"log in to
173
+ AniList"_). It replies with a link. Open the link, sign in to AniList, and
174
+ click **Approve**.
175
+
176
+ - **Running locally** (Claude Desktop, or Claude Code on your own machine):
177
+ login finishes **automatically** the moment you click Approve. Confirm with
178
+ _"show my AniList profile"_ (`get_authorized_user`).
179
+ - **Running on a remote/SSH/headless host:** after clicking Approve your
180
+ browser lands on a page that won't load — that's expected. **Copy the full
181
+ address from the browser's address bar** (it contains `?code=…`) and give it
182
+ to the **`submit_anilist_redirect`** tool to finish.
183
+
184
+ That's it. The token is saved locally (`~/.config/anilist-mcp-server/tokens.json`,
185
+ `0600`). AniList access tokens don't expire for about a year and there's no
186
+ refresh mechanism — you'll need to run `login_anilist` again once it does.
187
+
188
+ > **Prefer no interactive step?** Pre-set a standalone `ANILIST_ACCESS_TOKEN`
189
+ > instead. See [docs/auth.md](docs/auth.md).
190
+
191
+ ## Configuration
192
+
193
+ All configuration is via environment variables, all optional — without
194
+ credentials the read tools still work.
195
+
196
+ | Variable | Purpose |
197
+ | ----------------------- | ---------------------------------------------------------------------------------------------------------------------- |
198
+ | `ANILIST_CLIENT_ID` | Your AniList app's Client ID — see [Connect your AniList account](#connect-your-anilist-account). |
199
+ | `ANILIST_CLIENT_SECRET` | Your AniList app's Client Secret, paired with the Client ID above. |
200
+ | `ANILIST_ACCESS_TOKEN` | _Advanced, optional._ Pre-supply a token instead of running `login_anilist`. See [docs/auth.md](docs/auth.md). |
201
+ | `ANILIST_TOKEN_STORE` | Override where the login token is saved on disk (default: your OS's config folder). |
202
+ | `ANILIST_OAUTH_PORT` | Only needed if port `8082` is already in use — see step 1 of the [account walkthrough](#connect-your-anilist-account). |
203
+ | `LOG_LEVEL` | How much the server logs: `debug` \| `info` \| `warn` \| `error` \| `silent` (default `info`). |
204
+
205
+ ### Tuning (rarely needed)
206
+
207
+ | Variable | Purpose |
208
+ | ----------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
209
+ | `ANILIST_MIN_INTERVAL_MS` | Min spacing between AniList calls (default `2100`, i.e. ~30/min — AniList's API is currently in a documented degraded state; see [docs/api-references.md](docs/api-references.md)). Set to `0` to disable client-side throttling. |
210
+ | `CACHE_TTL_MS` | TTL for the in-memory read cache (default `300000` = 5 min). |
211
+ | `HTTP_TIMEOUT_MS`, `HTTP_RETRIES` | Per-request timeout (default `15000`) and retry attempts for transient failures (default `2`). |
212
+ | `ANILIST_GRAPHQL_URL`, `ANILIST_OAUTH_BASE_URL` | Override upstream base URLs. |
213
+
214
+ Provide these in your MCP client config's `env` block (the server does **not**
215
+ read a `.env` file). See [docs/auth.md](docs/auth.md) for how to obtain the
216
+ credentials, and [docs/clients.md](docs/clients.md) for client configuration
217
+ snippets.
218
+
219
+ ## NSFW content
220
+
221
+ NSFW (adult) results are **not** filtered by default — the server returns
222
+ whatever AniList provides. `search_media` accepts an optional `sfw`
223
+ parameter; set `sfw: true` to exclude adult entries.
224
+
225
+ ## Development
226
+
227
+ ```sh
228
+ npm run build # type-check + bundle to dist/
229
+ npm test # node:test suite (mocked, offline)
230
+ npm run test:coverage
231
+ npm run lint
232
+ npm run format
233
+ npm run check:api # live health-check of the AniList GraphQL endpoint
234
+ npm run inspector # run under the MCP Inspector
235
+ ```
236
+
237
+ Runtime requires Node ≥ 20. See [AGENTS.md](AGENTS.md) for contributor/agent
238
+ guidance, including why this server exists and how it avoids the upstream bug
239
+ that motivated building it.
240
+
241
+ ## Updating
242
+
243
+ To be notified of new versions, click **Watch → Releases** on GitHub.
244
+
245
+ - **`.mcpb` bundle:** download the new `anilist-mcp-server.mcpb` from the
246
+ [releases page](https://github.com/Grinv/anilist-mcp-server/releases) and
247
+ reinstall it in your client (it replaces the old version).
248
+ - **From source:** `git pull && npm ci && npm run build`.
249
+
250
+ See the [CHANGELOG](CHANGELOG.md) for what changed in each release.
251
+
252
+ ## Attribution and terms
253
+
254
+ This is an **unofficial** project and is not affiliated with or endorsed by
255
+ AniList. All data comes from the public [AniList GraphQL API](https://docs.anilist.co);
256
+ personal-account operations use your own AniList account and token. Use is
257
+ subject to [AniList's Terms of Service](https://anilist.co/terms).
258
+
259
+ ## License
260
+
261
+ [MIT](LICENSE) © Grinv