wappmeow-mcp-server

v1.2.2
@eduh_dev021/wappmeow-mcp-server Checked 3 hours ago Published 16 days ago

MCP server exposing @eduh_dev021/wappmeow WaClient as dynamic tools for end-to-end testing

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

call

Resolve a dotted path on a root object and either return the value or call it as a function with the given args. Roots: "client" (default) = WaClient instance; "lib" = the @eduh_dev021/wappmeow module namespace (pure helpers like parsePhoneJid/isGroupJid/normalizeRecipientJid, the WA_* constants, the proto namespace at "proto.*", and createStore). Examples: { path: "connect" } -> client.connect(); { path: "group.create", args: [...] } -> client.group.create(...); { root: "lib", path: "parsePhoneJid", args: ["+5511999999999"] }; { root: "lib", path: "WA_DEFAULTS" } returns the constants object.…

ParameterTypeDescription
path *stringDotted property path. Examples: "sendMessage", "group.metadata", "proto.Message.create" (under root="lib").
argsarrayPositional arguments. Each item is decoded (e.g. $bytes/$bigint markers).
noAwaitbooleanWhen true, invoke the function and return immediately without awaiting its Promise. Useful for client.connect() during pairing. Rejections are logged via the runtime logger.
rootstring"client" (default) walks WaClient instance; "lib" walks the @eduh_dev021/wappmeow module namespace (no client init needed).
sessionstringTarget WaClient session id. Omit to use the default session (MCP_SESSION_ID). Any other id lazily spins up an additional session that shares the same store / auth backend (rows are scoped per session…

inspect

List the properties and methods reachable at a path on the chosen root. Roots: "client" (default) = WaClient instance + coordinators; "lib" = the @eduh_dev021/wappmeow module namespace (use { root: "lib" } to see exported helpers, WA_* constants, "proto", "createStore", etc.). Returns own + inherited members up to (but excluding) Object.prototype, with origin class name.

ParameterTypeDescription
includeEventEmitterbooleanInclude EventEmitter-inherited methods (on/off/emit/etc). Default false.
pathstringDotted path. Empty/omitted = the root itself.
rootstring"client" (default) inspects WaClient; "lib" inspects the @eduh_dev021/wappmeow module namespace.
sessionstringTarget WaClient session id. Omit to use the default session (MCP_SESSION_ID). Any other id lazily spins up an additional session that shares the same store / auth backend (rows are scoped per session…

events

Read recent buffered WaClient events. Filter by types and/or sequence id. Use this to wait for QR codes, pairing codes, incoming messages, group events, etc. Each event has a monotonic seq – pass `since: <seq>` next call to fetch only newer ones. Use `q` for case-insensitive substring search across `type + JSON.stringify(payload)`; `regex: true` to treat `q` as a regex pattern (case-insensitive).

ParameterTypeDescription
drainbooleanIf true, returned events are removed from the buffer.
limitnumberMax events to return (default 50).
qstringFilter by substring (case-insensitive) of the event type + stringified payload.
regexbooleanTreat `q` as a regex pattern (case-insensitive).
sessionstringTarget WaClient session id. Omit to use the default session (MCP_SESSION_ID). Any other id lazily spins up an additional session that shares the same store / auth backend (rows are scoped per session…
sincenumberReturn only events with seq > since.
typesarrayEvent type filter, e.g. ["auth_qr","auth_pairing_code","connection","message"]. Empty/omitted = all types.

events_clear

Clear a session's event buffer (default session when `session` is omitted). Returns the number of events dropped.

ParameterTypeDescription
sessionstringTarget WaClient session id. Omit to use the default session (MCP_SESSION_ID). Any other id lazily spins up an additional session that shares the same store / auth backend (rows are scoped per session…

logs

Read recent buffered log entries from the WaClient/MCP runtime logger. Each entry has a monotonic seq, timestampMs, level, message and optional context object. Pass `since: <seq>` to fetch only newer entries on the next call. Logs are also written to stderr and (if MCP_LOG_FILE is set) appended to that file as JSONL. Use `q` for case-insensitive substring search across the message + stringified context; `regex: true` to treat `q` as a regex pattern (case-insensitive).

ParameterTypeDescription
drainbooleanIf true, returned entries are removed from the buffer.
levelsarrayFilter by levels, e.g. ["warn","error"]. Empty/omitted = all.
limitnumberMax entries to return (default 100).
qstringSubstring (case-insensitive) matched against `message + JSON.stringify(context)`.
regexbooleanTreat `q` as a regex pattern (case-insensitive).
sessionstringKeep only log lines emitted by this session (matched on context.session). Omit to return every line, including untagged server/global logs.
sincenumberReturn only entries with seq > since.

logs_clear

Clear the entire log buffer (stderr + log file are unaffected). Returns the number of entries dropped.

lifecycle

Manage a WaClient session (default session when `session` is omitted). Actions: "status" reports config, the resolved session, whether its client is created, its state, and a summary of every live session; "start" creates the session client (no connect); "destroy" disconnects + drops that session and frees its slot (next call recreates it). The shared store stays open for the other sessions - only `restart` with mode "process_exit" tears the whole process (and store) down.

ParameterTypeDescription
action *string
sessionstringTarget WaClient session id. Omit to use the default session (MCP_SESSION_ID). Any other id lazily spins up an additional session that shares the same store / auth backend (rows are scoped per session…

restart

Restart runtime state. "soft" (default): disconnect + drop one session's WaClient (default session when `session` is omitted), clear its event buffer + the shared log buffer, reset seq counters; the process stays alive and the next tool call recreates the client from the same config - code changes loaded into the Node module cache are NOT picked up. Other sessions and the shared store are left untouched. "process_exit": disconnect EVERY session, destroy the shared store, then exit with code 0 so a supervisor (nodemon, Claude Code respawn-on-reconnect, etc.) starts a fresh process. With no supe…

ParameterTypeDescription
modestring"soft" (default) keeps the process; "process_exit" terminates the process so a supervisor can respawn it.
sessionstringTarget WaClient session id. Omit to use the default session (MCP_SESSION_ID). Any other id lazily spins up an additional session that shares the same store / auth backend (rows are scoped per session…

eval

Execute arbitrary JS in the MCP runtime with `client` (the WaClient for the selected `session`, default session when omitted) and `lib` (@eduh_dev021/wappmeow module namespace) in scope. **Disabled by default**: requires `MCP_EVAL_ENABLED=1` in the MCP process env, otherwise every call is rejected. The source is wrapped in an async function – top-level `await` works. Use `return <expr>` to surface a value; the result is encoded for JSON ($bytes / $bigint markers). Use `globalThis.<key> = ...` to persist state between eval calls (e.g. stash an unregister callback returned by registerIncomingS…

ParameterTypeDescription
source *stringJavaScript statements. Wrapped as `async function (client, lib) { <source> }`.
noAwaitbooleanFire-and-forget mode. Defaults to false.
sessionstringTarget WaClient session id. Omit to use the default session (MCP_SESSION_ID). Any other id lazily spins up an additional session that shares the same store / auth backend (rows are scoped per session…