MCP ExplorerExplorer

Mcp Server Example V2

@dabouelhassanon a year ago
2 MIT
FreeCommunity
AI Systems
A simple example of a Model Context Protocol Server implementation

Overview

What is Mcp Server Example V2

mcp-server-example-v2 is a basic implementation of a Model Context Protocol (MCP) server built using FastAPI. It serves as a demonstration of core MCP concepts by providing a simple context service.

Use cases

Use cases include generating context-aware responses in chat applications, providing personalized interactions in virtual assistants, and enabling dynamic content generation based on user inputs.

How to use

To use mcp-server-example-v2, install the required dependencies using ‘pip install -r requirements.txt’, then run the server with ‘uvicorn src.main:app --reload’. You can interact with the server via two endpoints: a health check endpoint and a context endpoint for processing prompts.

Key features

Key features include a basic health check endpoint, a context endpoint that processes prompt templates, and support for parameterized prompts.

Where to use

mcp-server-example-v2 can be used in applications that require context management for prompts, such as chatbots, virtual assistants, and other interactive systems that utilize dynamic responses.

Content

Simple MCP Server Example

This is a basic implementation of a Model Context Protocol (MCP) server using FastAPI. The server demonstrates the core concepts of MCP by providing a simple context service.

Features

  • Basic health check endpoint
  • Context endpoint that processes prompt templates
  • Support for parameterized prompts

Setup

  1. Install dependencies:

    pip install -r requirements.txt
    
  2. Run the server:

    uvicorn src.main:app --reload
    

Usage

The server provides two endpoints:

  1. GET / - Health check
  2. POST /context - Get context for a prompt

Example request:

curl -X POST http://localhost:8000/context \
  -H "Content-Type: application/json" \
  -d '{"prompt_id": "greeting", "parameters": {"time": "12:00 PM"}}'

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers