Skip to main content

How to Use MCP Tools with LangChain Agents

This document provides a developer-focused guide on how to integrate Vinci’s MCP server with your own LangChain agent. It’s structured as a cookbook with recipes to guide you through the implementation.

Overview

This guide shows how you can connect your LangChain agent to Vinci’s MCP (Multi-tool Control Plane) server. This enables your agent to dynamically discover and utilize our powerful external tools, extending its capabilities beyond simple chat.

Prerequisites

Before you begin, make sure you have the necessary packages installed.

Configuration

To run the examples in this guide, you need to configure the following environment variables in your .env file.
Use the same Vinci API key for MCP that you use for the public REST API.

Recipes

How to Fetch Tools from the MCP Server

This recipe shows how to connect to Vinci’s MCP server, retrieve the available tools, and print their names and descriptions. This is the foundational step for integrating Vinci’s tools into any LangChain agent. Code:

How to Integrate Tools with a LangChain Agent

Once you can fetch the tools, you can integrate them into a LangChain agent. This example demonstrates how to build an agent that can use the Vinci tools to perform tasks. Code:

Conclusion

By following these recipes, you can seamlessly integrate Vinci’s powerful MCP tools into your own LangChain agents. This allows you to build sophisticated, tool-augmented applications with ease. We encourage you to experiment with the available tools and explore the creative possibilities they unlock.