Skip to content

Latest commit

 

History

History
532 lines (442 loc) · 53.5 KB

mcp.md

File metadata and controls

532 lines (442 loc) · 53.5 KB

MCP Server Operator Reference

Tuliprox can expose a Model Context Protocol (MCP) endpoint so that AI assistants and agent-capable IDEs (Claude Desktop, Cursor, ChatGPT and similar clients) can inspect, and optionally operate, a running instance through a fixed set of tools. This page covers enabling the endpoint, the security model, the tool catalog, client setup and troubleshooting.

1. What it is

  • The MCP server is a stateless JSON-RPC 2.0 endpoint at POST {web_ui_path}/mcp (for example http://localhost:8901/mcp). It is served by the Web UI router, so it uses the same listener, TLS setup and reverse proxy as the Web UI.
  • Every tool is a thin adapter over one existing /api/v1 REST route. A tool call is dispatched in-process into the same router with the caller's Authorization header, so authentication, RBAC permissions, validation and behavior are exactly those of the REST API. Nothing is re-implemented.
  • It is off by default and read-only by default. With the default configuration no /mcp route exists and nothing else changes.
  • A bundled stdio bridge (tuliprox --mcp-stdio) lets clients that can only start local commands talk to a running instance over HTTP.

2. Enabling the endpoint

Add an mcp: block to config.yml:

mcp:
  enabled: true
  read_only: true
  player_tools: off
  allowed_origins: []
  max_response_bytes: 262144
Parameter Type Default Technical Impact & Background
enabled Bool false Mounts POST {web_ui_path}/mcp. When false (or the block is absent) no MCP route exists.
read_only Bool true Hides write tools from tools/list and rejects them in tools/call. Set to false to expose update_playlists, update_geoip and update_imdb_ratings. Applies only to admin tools. Forced to true when Web UI authentication is disabled (see Security model).
player_tools Enum off Level of player tools offered to playlist proxy API users (off, read, write). off disables all player tools; read offers search, EPG and inspection tools; write allows recording and playback management. Tools are additionally filtered by the caller's effective features and permissions. When Web UI authentication is disabled, no player tools are offered.
allowed_origins List of Strings [] Additional Origin values accepted besides the request Host, for example https://claude.ai. Entries are trimmed and a trailing / is removed; for http, https, ws and wss the host is lowercased and a default port is dropped (https://claude.ai:443 is stored as https://claude.ai), as browsers send it. Each entry must be an origin (scheme://host[:port], custom schemes allowed) without path, query, fragment or user info; anything else fails the configuration load.
max_response_bytes Int 262144 Tool results larger than this many bytes are truncated and end with an explicit marker. Must be at least 1024, otherwise the configuration is rejected while loading.
  • Unknown keys inside mcp: are rejected while loading the configuration.
  • The same settings can be edited in the Web UI under Config → MCP. Saving a block that equals the defaults (disabled, read-only, no origins, 262144 bytes) removes the mcp: block from config.yml. The page shows a restart hint and, while Web UI authentication is disabled, a note that the endpoint is forced to read-only. The first-run setup wizard has an MCP step with the same fields (the restart and read-only notes are hidden there, because the instance is not running with the new configuration yet).
  • The endpoint is mounted at startup. Restart Tuliprox after changing the mcp block.
  • The endpoint is part of the Web UI router. If the Web UI is disabled, mcp.enabled is ignored and a warning is logged.
  • At startup Tuliprox logs the endpoint and its mode, for example MCP endpoint: POST /mcp (read-only).

3. Security model

3.1 Authentication

  • Web UI authentication is required for anything that changes state. The MCP endpoint is protected by the same authentication layer as the authenticated /api/v1 routes. When web_ui.auth is absent or disabled, the endpoint has no authentication at all, so the server is forced read-only regardless of mcp.read_only and logs a warning at startup. Do not expose such an instance beyond a trusted network.
  • With web authentication enabled, a missing, invalid or expired token is a real HTTP 401 with WWW-Authenticate: Bearer, for every JSON-RPC method including initialize and tools/list. Clients and the stdio bridge can therefore detect an expired session at the transport level and sign in again.
  • There is no OAuth flow. Obtain a token from POST {web_ui_path}/auth/token (see Remote clients). The token lifetime is web_ui.auth.token_ttl_mins (default 30); see Authentication & RBAC.

3.2 Permissions

  • Each tool call runs with the caller's own token against the matching REST route. The permission a tool needs is the permission of that REST route (see the tool catalog).
  • A valid token that lacks the permission gets an MCP tool result with isError: true and text starting with HTTP 403. No data is returned. Other REST failures are reported the same way, for example HTTP 503 when a feature such as QoS aggregation is disabled.
  • A playlist user's network_access rules apply to MCP calls like to every other Player API request: from a network the rules do not allow, the MCP request answers 403.
  • Use a dedicated Web UI user with a minimal group (for example only system.read,playlist.read) for assistants. See Structure of groups.txt.
  • Keep read_only: true unless an assistant must trigger playlist updates or the GeoIP refresh.

3.3 Origin check (DNS rebinding protection)

The Streamable HTTP transport requires servers to validate the Origin header.

  • A request without an Origin header (command line tools, desktop clients, the stdio bridge) passes.
  • A request with an Origin header must match the request Host (compared case-insensitively, scheme ignored) or an entry of mcp.allowed_origins. Otherwise the answer is 403.
  • A reverse proxy that rewrites the Host header makes a legitimate browser origin differ from the Host Tuliprox sees. List the public origin in allowed_origins, for example https://tuliprox.example.com.

3.4 Other protections

  • Tool arguments are validated against the tool's schema. Unknown arguments are rejected, and path parameters are percent-encoded, so an argument can never change the route that is called.
  • There are no tools that accept a free-form path, shell command or configuration payload.
  • get_config redacts secrets, because its result is sent to the AI provider. Values of keys containing password, secret, token, api_key, authorization or cookie, and non-empty username / user values, are replaced by ********. Passwords in URL userinfo and the query parameters password, pass, username, user, token and api_key are masked in every string. The api_proxy user list is reduced to a credential count per target. A result that cannot be parsed is withheld instead of returned unredacted.
  • Redaction is key-name based. It does not catch secrets under unrelated key names, secrets in free text or credentials embedded in URL paths (for example Xtream /live/user/pass/...). Other tools such as list_active_streams return user names and client IPs unredacted; grant the MCP user only the permissions you accept an AI provider seeing.

4. Tool catalog

Tools marked write are only listed and callable when read_only: false and Web UI authentication is enabled. The permission column names the permission the REST route requires (see groups.txt).

Tool Kind REST route Required permission Arguments
get_status read GET /status system.read none
list_active_streams read GET /streams system.read none
get_config read GET /config any of config.read, source.read, user.read, user.write, playlist.read, playlist.write none. Secrets are redacted (see 3.4). Filtered by the caller's permissions; can be large.
get_playlist_update_status read GET /playlist/update/status playlist.read none
query_stream_history read GET /stream-history system.read optional from, to (date YYYY-MM-DD or datetime), page (integer >= 1), page_size (25, 50, 100 or 200), search, search_mode (text or regex), search_field (list of record fields to search)
get_stream_history_summary read GET /stream-history/summary system.read optional from, to, provider_name, input_name, api_username, item_type, event_type
get_hls_origin_telemetry read GET /hls/origin-telemetry system.read none
list_qos_snapshots read GET /qos-snapshots system.read optional limit (integer >= 1), stream_identity_key, input_name, provider_name, item_type, target_name
get_qos_snapshot read GET /qos-snapshots/{key} system.read required stream_identity_key
get_event_stats read GET /events/stats system.read none
get_ip_info read GET /ipinfo system.read none
list_playlist_sources read GET /playlist/sources playlist.read none. Lists targets and inputs by name (see 4.1).
query_playlist_items read GET /playlist/items playlist.read required cluster, exactly one of target/input; optional paging, filter and field projection (see 4.1). Media-server inputs are read from their stored catalog.
list_media_server_libraries read GET /media-server/{input}/libraries playlist.read required input (media-server input name). Contacts the server twice sequentially (each 15 s bound, total up to ~30 s).
get_media_server_status read GET /media-server/{input}/status playlist.read required input (media-server input name). Contacts the media server once (15 s bound).
refresh_media_server_input write POST /media-server/{input}/refresh playlist.write required input, action (normal or refresh). Queues the update, no server traffic during the call.
query_target_epg_channels read GET /playlist/epg/channels playlist.read required target; optional output, paging, search, issue (see 4.2).
get_target_epg_channel read GET /playlist/epg/channel playlist.read required target, channel_id; optional output, from, to, limit (see 4.2).
update_playlists write POST /playlist/update playlist.write optional targets (list of target names; omit or leave empty to update all targets)
update_geoip write GET /geoip/update system.write none
update_imdb_ratings write GET /imdb/update playlist.write none

Notes:

  • query_stream_history and get_stream_history_summary need reverse_proxy.stream_history to be enabled. list_qos_snapshots and get_qos_snapshot need qos_aggregation to be enabled. get_hls_origin_telemetry needs reverse_proxy.hls_origin_telemetry to be enabled. update_geoip needs reverse_proxy.geoip to be enabled. update_imdb_ratings needs metadata_update.imdb to be enabled. Otherwise the REST route answers with an error status that is returned as an isError result.
  • update_playlists queues a playlist update (the REST route answers 202 with a run id). A second request while one is queued answers 409. refresh_media_server_input queues the same kind of update for one media-server input and answers 202 with a run id as well.
  • The playlist and EPG tools read stored data only and never trigger provider traffic. list_media_server_libraries and get_media_server_status are the exception: get_media_server_status contacts the configured server once with a 15-second bound, while list_media_server_libraries makes two sequential calls, each with a 15-second bound (total up to ~30 seconds; a hanging server answers 504). refresh_media_server_input only queues work.
  • Tools declare readOnlyHint in their annotations, so clients can ask for confirmation before calling write tools. Built-in tools also declare openWorldHint: false (they act on tuliprox only). The built-in write tools save_overrides and discard_overrides declare destructiveHint: true (they overwrite or discard override data); other built-in write tools declare destructiveHint: false.
  • A successful result whose body is a complete JSON object is returned twice: as the text block and as structuredContent. A truncated result has only the text block with the truncation marker. A plugin tool that declares an outputSchema is held to it (see 4.5).
  • Lists use offset/limit with total_matched, returned and has_more. Plugin tools follow the limit/cursor/next_cursor convention instead (see 4.5).
  • Only the tools capability is implemented. Prompts and resources are not offered.

4.1 Reading stored playlists

How a client learns to use these tools: tools/list carries a description and a JSON Schema per tool (parameters, enums and one line per selectable field), and the initialize result carries an instructions text with the recommended workflow (admin and web callers receive MCP_INSTRUCTIONS; playlist API users receive MCP_PLAYER_INSTRUCTIONS). The names below are exactly those enums.

Start with list_playlist_sources. It returns the names that the other tools expect, never credentials or URLs:

{
  "targets": [{"id": 1, "name": "main", "outputs": ["xtream", "m3u"],
               "epg": [{"output": "xtream", "available": true}, {"output": "m3u", "available": false}]}],
  "inputs": [{"id": 1, "name": "provider-a", "input_type": "xtream", "clusters": ["live", "video", "series"]}]
}

clusters is empty for input types without a stored playlist database (for example stalker); epg.available tells whether the processed EPG database of that output exists. Media-server inputs (plex, emby, jellyfin, silo) report ["video", "series"]: video holds the movies, series the series entries.

query_playlist_items reads the stored records (the same data the Web UI lists) of one target or one input. No provider is contacted. For a media-server input it reads the stored catalog: video lists the movies, series the series entries (episode rows stay hidden, like for a target). Parameters:

Parameter Meaning
target/input Name of the source. Exactly one is required; both or neither answer an error.
cluster Required. live, video or series. A target lists series without episode rows, like the Web UI.
offset Matching records to skip (default 0).
limit Page size, default 50, clamped to 500. The response echoes the applied limit and sets limit_clamped.
search Case-insensitive substring, matched against search_field.
search_field List of name, title, group, epg_channel_id, provider_id, input_name. Default name, title, group; any one may match.
group Exact (case-sensitive) group name, combined with search by AND.
fields List of fields to return (table below). Default: the first ten.
epg_status Targets only. List of missing_id, unmatched, matched (OR). See 4.2.

Selectable fields:

Field Meaning
virtual_id Id of the item inside Tuliprox (default)
provider_id Id at the provider, always a string (default)
name, title Channel/stream name and display title (default)
group Group (category) name (default)
item_type live, video, series, series_info, catchup (default)
cluster live, video or series (default)
epg_channel_id EPG id assigned to the item, null when none (default)
category_id Provider category id; null for M3U records (default)
channel_no Channel number (default)
logo, logo_small Logo references as stored
parent_code, rec Parental code and recording/catch-up flag
input_name Name of the originating input
input_stream_id Stream id inside the originating input
source_ordinal Position inside the source playlist
additional_properties Provider specific extras (video/series details, can be large); URL-like members are removed
epg_status missing_id, unmatched or matched (targets with an EPG database only)

Response:

{
  "source": {"kind": "target", "name": "main"},
  "cluster": "live",
  "total_matched": 1342, "skipped_records": 0, "offset": 0, "limit": 50, "limit_clamped": false,
  "returned": 50, "has_more": true,
  "items": [{"virtual_id": 1001, "provider_id": "4711", "name": "Das Erste HD", "title": "Das Erste HD",
             "group": "DE | Public", "item_type": "live", "cluster": "live",
             "epg_channel_id": "daserste.de", "category_id": 12, "channel_no": 1}]
}

total_matched counts every record matching the filter, not only the page; continue with offset += returned while has_more is true. The call makes one pass over the stored database, so its cost grows with the playlist size. A source that was never updated answers total_matched: 0 plus a note.

skipped_records is always present. It is 0 for a healthy database; a greater value is the number of stored records that could not be read and are therefore missing from the listing and not part of total_matched. The response then carries a note saying so, so a damaged database is not mistaken for a short playlist.

4.2 Finding EPG problems

Every target with an xtream or m3u output has a processed EPG database. Two tools inspect it, and epg_status connects it to the playlist:

  1. query_playlist_items with epg_status=missing_id lists items without an EPG id, epg_status=unmatched lists items whose id does not exist in the EPG database (a failed EPG mapping), epg_status=matched the healthy ones.

  2. query_target_epg_channels lists EPG channels as {id, title, has_icon, programme_count, first_start, last_stop, covers_now, referenced_by_playlist} (timestamps RFC 3339 UTC, no raw programmes). Parameters: target (required), output (xtream or m3u, default: the first output with an EPG database), offset, limit (default 50, max 500), search (id or title substring) and issue (list, OR):

    issue Matches channels that
    no_programmes have no programme at all
    expired have only programmes that ended in the past
    not_current have no programme covering the current time (includes channels without any)
    no_title have no title
    unreferenced are used by no playlist item of the target
  3. get_target_epg_channel shows the programmes of one channel: target, channel_id (exact EPG id, canonicalized like the XMLTV output), optional output, from/to (RFC 3339, default now to now + 24 h) and limit (default 100, max 1000). The response has the channel metadata, total_in_window, truncated and programmes with start, stop, title, desc (cut at 500 characters), categories, is_live, is_new. A programme belongs to the window when it ends after from and starts before to.

The response of query_target_epg_channels also has skipped_playlist_records, always present: the number of stored playlist records that could not be read while collecting the EPG ids the playlist uses. It is 0 for a healthy database; a greater value means referenced_by_playlist and the unreferenced filter may be wrong for channels used only by those records, and the note says so. referenced_by_playlist is null and the unreferenced filter matches nothing when the playlist of the target is not stored (the note says that, too).

A target without an EPG database answers 200 with total_matched: 0 and a note that says why, so that "0" is not mistaken for "healthy". Only the processed per-target EPG is inspectable; the raw input EPG files are not.

Scanning an EPG database is bounded: at most two scans run at the same time (further calls wait), a scan stops when the client disconnects, and the set of EPG channel ids behind epg_status is cached (the least recently used of up to eight databases is evicted) until the EPG database is rewritten (for example by the next playlist update). A cached set is answered without a scan slot or opening the database, so repeated epg_status queries are cheap.

Typical debugging flow: list_playlist_sources, then query_playlist_items with epg_status=unmatched, then query_target_epg_channels with issue=expired or unreferenced, then get_target_epg_channel for a suspicious id.

4.3 Media-server tools

Three tools address one core media-server input by name (from list_playlist_sources). Inputs of other types answer 400, unknown names 404.

  • list_media_server_libraries contacts the server once and answers [{id, name, kind, selected}]. kind is movies, tvshows or unsupported; selected marks the libraries the input imports, because list_libraries returns only the configured selection while the route also reports the libraries visible on the server.
  • get_media_server_status contacts the server once and answers {kind, server_id, name, version, reachable}. A failure answers an error result with the stable media-server failure kind and its redacted detail.
  • refresh_media_server_input queues a playlist update for that input (normal reuses a valid cached catalog, refresh bypasses it) and answers 202 with a run id. Progress is read with get_playlist_update_status.

No token, password or URL is returned by any of them.

4.4 Plugin tools

A plugin's ui.rpc_exports with mcp: true appear as plugin_<id>_<method> when the admin approved MCP exposure for the loaded wasm and mcp.plugin_tools is on (see Events, Notifications and Providers).

  • Annotations. A read export is readOnlyHint: true; a write export is readOnlyHint: false with destructiveHint from the manifest's destructive flag (default false). Plugin tools always declare openWorldHint: true: a plugin may contact an external service.
  • Output schema. An export may declare an output_schema file. It is shown as outputSchema. A successful call validates the plugin's JSON answer against it. A matching object answer becomes structuredContent (plus the text block). An answer that is not a JSON object, that was truncated, or that violates the schema is a tool error (isError: true) with a short reason, and the answer is discarded. Without output_schema the behavior is the generic one: a complete JSON object is also structured content.
  • Input-scoped tools. An export with input_scoped: true takes a required input argument, an enum of the server's inputs of that plugin. The named input must exist, be type: plugin, and belong to this plugin; otherwise the call is a tool error and the plugin is not called. The plugin then receives {"args": <the other arguments>, "input": {name, url, username, password, options}}. The host scrubs the input's password, username and secret-looking option values from the answer and from the logs, so a plugin that echoes them leaks nothing. The same payload is used by POST /api/v1/plugins/{id}/rpc/{method}.
  • Pagination. A list-returning plugin tool takes optional limit and cursor and answers {items, next_cursor}, where next_cursor is null on the last page. The host does not enforce this beyond the tool's schema; it is a convention plus the SDK's Page<T> helper.
  • Limits. A plugin answer is capped at 256 KiB and 10 calls per second per plugin (burst 20), like every rpc call.

4.5 What is never returned

  • The provider url of a record is not selectable and never returned; Xtream provider URLs carry credentials in their path, which the generic redaction cannot detect.
  • In additional_properties, the members direct_source, catch-up source and extra_attributes, the binary probe blobs video and audio, every key named url or ending in _url, and every string value that looks like credentials are removed. logo and logo_small become null when they contain credentials.
  • Results still pass the generic redaction and the mcp.max_response_bytes limit. A large limit combined with additional_properties can hit that limit and is then truncated with an explicit marker.
  • A stored record that cannot be decoded is skipped by the database reader and logged on the server. It is missing from the pages, and the response reports how many were skipped in skipped_records together with a note.

5. Player tools for playlist users

When mcp.player_tools is set to read or write, playlist proxy API users can control player features (channel and EPG search, streams, failover source switching, shared-stream splitting, personal recordings, and recurring recording rules) through AI assistants. Watch progress and the player event stream are REST/WebSocket only and have no MCP tools.

5.1 Authentication for playlist users

API users authenticate using a Bearer token obtained from POST {web_ui_path}/auth/token with their Xtream credentials (username and password). Sign-in needs ui_enabled or effective player_features.api_enabled; player tools need the effective Player API switches (player_features.api_enabled, unset follows ui_enabled; web_ui.player_api_enabled, unset follows user_ui_enabled). With the player API off, the MCP endpoint lists no player tools and tool calls fail with "Unknown tool" (no 403).

The issued token carries the API user's identity. Tuliprox resolves the effective permissions and plan features (e.g. source_switch, joinable_streams, recording, max_recording_rules) dynamically on every request.

  • API users see only player tools matching their effective features and the configured mcp.player_tools level (read offers read-only tools; write offers read and write tools).
  • Admin tools are completely hidden from API users; attempting to call an admin tool or an unauthorized player tool returns an Unknown tool: <name> error (-32602).
  • Protocol initialize returns role-scoped instructions: admin workflow guidance for administrators and player tool instructions for playlist API users.
  • When Web UI authentication is disabled, all write tools remain inaccessible.

5.2 Player tool catalog

Tool Kind Underlying route Required feature Arguments
me_capabilities read GET /me/capabilities none (always available) none. Reports effective permissions, quotas, and limits.
me_search_channels read GET /me/channels none (always available) optional query (filter name), group (filter group), limit (1-500, default 50). Returns live channels passing the user's content filter.
me_get_epg read GET /me/epg none (always available) required vid (virtual channel ID), from, to (unix seconds or RFC 3339; max 48-hour window). Times in unix seconds and ISO-8601 with timeshift applied.
me_list_streams read GET /me/streams none (always available) none. Lists active playback streams owned by the caller.
me_stop_stream write DELETE /me/streams/{uid} none (always available) required uid (stream ID). Stops the caller's active stream (destructive) and emits stream_ended with reason stopped.
me_list_sources read GET /me/channels/{vid}/failover-members source_switch required vid (virtual channel ID). Lists failover members for a group channel with redacted health and quality details.
me_switch_source write POST /me/streams/{uid}/failover-switch source_switch required uid (stream ID), member_vid. Switches stream source.
me_split_stream write POST /me/streams/{uid}/split source_switch required uid (stream ID). Returns reconnect_required and the dedicated url (dedicated=1) with the password replaced by ***; the client closes the old stream and opens the new one. Live MPEG-TS only.
me_list_joinable read GET /me/streams/joinable joinable_streams none. Lists shared streams the user can join without consuming an additional provider connection.
me_list_recordings read internal recording snapshot recording (read) none. Returns the full recording snapshot JSON (same format as the WebSocket snapshot).
me_record_program write POST /recording/requests recording (private/shared) required vid, program_start, program_end, title; optional visibility, pre_roll_secs, post_roll_secs. Idempotent.
me_cancel_recording write POST /recording/requests/{id}/cancel recording (private/shared) required id (recording request ID). Cancels a scheduled or in-progress recording.
me_delete_recording write DELETE /recording/requests/{id} recording (private/shared) required id (recording request ID). Deletes a recording or library entry (destructive).
me_recording_conflicts read POST /recording/conflicts/preview recording (private/shared) required vid, program_start, program_end; optional pre_roll_secs, post_roll_secs, priority. Previews scheduling conflicts.
me_list_rules read GET /recording/rules recording (read) none. Lists recurring recording rules visible to the caller (own rules and visible shared rules of the own target) in the redacted UserRecordingRuleDto shape (own, owner_id only for own rules).
me_create_rule write POST /recording/rules recording (private/shared) required vid, weekday (1-7), local_start_time (HH:MM), duration_secs; optional timezone, visibility, pre_roll_secs, post_roll_secs. Enforces max_recording_rules.
me_delete_rule write DELETE /recording/rules/{id} recording (private/shared) required id (recording rule ID); optional future (retain or cancel, default retain). Deletes a recurring recording rule (destructive).

5.3 Example workflow: recording a show

To fulfill a request like "Record the show at 10:00 on channel Sports 1", the assistant executes the following sequence:

  1. Find the channel: Call me_search_channels with {"query": "Sports 1"}. The result contains matching visible channels with their virtual_id (e.g. 1042).

  2. Find the programme in EPG: Call me_get_epg with {"vid": 1042, "from": 1740045600, "to": 1740052800} (a window covering 10:00). The response provides the programme's title, description, start_ts, and stop_ts (with user timeshift applied).

  3. Schedule the recording: Call me_record_program with:

    {
      "vid": 1042,
      "title": "Morning Match",
      "program_start": 1740045600,
      "program_end": 1740049200
    }

    The server automatically attaches an Idempotency-Key header computed from the user's identity and arguments. If the assistant repeats the call with the same arguments, no duplicate recording is created.

Possible recording errors reported in isError tool results:

  • recording_quota_exceeded: The user's private recording byte quota is exhausted.
  • recording_concurrency_exceeded: The user has reached their maximum concurrent recordings limit for the requested time window.
  • recording_invalid_source: The channel does not exist or is excluded by the user's content filter.

6. Client setup

6.1 Local clients over stdio (Claude Desktop, Cursor)

Clients that start a local command use the built-in bridge. It reads newline-delimited JSON-RPC on stdin, forwards each message to the HTTP endpoint of a running instance and writes the answers to stdout. It signs in with a Web UI user via /auth/token and signs in again once when the endpoint answers 401. When the target has no web authentication the credentials are optional. If only one of the two environment variables is set, the bridge warns on stderr and continues without credentials.

Setting Meaning
--mcp-stdio Run the bridge instead of the server.
--mcp-url <base-url> Base URL of the running instance including the Web UI path prefix, if any, for example http://localhost:8901 or https://tv.example.com/admin. The bridge appends /mcp and /auth/token. Defaults to http://127.0.0.1:8901.
TULIPROX_MCP_USER (environment) Web UI user name used for the sign-in.
TULIPROX_MCP_PASSWORD (environment) Password of that user.

Claude Desktop (claude_desktop_config.json) and Cursor (.cursor/mcp.json or the global mcp.json) use the same shape:

{
  "mcpServers": {
    "tuliprox": {
      "command": "/usr/local/bin/tuliprox",
      "args": ["--mcp-stdio", "--mcp-url", "http://localhost:8901"],
      "env": {
        "TULIPROX_MCP_USER": "assistant",
        "TULIPROX_MCP_PASSWORD": "change-me"
      }
    }
  }
}
  • Only protocol JSON is written to stdout. Diagnostics go to stderr. Do not wrap the command in a script that prints anything to stdout (banners, echo, set -x), because MCP clients treat every stdout line as a protocol message.
  • The bridge exits cleanly when the client closes stdin.
  • Passing the password through the environment keeps it out of the process list. Restrict the permissions of the client config file.

6.2 Remote Streamable HTTP clients

Clients that support remote MCP servers over Streamable HTTP can connect directly. Use a bearer token:

TOKEN=$(curl -s -X POST http://localhost:8901/auth/token \
  -H 'Content-Type: application/json' \
  -d '{"username":"assistant","password":"change-me"}' | jq -r .token)

Then configure the client with the URL https://tuliprox.example.com/mcp and the header Authorization: Bearer <token>. Example for a client that accepts a JSON server definition:

{
  "mcpServers": {
    "tuliprox": {
      "type": "http",
      "url": "https://tuliprox.example.com/mcp",
      "headers": { "Authorization": "Bearer <token>" }
    }
  }
}

The token expires after web_ui.auth.token_ttl_mins (default 30 minutes) and there is no refresh flow on the MCP endpoint, so the client has to be given a new token after it expires. For unattended local use prefer the stdio bridge, which signs in again on its own. Always use HTTPS when the endpoint is reachable from outside a trusted network.

6.3 Verifying with curl

curl -s http://localhost:8901/mcp \
  -H "Authorization: Bearer $TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get_status","arguments":{}}}' | jq

