botextractai/ai-mcp-server-client-fastmcp
If you are the rightful owner of ai-mcp-server-client-fastmcp 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 document provides a structured summary of a Model Context Protocol (MCP) server using FastMCP and LangChain.
The Model Context Protocol (MCP) server, implemented using FastMCP, is designed to facilitate seamless communication between clients and servers in the context of large language models (LLMs). FastMCP simplifies the setup of MCP servers by reducing the need for extensive boilerplate code and configuration. In this example, a local MCP server is created, and a LangChain Artificial Intelligence agent is used to interact with the server. The agent utilizes tools defined in the MCP server to gather and process information. The server-client communication is achieved through Python's standard input/output streams, while external servers would require alternative transport methods like Server-Sent Events (SSE) or WebSockets. The integration with YFinance allows the server to access financial data without the need for an API key, making it a versatile tool for financial queries. The example demonstrates the server's capability to answer complex questions about stock market data by leveraging the tools available in the MCP server.
Features
- Simplified MCP server setup with FastMCP
- Integration with LangChain AI agent
- Support for local and external server communication
- Access to financial data via YFinance
- Asynchronous function support with asyncio
Usages
usage with local stdio
python mcp.run(transport='stdio') # Tools defined via @mcp.tool() decorator
usage with remote sse
python mcp.run(transport='sse', host="0.0.0.0", port=8000) # Specify SSE endpoint
usage with remote streamable http
yaml paths: /mcp: post: x-ms-agentic-protocol: mcp-streamable-1.0 # Copilot Studio integration
usage with fastmcp
python from mcp.server import FastMCP app = FastMCP('demo') @app.tool() async def query(): ...
Tools
YFinance
Provides stock market tools for accessing financial data from Yahoo Finance.