How to Use the Mailosaur MCP in LangChain
Verify transactional emails and SMS flows programmatically inside your LangChain chains without manual inbox checks.
Works with every AI agent you already use
…and any MCP-compatible client
Connect Mailosaur MCP to LangChain
Create your Vinkius account to connect Mailosaur to LangChain and route execution through our secure gateway. The platform manages server hosting, runtime updates, and security layers. Configuration requires no manual server provisioning.
Chain-linked verification with the Mailosaur MCP Server
The `list_virtual_servers` tool is the starting point for identifying the test environments your agent needs to inspect. By feeding the active server IDs straight into the next link of your LangChain pipeline, your agent can dynamically target the correct environment without hardcoded values. You get a direct, observable flow where the output of your server check dictates where the agent looks next. This setup shines when you use `list_server_messages` to pull the latest incoming traffic right after a signup action. LangSmith tracks every step of this execution, showing you the exact latency of the API call and the raw payload returned. No guesswork, just clear tracing of how your chain handles external email data.
Automated message parsing and extraction
The `get_message_content` tool retrieves the full payload of any email or SMS message to let your agent extract verification codes or reset links. Instead of writing complex regex wrappers, you let your ReAct agent analyze the raw HTML or text body directly. It extracts the token, passes it to the next step in your chain, and completes the sign-up flow. If you need to narrow down the noise, `search_server_messages` filters the inbox using your MCP client. This prevents your agent from processing irrelevant messages. It keeps token usage low and avoids wasting API calls on stale test runs.
Ephemeral test environment management
The `create_virtual_server` tool builds isolated, on-demand inboxes for parallel test runs in your CI/CD pipeline. Your agent can spin up a fresh inbox for a specific test suite, run the checks, and then tear it down. This prevents parallel tests from stepping on each other's toes or reading dirty data. Once your tests finish, `clear_server_inbox` wipes the server clean, while `delete_specific_message` targets individual test runs for cleanup. Keeping your test servers clean ensures subsequent runs don't fail due to stale verification emails from previous builds.
Set up Mailosaur MCP in LangChain
Prerequisites
- Python 3.10+ installed
-
langchain-mcp-adapters+langgraphpackages - Active Vinkius subscription with a valid endpoint token
- 1
Install dependencies
Run
pip install langchain-mcp-adapters langgraph langchain-openai. The MCP adapters package converts MCP tools into native LangChainBaseToolobjects. - 2
Connect via HTTP transport
Use
MultiServerMCPClientwith"transport": "http"pointing to your Vinkius endpoint. Replace[YOUR_TOKEN_HERE]with your token from cloud.vinkius.com. - 3
Create a ReAct agent
Pass the discovered tools to
create_react_agent()from LangGraph. The agent automatically routes Mailosaur tool calls through the MCP protocol. - 4
Run with any LLM
Swap
ChatOpenAIforChatAnthropic,ChatGoogleGenerativeAI, or any LangChain-compatible model. The MCP tools work identically across all providers.
from langchain_mcp_adapters.client import MultiServerMCPClient
from langgraph.prebuilt import create_react_agent
from langchain_openai import ChatOpenAI
async with MultiServerMCPClient({
"mailosaur-mcp": {
"transport": "http",
"url": "https://edge.vinkius.com/[YOUR_TOKEN_HERE]/mcp",
}
}) as client:
tools = client.get_tools()
agent = create_react_agent(
ChatOpenAI(model="gpt-4o"),
tools,
)
result = await agent.ainvoke({
"messages": "List recent Mailosaur transactions"
})
print(result["messages"][-1].content) Independent Platform Disclaimer: Vinkius is an independent platform and is not affiliated with, endorsed by, sponsored by, verified by, or otherwise authorized by Mailosaur. All third-party trademarks, logos, and brand names are the property of their respective owners. Their use on this website is strictly for informational purposes to identify service compatibility and interoperability.
Why Choose Vinkius
Vinkius connects your tools to AI with real-time monitoring and automatic cost savings — all from one dashboard.
Real-time monitoring
Live
visibility into every interaction
Connect your favorite tools to your AI and see exactly what's happening — every request, every response, in real time.
Built-in savings
60%
lower AI costs
Vinkius compresses data between your apps and your AI automatically. Lower bills every month — no configuration required.
Single dashboard
One
place for every integration
Every tool your AI connects to, managed from a single screen. One account, complete control.
Common questions about Mailosaur MCP in LangChain
Use it with your favorite AI tools
Connect this server to Cursor, Claude, VS Code, and more.
Start using the Mailosaur MCP today
We host it, we monitor it, we maintain it. You just paste one token.