yamtrack-mcp

yamtrack-mcp

Exposes the Yamtrack REST API as tools for LLMs, enabling media tracking and management through natural language.

Category
访问服务器

README

yamtrack-mcp

A standalone Model Context Protocol server (stdio or http transport, TypeScript) that exposes the Yamtrack REST API as tools for LLMs (Claude Desktop, OpenCode, VS Code, Hermes, etc.).

It runs on any machine and talks to a Yamtrack instance over its public REST API. No Django code required.

Requirements

  • Node.js 18+ (developed on v22/v26)
  • A reachable Yamtrack instance (e.g. http://localhost:8000 or your hosted URL)
  • An API token or a username/password for that instance

Install & build

npm install        # install dependencies
npm run build      # compile src/ -> dist/ (strict TypeScript)

Run

node dist/index.js --help

Authentication

The server authenticates to Yamtrack with a Bearer token. Precedence:

  1. --token <token> / env YAMTRACK_API_KEY — a static account API key (recommended, never expires) or a JWT.
  2. --username + --password — mints a JWT at startup and auto-refreshes it on 401 (JWTs expire after 1h).
Option Env var Description
--transport <type> stdio (default) or http
--base-url <url> YAMTRACK_BASE_URL API base URL. Default http://localhost:8000/api
--token <token> YAMTRACK_API_KEY Static API key (http fallback when no header)
--port <n> Port for http transport. Default 8080
--username <user> Username (mint JWT at startup)
--password <pass> Password (mint JWT at startup)
--help Show usage

Read-only tools (search_media, get_details) work without authentication.

HTTP transport

With --transport http the server listens on POST /mcp (StreamableHTTP, stateless). Each connection authenticates via the Authorization: Bearer <token> header it receives, falling back to --token / YAMTRACK_API_KEY when the header is absent. The token is then forwarded as a Bearer token to the Yamtrack REST API, exactly like the stdio transport.

Tools

All tools map 1:1 to the REST API documented in wiki/API.md.

Tool REST endpoint
search_media GET /search/
get_details GET /details/<source>/<type>/<id>/ (+ season)
list_tracked_media GET /media/<type>/
get_home GET /home/
get_history GET /history/<source>/<type>/<id>/
create_entry POST /media/<type>/create/
manual_create POST /media/manual/create/
update_entry PATCH /media/<type>/<instance_id>/
update_progress POST /media/<type>/<instance_id>/progress/
update_score POST /media/<type>/<instance_id>/score/
delete_entry DELETE /media/<type>/<instance_id>/delete/
sync_metadata POST /sync/<source>/<type>/<id>/
create_episode POST /episodes/
get_statistics GET /statistics/
get_me GET /auth/me/

Enum values: media_type ∈ {tv, movie, anime, manga, game, book, comic, boardgame, season}, status ∈ {Completed, In progress, Planning, Paused, Dropped}, source ∈ {tmdb, mal, igdb, openlibrary, mangaupdates, comicvine, custom}.

Client configuration

Claude Desktop (claude_desktop_config.json)

{
  "mcpServers": {
    "yamtrack": {
      "command": "node",
      "args": ["/abs/path/to/yamtrack-mcp/dist/index.js"],
      "env": { "YAMTRACK_API_KEY": "<token>" }
    }
  }
}

OpenCode (opencode.json)

{
  "mcp": {
    "servers": {
      "yamtrack": {
        "type": "stdio",
        "command": "node",
        "args": ["/abs/path/to/yamtrack-mcp/dist/index.js"],
        "env": { "YAMTRACK_API_KEY": "<token>" }
      }
    }
  }
}

VS Code (.vscode/mcp.json) / Hermes (~/.hermes/config.yaml)

Same command/args shape; pass the token via the YAMTRACK_API_KEY env var.

HTTP transport (any client that supports url + headers)

{
  "mcpServers": {
    "yamtrack": {
      "url": "http://localhost:8080/mcp",
      "headers": { "Authorization": "Bearer <token>" }
    }
  }
}

Run the server with node dist/index.js --transport http (optionally --port <n>). This mirrors how other HTTP MCP servers (e.g. Simkl) are configured.

Development

npm run verify   # typecheck (tsc) + lint/format (biome) + tests (vitest)
npm run typecheck
npm run lint     # biome check .
npm run format   # biome format --write .
npm run test     # vitest run
npm run dev      # build + run

Integration tests (tests/server.test.ts, tests/http.test.ts) drive every tool against an in-process mock REST API over InMemoryTransport and HTTP, covering auth (static token, per-request Bearer header, fallback token) and request/response shapes.

Resilience

supervise.sh wraps the server and restarts it if it crashes, up to YAMTRACK_MCP_MAX_RETRIES attempts (default 5, with a YAMTRACK_MCP_RETRY_INTERVAL seconds delay, default 2). Each attempt and the final give-up are logged to stderr. After the limit is reached the supervisor exits. The server's own clean exit (code 0) is not retried.

./supervise.sh --transport http --port 9123 --base-url http://10.0.0.5:8000/api

Project structure

yamtrack-mcp/
├── src/
│   ├── index.ts     # Entry: transport selection (stdio/http), CLI args
│   ├── client.ts    # YamtrackClient: REST wrapper, Bearer auth, JWT refresh
│   └── tools.ts     # Tool definitions mapped to REST endpoints (zod schemas)
├── tests/           # Integration tests with a mock REST API
├── biome.json       # Lint + format config
├── tsconfig*.json   # TypeScript (build + typecheck)
└── vitest.config.ts

License

Part of the Yamtrack project. See the main repository license.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选