JustAMCPServer

Inherits: Node < Object

Runs the editor-side Model Context Protocol server.

Description

JustAMCPServer owns the editor-facing MCP transport and emits signals for JSON-RPC tool requests, server lifecycle changes, elicitation responses, and cancellation notices. Most projects use it through the JustAMCP editor plugin or JustAMCPRuntime rather than instantiating it manually.

Implements the MCP Logging utility: declares logging capability, handles logging/setLevel, and pushes notifications/message to SSE clients. Engine output and JustAMCP debug traces can be forwarded when ProjectSettings.blazium/justamcp/forward_engine_logs and ProjectSettings.blazium/justamcp/enable_debug_logging are enabled.

Implements MCP Streamable HTTP on /mcp with MCP-Session-Id, per-stream SSE event IDs, Last-Event-ID replay, and DELETE session teardown. Legacy /sse + /message and stateless POST /mcp remain supported for existing clients.

Implements MCP pagination for tools/list, prompts/list, resources/list, and resources/templates/list using opaque cursors. Buffers recent notifications/message payloads for replay when clients missed SSE; see ProjectSettings.blazium/justamcp/mcp_log_buffer_size and blazium://logs/mcp/{cursor}.

Supports task-augmented tools/call for long-running tools (Tasks), notifications/progress via _meta.progressToken (Progress), and cooperative cancellation (Cancellation). Sync requests honor notifications/cancelled; task-augmented work uses tasks/cancel.

var server = JustAMCPServer.new()
server.tool_requested.connect(func(request_id, tool_name, args):
    print("MCP tool requested: ", tool_name)
)

Tutorials

Methods

bool

is_server_started() const

void

report_tool_progress(token: String, progress: float, total: float, message: String)

void

send_log_message(level: String, logger: String, data: Variant = null)


Signals

elicitation_completed(request_id: Variant, result: Dictionary) 🔗

Emitted when an elicitation request finishes. request_id identifies the request and result contains the user response or completion payload.


request_cancelled(request_id: Variant, reason: String) 🔗

Emitted when a pending MCP request is cancelled. request_id identifies the request and reason explains the cancellation.


server_status_changed(started: bool) 🔗

Emitted when the MCP server starts or stops. started is true while the server is running.


tool_requested(request_id: Variant, tool_name: String, args: Dictionary) 🔗

Emitted when an MCP client requests a tool call. Handlers should execute tool_name with args and respond using the associated request_id.


Method Descriptions

bool is_server_started() const 🔗

Returns true while the MCP HTTP server is listening on the configured port.


void report_tool_progress(token: String, progress: float, total: float, message: String) 🔗

Emits an MCP notifications/progress notification for the active progressToken.


void send_log_message(level: String, logger: String, data: Variant = null) 🔗

Sends an MCP notifications/message log to connected clients if level meets the client's logging/setLevel minimum. logger is optional. data should be a Dictionary or string (stored as message).