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