MCP ExplorerExplorer

Mcp Demo Project

@secretstar919on 11 days ago
2 MIT
FreeCommunity
AI Systems
MCP_Demo_Project showcases MCP with a FastMCP server and client, featuring tools like a calculator and team info retrieval.

Overview

What is Mcp Demo Project

MCP_Demo_Project is a demonstration project that showcases the usage of the Model Control Protocol (MCP) with a FastMCP server and client implementation. It includes a simple server with various tools and resources, along with a client that demonstrates interaction with the server.

Use cases

Use cases for MCP_Demo_Project include performing basic arithmetic operations, retrieving team information for project management, generating personalized greetings, and creating formatted prompts for code reviews.

How to use

To use MCP_Demo_Project, clone the repository and install the required dependencies using pip. Start the server by running ‘python server.py’ and then run the client with ‘python client.py’ to interact with the server and utilize its tools.

Key features

Key features of MCP_Demo_Project include a FastMCP server implementation, example tools such as a calculator function, team information retrieval, a dynamic greeting resource, and a code review prompt template. The client implementation demonstrates how to call these tools.

Where to use

MCP_Demo_Project can be used in software development environments, educational settings for teaching programming concepts, and as a prototype for applications that require server-client architecture using MCP.

Content

MCP Demo Project

This is a demonstration project showcasing the usage of MCP (Model Control Protocol) with a FastMCP server and client implementation. The project includes a simple server with various tools and resources, along with a client that demonstrates how to interact with the server.

Features

  • FastMCP server implementation with multiple tools and resources
  • Example tools including:
    • Calculator function (add two numbers)
    • Team information retrieval
    • Dynamic greeting resource
    • Code review prompt template
  • Client implementation demonstrating tool calls

Prerequisites

  • Python 3.x
  • pip (Python package installer)

Installation

  1. Clone this repository
  2. Install the required dependencies:
pip install -r requirements.txt

Project Structure

  • server.py: Contains the FastMCP server implementation with various tools and resources
  • client.py: Demonstrates how to connect to and interact with the MCP server
  • requirements.txt: Lists the project dependencies

Usage

Running the Server

To start the MCP server:

python server.py

Running the Client

To run the client and interact with the server:

python client.py

The client demonstrates how to:

  • Connect to the MCP server
  • Initialize a session
  • Call tools (e.g., the add function)

Available Tools

  1. Add Tool

    • Function: Adds two numbers
    • Parameters: a (int), b (int)
    • Returns: Sum of the numbers
  2. Team Info Tool

    • Function: Retrieves information about a team
    • Parameters: teamname (str)
    • Returns: Team information
  3. Greeting Resource

    • Resource: greeting://{name}
    • Returns: Personalized greeting for the given name
  4. Code Review Prompt

    • Function: Generates a code review prompt
    • Parameters: code (str)
    • Returns: Formatted code review prompt

Sample Results with Claude App

Below are sample results demonstrating how to use this project with the Claude app:

1. MCP Server Configuration in Claude

This image shows how to configure your local MCP server in the Claude app by editing the claude_desktop_config.json file:

MCP Server Configuration

2. Selecting the MCP Server in Claude

This image demonstrates selecting your configured MCP server from the Claude app interface:

Select MCP Server

3. Using the get_teaminfo Tool in Claude

This image shows a sample interaction with the get_teaminfo tool, where the Claude app queries information about a team and displays a formatted response:

Sample get_teaminfo Result


Note: Place the images in an images folder at the root of your project and name them as follows:

  • claude_config.png
  • claude_select_server.png
  • claude_teaminfo_result.png

License

This project is open source and available under the MIT License.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Tools

No tools

Comments