Yash404007/MCP-server
3.1
If you are the rightful owner of MCP-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
This repository provides a basic setup for an MCP (Modular Command Platform) server using Python and the `fastmcp` package.
Tools
1
Resources
0
Prompts
0
🧠 MCP Server - Python Setup
This repository contains a basic setup for an MCP (Modular Command Platform) server using Python and the fastmcp package.
📁 Project Structure
mcp-server/ ├── server.py ├── requirements.txt └── README.md
yaml Copy Edit
🚀 Getting Started
✅ Prerequisites
- Python 3.8 or higher
- pip (Python package manager)
📦 Installation
- Clone the repository:
git clone https://github.com/your-username/mcp-server.git
cd mcp-server
Install dependencies:
bash
Copy
Edit
pip install fastmcp
Or, if using a requirements.txt:
bash
Copy
Edit
pip install -r requirements.txt
🛠️ Usage
Example server.py:
python
Copy
Edit
from mcp.server.fastmcp import FastMCP
# Create MCP server instance
mcp = FastMCP("Demo")
# Define a tool
@mcp.tool()
def add(a: int, b: int) -> int:
"""Add two numbers"""
return a + b
# Define a resource
@mcp.resource("greeting://{name}")
def get_greeting(name: str) -> str:
"""Returns a greeting message"""
return f"Hello, {name}!"
# Run the server
if __name__ == "__main__":
mcp.run()
▶️ Run the Server
To start the MCP server:
bash
Copy
Edit
python server.py
🌐 Access
Once the server is running:
Call the tool via MCP interface or API: add(a=5, b=7) → returns 12
Access resource like: greeting://Alice → returns "Hello, Alice!"
💡 Future Ideas
Add multiple tools (math, string utils, etc.)
Connect to a frontend
Add authentication or logging
👤 Author
Yash Surve