RIKTESH89/Sustainable-path-mcp-server
If you are the rightful owner of Sustainable-path-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.
A Model Context Protocol (MCP) server implementation for sustainable travel route planning and environmental impact analysis.
Sustainable Travel AI Agent - MCP Server
A Model Context Protocol (MCP) server implementation for sustainable travel route planning and environmental impact analysis. This server provides AI agents with tools to calculate eco-friendly travel routes, carbon footprints, cost savings, and health benefits.
Features
π± Core Capabilities
- Sustainable Route Planning: Mixed-mode transportation combining walking and public transit
- Carbon Footprint Analysis: Real-time CO2 emissions calculation for different transport modes
- Cost-Benefit Analysis: Compare costs between sustainable and conventional transport
- Health Impact Tracking: Calculate calories burned, steps walked, and health benefits
- Personalized Recommendations: Transport suggestions based on user preferences and constraints
π MCP Tools Available
calculate_sustainable_route
- Generate eco-friendly multi-modal routescalculate_carbon_footprint
- Analyze environmental impact by transport modecalculate_health_benefits
- Track fitness and wellness benefitsget_transport_recommendations
- Get personalized transport suggestions
π MCP Resources
sustainable-travel-guide
- Comprehensive sustainable travel practices guidecarbon-calculator-data
- Emission factors and calculation methodology
Architecture
The server implements the architecture described in the project requirements:
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β User Client βββββΆβ MCP Server βββββΆβ Calculation β
β (AI Agent) β β (SSE Transport) β β Engine β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β
βΌ
ββββββββββββββββββββ
β Route & Impact β
β Analysis β
ββββββββββββββββββββ
Installation
Prerequisites
- Python 3.10 or higher
- Virtual environment (recommended)
Setup
-
Clone or download the project:
cd sustainableAI
-
Activate the virtual environment:
# Windows .venv\Scripts\activate # Linux/Mac source .venv/bin/activate
-
Install dependencies:
pip install -r requirements.txt
Usage
Starting the Server
Development Mode (with auto-reload)
python server.py
Production Mode
uvicorn server:app --host 0.0.0.0 --port 8000
Using MCP CLI (recommended for development)
mcp dev server.py
Server Configuration
The server runs on http://localhost:8000
by default with SSE (Server-Sent Events) transport.
Environment Variables:
MCP_SERVER_PORT
: Server port (default: 8000)MCP_TRANSPORT_TYPE
: Transport type -sse
(default) orstreamable_http
Example Usage
1. Calculate Sustainable Route
# Tool call example
result = calculate_sustainable_route(
origin_lat=28.6139,
origin_lon=77.2090,
origin_address="India Gate, New Delhi",
dest_lat=28.5355,
dest_lon=77.3910,
dest_address="Noida Sector 62",
user_weight_kg=70.0,
car_fuel_efficiency=15.0,
fuel_price_per_liter=100.0
)
Response:
{
"success": true,
"route": {
"segments": [
{
"mode": "walking",
"distance_km": 1.0,
"duration_minutes": 12.0,
"cost_inr": 0.0,
"carbon_emissions_kg": 0.0,
"description": "Walk 1.0 km from India Gate, New Delhi"
},
{
"mode": "metro",
"distance_km": 23.5,
"duration_minutes": 56.4,
"cost_inr": 70.5,
"carbon_emissions_kg": 0.964,
"description": "Take metro for 23.5 km"
}
],
"total_distance_km": 24.5,
"total_duration_minutes": 68.4,
"total_cost_inr": 70.5,
"steps_walked": 1300,
"calories_burned": 70.0,
"money_saved_vs_car": 125.5,
"carbon_saved_vs_car": 4.181
}
}
2. Get Transport Recommendations
recommendations = get_transport_recommendations(
distance_km=5.0,
time_available_minutes=60.0,
budget_inr=50.0,
prioritize="environment"
)
3. Calculate Carbon Footprint
footprint = calculate_carbon_footprint(
transport_mode="bus",
distance_km=10.0
)
Integration with AI Agents
Claude Desktop Integration
Add to your Claude Desktop configuration:
{
"mcpServers": {
"sustainable-travel": {
"command": "python",
"args": ["path/to/sustainableAI/server.py"],
"env": {
"MCP_TRANSPORT_TYPE": "sse"
}
}
}
}
Custom MCP Client
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client
async def use_sustainable_travel_agent():
server_params = StdioServerParameters(
command="python",
args=["server.py"]
)
async with stdio_client(server_params) as (read, write):
async with ClientSession(read, write) as session:
# Initialize the session
await session.initialize()
# Call tools
result = await session.call_tool(
"calculate_sustainable_route",
{
"origin_lat": 28.6139,
"origin_lon": 77.2090,
"origin_address": "India Gate",
"dest_lat": 28.5355,
"dest_lon": 77.3910,
"dest_address": "Noida"
}
)
print(result)
API Reference
Tools
calculate_sustainable_route
Calculates an eco-friendly multi-modal route between two points.
Parameters:
origin_lat
(float): Origin latitudeorigin_lon
(float): Origin longitudeorigin_address
(str): Origin address descriptiondest_lat
(float): Destination latitudedest_lon
(float): Destination longitudedest_address
(str): Destination address descriptionuser_weight_kg
(float, optional): User weight for calorie calculation (default: 70.0)car_fuel_efficiency
(float, optional): Car fuel efficiency in km/L (default: 15.0)fuel_price_per_liter
(float, optional): Fuel price in INR/L (default: 100.0)
calculate_carbon_footprint
Analyzes carbon emissions for a specific transport mode and distance.
Parameters:
transport_mode
(str): Transport mode ('walking', 'bus', 'metro', 'car')distance_km
(float): Distance in kilometers
calculate_health_benefits
Calculates health benefits from walking.
Parameters:
walking_distance_km
(float): Walking distance in kilometersuser_weight_kg
(float, optional): User weight in kg (default: 70.0)
get_transport_recommendations
Provides personalized transport recommendations based on constraints.
Parameters:
distance_km
(float): Journey distancetime_available_minutes
(float): Available time for journeybudget_inr
(float): Budget in INRprioritize
(str, optional): Priority ('environment', 'cost', 'time', 'health')
Resources
sustainable-travel-guide
Comprehensive guide for sustainable travel practices including transport mode comparisons and tips.
carbon-calculator-data
JSON data containing emission factors, calculation methodology, and environmental context.
Emission Factors
Transport Mode | CO2 Emissions (kg/km) | Cost (INR/km) | Speed (km/h) |
---|---|---|---|
Walking | 0.000 | 0.00 | 5 |
Bus | 0.089 | 2.00 | 25 |
Metro | 0.041 | 3.00 | 25 |
Car | 0.210 | 8.00 | 30 |
Development
Running Tests
# Install test dependencies
pip install pytest pytest-asyncio
# Run tests
pytest tests/
Code Structure
sustainableAI/
βββ server.py # Main MCP server implementation
βββ requirements.txt # Python dependencies
βββ README.md # This file
βββ .venv/ # Virtual environment
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Submit a pull request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
For issues and questions:
- Check the MCP Documentation
- Review the Python SDK Examples
- Open an issue in this repository
Acknowledgments
- Built with the Model Context Protocol Python SDK
- Emission factors based on IPCC Guidelines
- Inspired by sustainable transportation initiatives worldwide