drio
Open app

Simple MCP Server Example

Source

A simple example of a Model Context Protocol Server implementation

Catalog onlyCatalog onlySTDIO

Overview

This project is a basic implementation of a Model Context Protocol (MCP) server using FastAPI, which demonstrates key concepts of MCP by providing a simple context service.

To use this server, first install the required dependencies and then run the server. You can make requests to the server to interact with its endpoints.

  • Provides a basic health check endpoint - Includes a context endpoint that processes prompt templates - Supports parameterized prompts for dynamic responses
  1. Building a context service for chatbots
  2. Implementing personalized prompt responses in applications
  3. Rapid prototyping of projects that require context-based interactions

Add to your AI client

Use these steps to connect Simple MCP Server Example in Cursor, Claude, VS Code, and other MCP-compatible apps. The same JSON appears in the Use with menu above for one-click copy.

Cursor

Add this to your .cursor/mcp.json file in your project root, then restart Cursor.

.cursor/mcp.json

{
  "mcpServers": {
    "mcp-server-example-v2-dabouelhassan": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-mcp-server-example-v2-dabouelhassan"
      ]
    }
  }
}

Claude Desktop

Add this server entry to the mcpServers object in your Claude Desktop config, then restart the app.

~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)

{
  "mcpServers": {
    "mcp-server-example-v2-dabouelhassan": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-mcp-server-example-v2-dabouelhassan"
      ]
    }
  }
}

Claude Code

Add this to your project's .mcp.json file. Claude Code will detect it automatically.

.mcp.json (project root)

{
  "mcpServers": {
    "mcp-server-example-v2-dabouelhassan": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-mcp-server-example-v2-dabouelhassan"
      ]
    }
  }
}

VS Code (Copilot)

Add this to your .vscode/mcp.json file. Requires the GitHub Copilot extension with MCP support enabled.

.vscode/mcp.json

{
  "servers": {
    "mcp-server-example-v2-dabouelhassan": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-mcp-server-example-v2-dabouelhassan"
      ]
    }
  }
}

Windsurf

Add this to your Windsurf MCP config file, then restart Windsurf.

~/.codeium/windsurf/mcp_config.json

{
  "mcpServers": {
    "mcp-server-example-v2-dabouelhassan": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-mcp-server-example-v2-dabouelhassan"
      ]
    }
  }
}

Cline

Open Cline settings, navigate to MCP Servers, and add this server configuration.

Cline MCP Settings (via UI)

{
  "mcpServers": {
    "mcp-server-example-v2-dabouelhassan": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-mcp-server-example-v2-dabouelhassan"
      ]
    }
  }
}

FAQ

What is the purpose of the health check endpoint?

The health check endpoint allows users to verify that the server is running correctly.

Can I modify the prompt templates?

Yes! You can customize the prompt templates used in the requests sent to the context endpoint.

Is this server suitable for production?

This is a basic implementation aimed at demonstration; further enhancements and security measures would be needed for production use.