How to Use the Correios (Brazil) MCP in LangChain
Build multi-step shipping workflows in LangChain with real-time Correios tracking and price calculations using MCP.
Works with every AI agent you already use
…and any MCP-compatible client
Connect Correios (Brazil) MCP to LangChain
Create your Vinkius account to connect Correios (Brazil) 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 CEP lookups to shipping calculations
`lookup_cep` serves as the entry point for your agent to resolve Brazilian addresses before running shipping logic. Your LangChain agent takes a raw CEP input, retrieves the street address, and immediately feeds those destination coordinates into `calculate_price_deadline` to find shipping rates. This multi-step chain runs programmatically without hardcoded steps. If the rate exceeds a customer's threshold, the agent branches to `list_contract_services` to find cheaper contract-specific postage options.
Track packages in LangChain agent loops (MCP Server)
`track_object` lets your LangChain agent fetch the current delivery status of any Brazilian package during an active execution run. When a customer asks about a delayed order, the agent pulls the tracking code, gets the status, and matches it against your internal database using LangChain's vector store retrievers. You can monitor this entire execution flow inside LangSmith. The platform traces the exact payload sent to the Correios MCP Server, showing you the exact latency of the tracking request and the raw JSON response.
Manage corporate Correios contracts dynamically
`get_contract_status` checks if your active corporate credentials with the Brazilian postal service are valid before executing high-volume label generation. Your LangChain agent verifies this contract state, then uses `list_contract_services` to verify which shipping methods are active for that specific account. This prevents failed API calls down the line when generating bulk shipping quotes. By combining these contract tools with standard LangChain tools, your agent can automatically switch to retail pricing if your corporate contract is temporarily suspended.
Set up Correios (Brazil) 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 Correios (Brazil) 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({
"correios-brazil-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 Correios (Brazil) 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 Correios. 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 Correios (Brazil) MCP in LangChain
Use it with your favorite AI tools
Connect this server to Cursor, Claude, VS Code, and more.
Start using the Correios (Brazil) MCP today
We host it, we monitor it, we maintain it. You just paste one token.