LangChain integration for ClickSend via Model Context Protocol (MCP).
This package provides LangChain tools that wrap the ClickSend MCP Server, enabling you to send SMS, MMS, and other ClickSend communications through LangChain agents.
Installation
npm install @clicksend/langchain-clicksend-mcp
Prerequisites
You need a ClickSend account with API credentials:
Username: Your ClickSend account username
API Key: Your ClickSend API key
Get your credentials from the ClickSend Dashboard.
Available Tools
The integration automatically exposes all tools from the ClickSend MCP server, which typically include:
send_sms: Send SMS messages
send_mms: Send MMS messages
get_sms_history: Retrieve SMS history
get_account_balance: Check account balance
And more...
The exact tools available depend on the ClickSend MCP server version.
Configuration
import { createClickSendTools } from "@clicksend/langchain-clicksend-mcp"; const tools = await createClickSendTools({ username: "your-clicksend-username", apiKey: "your-clicksend-api-key", });
Options
username(required): Your ClickSend account usernameapiKey(required): Your ClickSend API key
Usage
Basic Example
import { createClickSendTools } from "@clicksend/langchain-clicksend-mcp"; import { ChatOpenAI } from "@langchain/openai"; import { createAgent } from "langchain"; import dontenv from "dotenv"; dontenv.config(); let agentInstance: any = null; const tools = await createClickSendTools({ username: process.env.CLICKSEND_USERNAME || "", apiKey: process.env.CLICKSEND_API_KEY || "", }); async function getAgent() { if(!agentInstance) { agentInstance = await createAgent({ model: new ChatOpenAI({ modelName: "gpt-4o-mini", temperature: 0 }), tools, }) } return agentInstance; } export async function runAgent(userMessage: string) { const agent = await getAgent(); const result = await agent.invoke({ messages : [ { role: "user", content : userMessage }, ] }) return result; } const result = await runAgent("send a text message to +1234567890 saying 'Hello from ClickSend via LangChain!'"); console.log(result);
Advanced Usage
Direct MCP Client Access
If you need more control, you can access the underlying MCP client:
import { createClickSendMCPClient } from "@clicksend/langchain-clicksend-mcp"; const client = createClickSendMCPClient({ username: process.env.CLICKSEND_USERNAME!, apiKey: process.env.CLICKSEND_API_KEY!, }); // Get tools const tools = await client.getTools(); // Access the raw MCP client // ... additional MCP operations
FAQS
Does LangChain need a separate host?
Does LangChain need a separate host?
No - LangChain itself is the host. No separate server needed.
How do I install LangChain MCP?
How do I install LangChain MCP?
Install it on your code tool (Eg. Visual Studio code) and follow the LangChain docs here.
Can I connect to any AI model?
Can I connect to any AI model?
Yes - Since ClickSend MCP Server is in Github, you can connect to any AI model of your choice
