Skip to content

MCP Admon Server — API Reference

All tools and resources below belong to the current implementation. The server is designed to grow: new modules (shipments, billing, companies, etc.) will add their own tools and resources to this registry without touching the existing ones.

Tools — tickets module

All tools are exposed via the MCP protocol. They are not HTTP endpoints — they are invoked by AI agents through the MCP transport.

get_ticket_types

Returns ticket type information from the TicketRulesCache. Operates in two modes:

Mode 1 — no arguments: returns a summary of all available (non-blocked) ticket types.

FieldDescription
idTicket type ID
nameSnake-case type name (e.g. overweight)
descriptionHuman-readable label
use_caseWhen to use this type (from mcp_context)
requires_guideWhether a tracking number is needed

Mode 2 — with type_id or type_name: returns full requirements for a specific type.

FieldDescription
required_variablesList of { name, type } fields the agent must collect
optional_variablesList of { name, type } fields to collect if mentioned
requires_guideWhether a tracking number is required
amount_limit_mxnAmount ceiling enforced at CLAIM_IN_REVIEW transition (if applicable)
requires_credit_idWhether a credit reference is required
agent_notesFree-form instructions the agent must follow without exception

Types without mcp_context or with is_blocked: true are excluded from both modes.

Backend call: none (served from TicketRulesCache)


create_ticket

Creates a new ticket for a company. Before calling this tool, agents must call get_ticket_types to obtain required fields and agent notes. Validates conditions.avaliable_status and conditions.validations from catalog_ticket_types.rules. Uploads any provided files (base64) automatically after creation.

Required inputs: company_id, type, comments

Optional inputs: shipment_id, tracking_number, amount, assigned_to_id, files[] (base64), and any type-specific variables returned by get_ticket_types

Blocking logic: rejects immediately if the ticket type has mcp_context.is_blocked: true or has no mcp_context at all.

Backend call: POST /companies/tickets


update_ticket

Updates an existing ticket's status, comment, or attached files — all in a single call. status_id is optional; omitting it preserves the current status.

Required inputs: ticket_id

Optional inputs: status_id, comment, assigned_to_id, reason_decline, new_ticket_type_id, company_id (required when files are provided), files[] (base64)

Amount validation: when status_id = 10 (CLAIM_IN_REVIEW), the tool fetches the current ticket to read ticket_type_id and ticket_variables.amount, then checks amount against mcp_context.amount_limit_mxn. Rejects with McpError if the limit is exceeded.

Comment rules:

StatusComment
ACCEPTED (2), DECLINED (3), COMPLETE (7), REJECTED (8), CLAIM_IN_REVIEW (10)Required
FOLLOW_UP (5), IN_REVIEW (6), IN_ANALYSIS (9), INCOMPLETE (4), PENDING (1)Optional

Backend calls: GET /companies/tickets/{ticket_id} (only when transitioning to CLAIM_IN_REVIEW), PUT /companies/tickets/{ticket_id}


get_ticket

Retrieves the full detail of a single ticket. Enriches ticket_variables keys with explicit unit names (e.g. daysterm_in_days) to prevent AI misinterpretation.

Required inputs: ticket_id

Backend call: GET /companies/tickets/{ticket_id}


list_tickets

Lists tickets with optional filters. Defaults: start=0, length=10.

FilterTypeDescription
company_idnumberScope to a specific company
ticket_idnumberFind a specific ticket
tracking_numberstringFind tickets by guide number (use to check duplicates)
ticket_typestringFilter by type name
ticket_statusstringFilter by status name
carrierstringFilter by carrier name
shipment_type1|2|31=Paquete, 2=LTL, 3=FTL
international0|1|20=Nacional, 1=Internacional, 2=Importación
sla0|1|20=On time, 1=At risk, 2=Overdue
created_start_dateYYYY-MM-DDCreated on or after
created_end_dateYYYY-MM-DDCreated on or before
startnumberPagination offset
lengthnumberPage size

Backend call: GET /companies/tickets


Resources — shared

tickets://statuses

Returns all ticket statuses with metadata (id, label, requires_comment). Served from local constants — no backend call.

shipments://statuses

Returns all shipment statuses (id, name). Used to show human-readable names in avaliable_status validation errors. Loaded from GET /catalog/shipment-statuses and cached (TTL 12 hours).

Note: The tickets://types resource was removed. Its functionality is now covered by the get_ticket_types tool, which agents call proactively at the start of the ticket creation workflow.


Backend Endpoints — infrastructure

POST /mcp/activity-log

Inserts an activity log record into mcp_activity_log.

Auth: token_admin_or_bot_ai

Request body:

FieldTypeRequiredDescription
tool_namestring (max 100)Name of the MCP tool called
mcp_namestring (max 100)Identifier of the MCP server
user_idintegerDefaults to 0 (SYSTEM_USER_ID)
input_paramsobjectTool input parameters
statussuccess|error|deniedOutcome of the tool call
error_messagestringError message if status=error
execution_time_msintegerDuration in milliseconds

Response: { success: true } with HTTP 201


Environment Variables

VariableRequiredDescription
BACKEND_URLBase URL of the Hapi.js backend (e.g. http://127.0.0.1:3002)
BACKEND_BOT_AI_TOKENBot token for backend auth (token_admin_or_bot_ai)
MCP_API_KEY✅ (HTTP mode)API key clients must send in X-API-Key header
PORTHTTP server port (default: 3100)
MCP_TRANSPORTSet to stdio for Claude Desktop; omit for HTTP (default)

Envia Admin