sse-mcp-and-langchain-client-example

sse-mcp-and-langchain-client-example

3.3

If you are the rightful owner of sse-mcp-and-langchain-client-example and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

This project demonstrates how to expose FastAPI endpoints as Model Context Protocol (MCP) tools using `fastapi-mcp`, and includes a LangChain client that connects to the FastAPI server.

The FastAPI MCP Server + LangChain Client Example is a project designed to showcase the integration of FastAPI with the Model Context Protocol (MCP) using the `fastapi-mcp` library. It provides a practical example of how to expose FastAPI endpoints as MCP tools and connect them with a LangChain agent client. The project includes a basic FastAPI application, a LangChain client that connects to the server via HTTP/SSE, and demonstrates the use of MCP tools. The setup involves creating a virtual environment, installing necessary dependencies, and running both the server and client. Additionally, the project supports testing with the MCP Inspector tool and provides insights into authentication, tool naming, and deployment strategies.

Features

  • FastAPI Integration: Exposes FastAPI endpoints as MCP tools using `fastapi-mcp`.
  • LangChain Client: Connects to the FastAPI server and uses MCP tools via HTTP/SSE.
  • Environment Setup: Utilizes `uv` for package management and virtual environment creation.
  • MCP Inspector: Supports testing with the official MCP Inspector tool.
  • Authentication Support: Includes basic token passthrough and OAuth 2 support.

Tools

  1. read_root__get

    Returns a welcome message from the FastAPI server.

  2. greet_user_greet__name__get

    Returns a personalized greeting for the specified user.