Simple MCP Server Example logo

Simple MCP Server Example

by dabouelhassan

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.

View on GitHub

Last updated: N/A

What is Simple MCP Server Example?

This is a basic MCP server implemented using FastAPI that provides a context service.

How to use Simple MCP Server Example?

  1. Install dependencies using pip install -r requirements.txt. 2. Run the server using uvicorn src.main:app --reload. 3. Use the /context endpoint to get context for a prompt by sending a POST request with a JSON payload containing prompt_id and parameters.

Key features of Simple MCP Server Example

  • Basic health check endpoint

  • Context endpoint that processes prompt templates

  • Support for parameterized prompts

Use cases of Simple MCP Server Example

  • Providing context to language models

  • Personalizing responses based on user data

  • Integrating with other services to enrich context

FAQ from Simple MCP Server Example

What is MCP?

Model Context Protocol

What is FastAPI?

A modern, fast (high-performance), web framework for building APIs with Python

How do I install the dependencies?

Run pip install -r requirements.txt

How do I run the server?

Run uvicorn src.main:app --reload

What is the purpose of the /context endpoint?

It provides context for a prompt based on the provided parameters.