Context
When setting up evaluations using MCP Servers in LangChain, users may notice that while OpenAI models appear to have explicit support, it's less clear how to configure and use Anthropic models with MCP Servers.
Answer
Yes, you can use Anthropic models with MCP Servers in LangChain. This is possible through LangChain's MCP adapters package, which converts an MCP server into a LangChain tool that works with any chat model from the OSS integration packages, including both ChatOpenAI and ChatAnthropic.
To implement this solution:
Use LangChain open source
Install the appropriate MCP adapters package for your programming language:
Python: Use the package from GitHub repository
JavaScript: Install via npm using @langchain/mcp-adapters
Configure your MCP server using the adapters package
Use the ChatAnthropic class from the OSS integration packages with your MCP server setup