How to Use the Hugging Face MCP in LangChain
Wire Hugging Face directly into your LangChain agents. Build multi-step ReAct pipelines that search models, inspect files, and track datasets.
Works with every AI agent you already use
…and any MCP-compatible client
Connect Hugging Face MCP to LangChain
Create your Vinkius account to connect Hugging Face 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 Hugging Face searches with this MCP Server
LangChain agents execute multi-step logic. You don't just query Hugging Face once. Your ReAct agent calls `list_models` via this MCP integration to find text-generation artifacts, then loops through the results using `get_model_tags` to filter out incompatible frameworks. That output feeds directly into the next chain link. The agent isolates the exact model ID and pipes it into `get_model` to pull author details and download counts. LangSmith tracks every token and API call across the entire sequence.
Inspect datasets before downloading
Blindly downloading massive datasets breaks pipelines. LangChain intercepts this problem by giving your agent the `list_datasets` tool to search for specific data structures. Once the agent finds a match, it doesn't just guess the format. It fires `list_dataset_files` to read the repository directory tree. The agent checks if the data lives in parquet files or raw CSVs before writing a single line of local extraction code. You get the exact file path without wasting bandwidth.
Automate model evaluations and bug reports
Models fail in production. When your LangChain evaluation pipeline detects a hallucination, it can automatically check if others hit the same wall. The agent runs `list_model_discussions` to scan the Hub for open bug reports on that specific model ID. If the issue is new, the agent takes action. It uses `create_discussion` to open a fresh thread on the repository, logging the failure trace directly to the author's page. You automate the entire feedback loop from error to open ticket.
Set up Hugging Face 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 Hugging Face 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({
"hugging-face-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 Hugging Face 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 Hugging Face. 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 Hugging Face MCP in LangChain
Use it with your favorite AI tools
Connect this server to Cursor, Claude, VS Code, and more.
Start using the Hugging Face MCP today
We host it, we monitor it, we maintain it. You just paste one token.