7. Protocol behavior and limits

  • Methods: initialize, notifications/initialized, ping, tools/list and tools/call. Any other method answers JSON-RPC error -32601.
  • Protocol versions: Tuliprox echoes the client's protocolVersion when it is one of 2025-06-18, 2025-03-26 or 2024-11-05 and answers 2025-06-18 otherwise.
  • Stateless: there are no MCP sessions and no Mcp-Session-Id header. Every request stands alone.
  • JSON only: responses are plain application/json. There is no SSE stream, no server-initiated notification and no resumability. GET and DELETE on the endpoint answer 405 (with Allow: POST).
  • No batching: a JSON-RPC batch array is rejected with -32600.
  • Notifications (messages without an id) answer 202 Accepted with an empty body.
  • Errors: malformed JSON answers -32700, an invalid envelope -32600, an unknown tool, a missing params or a write tool in read-only mode -32602. Missing or invalid tool arguments, and any non-success answer of the REST route, are returned as an isError: true tool result so the model can read the reason.
  • Truncation: a tool result larger than mcp.max_response_bytes is cut on a character boundary and ends with [truncated: response exceeded N bytes]. Narrow the query (date range, page_size, limit, provider filter) or raise max_response_bytes.

8. Troubleshooting

Symptom Cause and fix
404 (or the Web UI page) on /mcp mcp.enabled is false, the Web UI is disabled, or Tuliprox has not been restarted since the change. Check the startup log for the MCP endpoint: line. web_ui.path is part of the URL ({web_ui_path}/mcp).
401 with WWW-Authenticate: Bearer No token, an invalid token or an expired token (web_ui.auth.token_ttl_mins). Request a new token from /auth/token. After an update that changes permissions, tokens issued earlier are rejected as well.
403 with body Origin not allowed The request carries an Origin header that matches neither the Host nor mcp.allowed_origins. Behind a reverse proxy that rewrites Host, add the public origin to allowed_origins.
Tool result isError: true starting with HTTP 403 The token is valid but the user's group lacks the permission of the underlying REST route. See the tool catalog and groups.txt.
Tool result isError: true starting with HTTP 503 The feature behind the tool is disabled (for example qos_aggregation or reverse_proxy.stream_history).
405 Method Not Allowed on GET Expected. The server offers no SSE stream. Clients must use POST. A client that insists on GET for a stream tolerates the 405.
Write tool missing from tools/list or -32602 on tools/call mcp.read_only is true, or Web UI authentication is disabled (forced read-only). Set read_only: false and enable web_ui.auth.
Tool output ends with [truncated: ...] The result exceeded mcp.max_response_bytes. Use filters or raise the limit.
Claude Desktop or Cursor reports invalid JSON from the stdio tool Something other than protocol JSON reached stdout. Run the bridge command directly in a terminal, check stderr, and make sure no wrapper script prints to stdout.
The stdio bridge keeps failing with 401 Wrong TULIPROX_MCP_USER / TULIPROX_MCP_PASSWORD, or the user is throttled after repeated failed sign-ins. Check the auth.sign_in.throttled event in the log.

9. Non-goals and follow-ups

  • No configuration write tools. The REST save endpoints take whole configuration documents and offer no diff or preview, which is unsafe for an LLM. Configuration is readable through get_config only.
  • No SSE, sessions or OAuth. Long-lived access relies on token_ttl_mins or the stdio bridge's re-login.
  • No prompts or resources MCP capabilities.
  • Planned follow-ups: configuration write tools with a dry-run mode, and per-tool permission toggles.