simple_mcp_server

by natapone

393 downloads
Not rated
GitHub

About

simplemcpserver is a simple custom component for Langflow that provides datetime-related tools with timezone support. It allows users to get the current date, time, and week number in any IANA timezone.

Details

Author
natapone
Downloads
393
Categories
Other

- Get current date and time with timezone support
- Get current week number with timezone support
- Simple error handling for invalid timezones
- Supports all IANA Time Zone Database timezones
- Minimal dependencies (pytz and built-in datetime)

Copy the contents of langflow_component.py, open Langflow, click "+ Custom Component", paste the code into the editor, and click "Check & Save". Then instantiate DateTimeTools() and call get_current_datetime(timezone) or get_week_number(timezone) with a valid timezone identifier.

DateTime Tools for Langflow

A simple custom component for Langflow that provides datetime-related tools with timezone support.

Features

- Get current date and time with timezone support
- Get current week number with timezone support
- Simple error handling for invalid timezones

Installation

1. Copy the contents of langflow_component.py
2. Open Langflow
3. Click "+ Custom Component"
4. Paste the code into the editor
5. Click "Check & Save"

Usage

Get Current DateTime

datetime_tools = DateTimeTools()
current_time = datetime_tools.get_current_datetime("America/New_York")

Returns: "2024-03-20T10:30:00-04:00"

Get Week Number

datetime_tools = DateTimeTools()
week_num = datetime_tools.get_week_number("America/New_York")

Returns: 12

Timezone Support

The component supports all timezones available in the IANA Time Zone Database. Common timezone identifiers include:

- UTC
- America/New_York
- America/Los_Angeles
- Europe/London
- Asia/Tokyo
- Australia/Sydney

For a complete list of supported timezones, refer to the IANA Time Zone Database.

Error Handling

- Invalid timezones will return an error message
- Week number will return -1 for invalid timezones or errors

Dependencies

The component requires the following Python packages:
- pytz
- datetime (built-in)

Make sure these are installed in your Langflow environment.

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.