How to Use the Documint MCP in LangChain
Generate custom PDFs inside your LangChain reasoning loops without manually mapping templates or writing rendering code.
Works with every AI agent you already use
…and any MCP-compatible client
Connect Documint MCP to LangChain
Create your Vinkius account to connect Documint 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.
Multi-Step LangChain Document Pipelines
LangChain agents can now inspect your document layouts before triggering a build. Your agent calls `get_template_configuration` to inspect the schema, runs a quick validation step, and then executes `create_new_generation` to produce the PDF. This turns a multi-step document workflow into an autonomous loop where the model corrects its own inputs. You can track these tool executions directly in LangSmith to watch how your chain handles variables. If a variable is missing, the agent uses `get_template_variable_audit` to identify the gap, fixes the payload, and retries the generation.
Automated Template Selection
Stop hardcoding template IDs in your chain configurations. Your LangChain agent uses `search_documint_templates` to locate the correct invoice or contract template based on user prompts. After finding the right template, the agent grabs the exact schema using `list_documint_templates` to prepare the payload. This dynamic discovery keeps your code clean and your chains flexible. You don't need to rebuild your graph when marketing updates a template in Documint; the agent adapts at runtime.
Real-Time Generation Tracking and Recovery
By exposing these tools through an MCP Server, your agent can pause, verify the document status, and retrieve the download URL. It handles the entire verification step natively without requiring manual polling scripts in your application code. If something breaks during a high-volume run, the agent inspects `list_failed_doc_generations` to isolate the bad payloads. This lets your graph handle failures gracefully by sending the bad inputs back to a correction node instead of crashing the entire chain.
Set up Documint 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 Documint 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({
"documint-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 Documint 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 Documint. 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 Documint MCP in LangChain
Use it with your favorite AI tools
Connect this server to Cursor, Claude, VS Code, and more.
Start using the Documint MCP today
We host it, we monitor it, we maintain it. You just paste one token.