A simple FastMCP server that takes a name as input and provides various name-related operations.
- get_name: Takes a name and returns a greeting message
- print_name: Takes a name and prints it to console
- format_name: Formats a name in different ways (uppercase, lowercase, title, reverse)
- Python 3.8 or higher
- pip (Python package installer)
-
Clone or download this project
-
Navigate to the project directory:
cd fastmcp-name-project -
Install the required dependencies:
pip install -r requirements.txt
To start the FastMCP server:
python server.pyThe server will start and be ready to accept MCP connections.
The server provides three main tools:
- Input:
name(string) - Output: A greeting message with the provided name
- Example: Input "Alice" → Output "Hello, Alice! Nice to meet you."
- Input:
name(string) - Output: Prints the name to console and returns confirmation
- Example: Input "Bob" → Prints "Name received: Bob" and returns "Successfully printed: Bob"
- Input:
name(string) - The name to formatformat_type(string, optional) - Format type: "uppercase", "lowercase", "title", "reverse"
- Output: The formatted name
- Examples:
- Input "john", "uppercase" → Output "JOHN"
- Input "MARY", "lowercase" → Output "mary"
- Input "alice smith", "title" → Output "Alice Smith"
- Input "hello", "reverse" → Output "olleh"
fastmcp-name-project/
├── server.py # Main FastMCP server implementation
├── requirements.txt # Python dependencies
└── README.md # This file
To modify the server:
- Edit
server.pyto add new tools or modify existing ones - Each tool is defined using the
@mcp.tool()decorator - Tools can accept parameters with type hints
- Tools should be async functions that return strings
@mcp.tool()
async def my_tool(input_param: str) -> str:
"""
Description of what the tool does.
Args:
input_param: Description of the parameter
Returns:
Description of the return value
"""
return f"Processed: {input_param}"- Make sure Python 3.8+ is installed
- Ensure all dependencies are installed:
pip install -r requirements.txt - Check that the server starts without errors
- Verify MCP client can connect to the server