Mooncore.MCP.Server (mooncore v0.2.5)

Copy Markdown

MCP (Model Context Protocol) server for AI observability.

Everything is gated behind MOONCORE_DEV_SECRET. Nothing is exposed when the secret is not set.

Resources (read-only)

  • actions — list all registered actions across all apps
  • clients — connected WebSocket client counts per pool/group/channel
  • apps — registered app configurations
  • config — current Mooncore configuration (sanitized)

Tools

  • run_action — execute an action with given params and auth
  • add_watcher — start collecting logs with optional tag filter
  • read_logs — read collected logs, optionally filtered by tag or since an id
  • clear_logs — clear the log buffer
  • eval — evaluate Elixir code in the running application

Summary

Functions

Add a log watcher. Returns a reference for reading. Requires MOONCORE_DEV_SECRET.

Clear all collected logs. Requires MOONCORE_DEV_SECRET.

Evaluate Elixir code in the running application. mooncore_dev_tools only. Returns the result or error.

Handle an MCP-style request. Returns a map response.

List all registered actions across all apps. Requires MOONCORE_DEV_SECRET.

Get all registered apps (sanitized — no sensitive data). Requires MOONCORE_DEV_SECRET.

Get connected client counts for a pool. Requires MOONCORE_DEV_SECRET.

Publish a WebSocket message to connected clients. Requires MOONCORE_DEV_SECRET.

Read logs. Optional tag filter or since_id. Requires MOONCORE_DEV_SECRET.

Read WebSocket message logs with optional filters. Requires MOONCORE_DEV_SECRET.

Run an action through the full pipeline. Requires MOONCORE_DEV_SECRET.

Get current server configuration (sanitized). Requires MOONCORE_DEV_SECRET.

Functions

add_watcher_session(tag_filter \\ nil)

Add a log watcher. Returns a reference for reading. Requires MOONCORE_DEV_SECRET.

clear_logs()

Clear all collected logs. Requires MOONCORE_DEV_SECRET.

eval_code(code)

Evaluate Elixir code in the running application. mooncore_dev_tools only. Returns the result or error.

handle_request(params)

Handle an MCP-style request. Returns a map response.

Read resources: actions, clients, apps, config Tools (mooncore_dev_tools): run_action, add_watcher, read_logs, clear_logs, eval

list_actions()

List all registered actions across all apps. Requires MOONCORE_DEV_SECRET.

list_apps()

Get all registered apps (sanitized — no sensitive data). Requires MOONCORE_DEV_SECRET.

list_clients(pool \\ nil)

Get connected client counts for a pool. Requires MOONCORE_DEV_SECRET.

publish_socket(params)

Publish a WebSocket message to connected clients. Requires MOONCORE_DEV_SECRET.

Params

  • group — the dkey/group to target (required)
  • event — event name string (required)
  • message — payload map or value (required)
  • channels — list of channel strings (default: ["main:default"])

read_logs(opts \\ %{})

Read logs. Optional tag filter or since_id. Requires MOONCORE_DEV_SECRET.

read_socket_logs(opts \\ %{})

Read WebSocket message logs with optional filters. Requires MOONCORE_DEV_SECRET.

Options

  • limit — max entries (default 100, max 1000)
  • user — filter by username
  • channel — filter by channel name
  • direction — filter by "in", "out", or "publish"
  • since_id — only return entries after this id (for polling)

run_action(action, params \\ %{}, auth \\ nil)

Run an action through the full pipeline. Requires MOONCORE_DEV_SECRET.

Params

  • action — action name string
  • params — map of params to pass
  • auth — optional auth map (roles, user, app, dkey, scope)

server_info()

Get current server configuration (sanitized). Requires MOONCORE_DEV_SECRET.