mcp-current-time-provider 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 WisTex TechSero Ltd. Co.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,21 @@
1
+ Metadata-Version: 2.4
2
+ Name: mcp-current-time-provider
3
+ Version: 1.0.0
4
+ Summary: An MCP server that provides the current datetime.
5
+ License-Expression: MIT
6
+ License-File: LICENSE.md
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: Operating System :: OS Independent
9
+ Requires-Dist: fastmcp
10
+ Requires-Python: >=3.14
11
+ Description-Content-Type: text/markdown
12
+
13
+ # mcp-current-time
14
+
15
+ This is my first mcp module and serves as kind of hello world for me. All it does is allow the model to query the current time with a specified timezone.
16
+ It defaults to Berlin.
17
+
18
+ ## Enter dev environment
19
+
20
+ 1. Install [nix](https://nixos.org/download/)
21
+ 2. Run `nix develop --impure --extra-experimental-features nix-command --extra-experimental-features flakes`
@@ -0,0 +1,9 @@
1
+ # mcp-current-time
2
+
3
+ This is my first mcp module and serves as kind of hello world for me. All it does is allow the model to query the current time with a specified timezone.
4
+ It defaults to Berlin.
5
+
6
+ ## Enter dev environment
7
+
8
+ 1. Install [nix](https://nixos.org/download/)
9
+ 2. Run `nix develop --impure --extra-experimental-features nix-command --extra-experimental-features flakes`
@@ -0,0 +1,17 @@
1
+ [project]
2
+ name = "mcp-current-time-provider"
3
+ version = "1.0.0"
4
+ description = "An MCP server that provides the current datetime."
5
+ requires-python = ">=3.14"
6
+ license = "MIT"
7
+ license-files = ["LICENSE.md"]
8
+ readme = "README.md"
9
+ dependencies = ["fastmcp"]
10
+ classifiers = [
11
+ "Programming Language :: Python :: 3",
12
+ "Operating System :: OS Independent",
13
+ ]
14
+
15
+ [build-system]
16
+ requires = ["uv_build >= 0.12.5, <0.13.0"]
17
+ build-backend = "uv_build"
@@ -0,0 +1,20 @@
1
+ [project]
2
+ name = "mcp-current-time-provider"
3
+ version = "1.0.0"
4
+ description = "An MCP server that provides the current datetime."
5
+ requires-python = ">=3.14"
6
+ license = "MIT"
7
+ license-files = ["LICENSE.md"]
8
+ readme = "README.md"
9
+ dependencies = [
10
+ "fastmcp",
11
+ ]
12
+ classifiers = [
13
+ "Programming Language :: Python :: 3",
14
+ "Operating System :: OS Independent",
15
+ ]
16
+
17
+ [build-system]
18
+ requires = ["uv_build >= 0.12.5, <0.13.0"]
19
+ build-backend = "uv_build"
20
+
@@ -0,0 +1,23 @@
1
+ from datetime import datetime
2
+ from zoneinfo import ZoneInfo, available_timezones
3
+ from fastmcp import FastMCP
4
+
5
+ mcp = FastMCP("Current Time")
6
+
7
+ # Only allow a reasonable set of timezone names.
8
+ ALLOWED_TIMEZONES = frozenset(available_timezones())
9
+
10
+ @mcp.tool()
11
+ def get_current_datetime(timezone: str = "Europe/Berlin") -> str:
12
+ """Return the current date and time for a valid IANA timezone."""
13
+
14
+ if timezone not in ALLOWED_TIMEZONES:
15
+ return f"Invalid timezone: {timezone}"
16
+
17
+ now = datetime.now(ZoneInfo(timezone))
18
+
19
+ return now.isoformat(timespec="seconds")
20
+
21
+ if __name__ == "__main__":
22
+ mcp.run()
23
+