Skip to main content
Glama

MCP Server Streamable

by cpetra

MCP Server Streamable

A Model Context Protocol (MCP) server implementation using FastMCP with streamable HTTP transport.

Overview

This project demonstrates how to create an MCP server that runs over HTTP with streamable transport. The server provides a simple greeting tool that can be called by MCP clients.

Features

  • HTTP Transport: Uses streamable HTTP transport for communication

  • FastMCP Framework: Built with the FastMCP library for easy server development

  • Simple Tool: Includes a greeting tool that takes a name parameter

Prerequisites

  • Python 3.8+

  • uv (recommended for fast package management)

Installation

  1. Clone or navigate to the project directory:

cd d:\work\projects\mcp-servers-course\mcp-server-streamable
  1. Install dependencies using uv:

uv sync

This will automatically create a virtual environment and install all dependencies from the pyproject.toml file.

  1. Activate the virtual environment:

uv run python server.py

Or manually activate:

.venv\Scripts\activate

Usage

Running the Server

Start the MCP server:

python server.py

Or using uv:

uv run python server.py

The server will start on the default port and be accessible via HTTP.

Available Tools

greeting

  • Description: Send a personalized greeting

  • Parameter: name (string) - The name to include in the greeting

  • Returns: A greeting message

Example usage:

# When called with name="Alice" # Returns: "Hi Alice"

Configuration for Claude Desktop

To use this server with Claude Desktop, add the following configuration to your claude_desktop_config.json file:

{ "mcpServers": { "streamable-server": { "command": "python", "args": ["d:\\work\\projects\\mcp-servers-course\\mcp-server-streamable\\server.py"] } } }

Alternatively, if you want to use the remote HTTP endpoint:

{ "mcpServers": { "streamable-server": { "command": "npx", "args": [ "mcp-remote", "http://127.0.0.1:8000/mcp", "--allow-http" ] } } }

Development

Project Structure

mcp-server-streamable/ ├── server.py # Main server implementation ├── README.md # This file └── .venv/ # Virtual environment

Extending the Server

To add new tools, define functions with the @mcp.tool() decorator:

@mcp.tool() def your_tool_name(param: str) -> str: """Tool description""" # Your implementation here return result

Transport Details

This server uses the "streamable-http" transport, which:

  • Provides HTTP-based communication

  • Supports streaming responses

  • Is suitable for web-based integrations

  • Allows for remote access over HTTP

Troubleshooting

  1. Port conflicts: If the default port is in use, the server will indicate this in the logs

  2. Virtual environment: Ensure the virtual environment is activated before running

  3. Dependencies: Make sure all required packages are installed with uv sync

License

This project is part of the MCP servers course and is intended for educational purposes.

-
security - not tested
F
license - not found
-
quality - not tested

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

A demonstration MCP server that runs over HTTP with streamable transport, providing a simple greeting tool for testing MCP client-server communication. Built with FastMCP framework for educational purposes in learning MCP server development.

  1. Overview
    1. Features
      1. Prerequisites
        1. Installation
          1. Usage
            1. Running the Server
            2. Available Tools
          2. Configuration for Claude Desktop
            1. Development
              1. Project Structure
              2. Extending the Server
            2. Transport Details
              1. Troubleshooting
                1. License

                  MCP directory API

                  We provide all the information about MCP servers via our MCP API.

                  curl -X GET 'https://glama.ai/api/mcp/v1/servers/cpetra/mcpservertest'

                  If you have feedback or need assistance with the MCP directory API, please join our Discord server