KosmoKrator

communication

Matrix MCP Integration for Vercel AI SDK

Connect Matrix to Vercel AI SDK through the local KosmoKrator MCP gateway with scoped tools, credentials, and write policy.

7 functions 5 read 2 write Bearer token auth

Connect Matrix to Vercel AI SDK

Use KosmoKrator as a local integration gateway for Vercel AI SDK agents and scripts.

Create an MCP client that starts or connects to the KosmoKrator gateway for the selected integration. The gateway is local, scoped to this integration, and starts with --write=deny so Vercel AI SDK can inspect read-capable tools without receiving write access by default.

Matrix MCP Config for Vercel AI SDK

Prefer CLI JSON calls when a workflow only needs one deterministic integration operation.

{
  "mcpServers": {
    "kosmokrator-matrix": {
      "type": "stdio",
      "command": "kosmo",
      "args": [
        "mcp:serve",
        "--integration=matrix",
        "--write=deny"
      ]
    }
  }
}

Run the Gateway Manually

kosmokrator mcp:serve --integration=matrix --write=deny

Why Use KosmoKrator Here

Scoped tools

Expose only Matrix instead of a broad multi-service tool list.

Local credentials

Reuse credentials already configured for the KosmoKrator CLI and Lua runtime.

Write policy

Start read-only, then opt into ask or allow for trusted workspaces.

Matrix Tools Visible to Vercel AI SDK

Vercel AI SDK sees stable MCP tool names generated from the Matrix integration catalog.

MCP toolSource functionTypeDescription
integration__matrix__matrix_list_rooms matrix.matrix_list_rooms Read List rooms the authenticated user has joined on Matrix. Returns room IDs, names, and aliases.
integration__matrix__matrix_get_room matrix.matrix_get_room Read Get details of a specific Matrix room, including name, topic, members, and aliases.
integration__matrix__matrix_create_room matrix.matrix_create_room Write Create a new room on the Matrix homeserver. Returns the newly created room ID.
integration__matrix__matrix_send_message matrix.matrix_send_message Write Send a text message to a Matrix room. Uses a unique transaction ID to prevent duplicate messages.
integration__matrix__matrix_list_members matrix.matrix_list_members Read List members of a Matrix room. Returns user IDs, display names, and avatar URLs.
integration__matrix__matrix_get_profile matrix.matrix_get_profile Read Get a Matrix user's profile information, including display name and avatar URL.
integration__matrix__matrix_get_current_user matrix.matrix_get_current_user Read Get the currently authenticated Matrix user's information, including user ID and device ID.

Related Matrix Pages