# MCP Server using FastMCP
A basic Model Context Protocol (MCP) server implementation using FastMCP, designed for integration with Cline.
## Overview
This project provides a simple MCP server that demonstrates how to create tools and expose them through the MCP protocol. It's designed to be integrated with Cline for AI-assisted development workflows.
## Features
- **Tool Definitions**: Example tools for greeting, calculations, and server information
- **FastMCP Framework**: Built on the FastMCP library for simplified MCP server development
- **Cline Integration**: Ready to integrate with Cline for AI assistant capabilities
- **Async Support**: Full async/await support for non-blocking operations
## Project Structure
```
mcp_server_using_fastmcp/
├── mcp_server/
│ ├── __init__.py # Package initialization
│ └── server.py # Main server implementation
├── pyproject.toml # Project configuration
├── README.md # This file
└── .github/
└── copilot-instructions.md # Copilot instructions
```
## Installation
1. Install dependencies:
```bash
pip install -e .
```
2. For development with additional tools:
```bash
pip install -e ".[dev]"
```
## Available Tools
### 1. `get_greeting`
Get a greeting message.
- **Input**: `name` (string) - The name to greet
- **Output**: Greeting message
### 2. `calculate_sum`
Calculate the sum of two numbers.
- **Input**: `a` (float), `b` (float)
- **Output**: Sum result
### 3. `get_server_info`
Get information about the MCP server.
- **Output**: Server information dictionary
## Running the Server
```bash
python -m mcp_server.server
```
Or directly:
```bash
python mcp_server/server.py
```
## Integrating with Cline
To integrate this MCP server with Cline:
1. Ensure the server is installed and can be run
2. Configure Cline to connect to this MCP server using the appropriate endpoint
3. The available tools will be accessible within Cline's context
## Development
### Running Tests
```bash
pytest
```
### Code Formatting
```bash
black mcp_server/
```
### Linting
```bash
flake8 mcp_server/
```
## MCP Protocol
This server implements the Model Context Protocol, which allows AI assistants and other tools to:
- Discover available tools and their parameters
- Call tools with structured arguments
- Receive structured responses
## Adding New Tools
To add a new tool to the server, add a new function decorated with `@server.call_tool()`:
```python
@server.call_tool()
def my_tool(param1: str, param2: int) -> str:
"""
Tool description.
Args:
param1: Parameter description
param2: Parameter description
Returns:
Return value description
"""
# Implementation
return result
```
## License
MIT
## Contributing
Feel free to extend this server with additional tools and capabilities as needed.
#run this command to start the mcp server
```
python -m mcp_server.server
```
#use this cline configuration of MCP server
```
{
"mcpServers": {
"mcp-server-fastmcp": {
"command": "python",
"args": ["-m", "mcp_server.server"],
"cwd": "c:\\Ratnesh\\Dev\\third_mcp_server_using_fastmcp"
}
}
}
```