KosmoKrator

communication

Mailgun MCP Integration for LangChain

Connect Mailgun to LangChain through the local KosmoKrator MCP gateway with scoped tools, credentials, and write policy.

7 functions 6 read 1 write API key auth

Connect Mailgun to LangChain

Bridge LangChain agents to local KosmoKrator integration tools through MCP or headless CLI calls.

Use the MCP gateway when the agent should discover tools, or wrap kosmo integrations:call for fixed chains. The gateway is local, scoped to this integration, and starts with --write=deny so LangChain can inspect read-capable tools without receiving write access by default.

Mailgun MCP Config for LangChain

Keep the gateway scoped to the integration and operation class needed by the chain.

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

Run the Gateway Manually

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

Why Use KosmoKrator Here

Scoped tools

Expose only Mailgun 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.

Mailgun Tools Visible to LangChain

LangChain sees stable MCP tool names generated from the Mailgun integration catalog.

MCP toolSource functionTypeDescription
integration__mailgun__mailgun_get_current_user mailgun.mailgun_get_current_user Read Verify the Mailgun API connection and retrieve basic account info by listing domains.
integration__mailgun__mailgun_get_domain mailgun.mailgun_get_domain Read Get details and DNS records for a specific Mailgun domain.
integration__mailgun__mailgun_list_domains mailgun.mailgun_list_domains Read List all domains in your Mailgun account with optional pagination.
integration__mailgun__mailgun_list_messages mailgun.mailgun_list_messages Read List message events in your Mailgun domain with optional filtering and pagination.
integration__mailgun__mailgun_list_routes mailgun.mailgun_list_routes Read List all routes in your Mailgun account with optional pagination.
integration__mailgun__mailgun_list_webhooks mailgun.mailgun_list_webhooks Read List all webhooks configured for a Mailgun domain.
integration__mailgun__mailgun_send_email mailgun.mailgun_send_email Write Send an email via Mailgun. Specify from, to, subject, and text or HTML content.

Related Mailgun Pages