mcp-server-time 0.5.1__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.
- mcp_server_time-0.5.1/.gitignore +300 -0
- mcp_server_time-0.5.1/.python-version +1 -0
- mcp_server_time-0.5.1/PKG-INFO +211 -0
- mcp_server_time-0.5.1/README.md +193 -0
- mcp_server_time-0.5.1/pyproject.toml +38 -0
- mcp_server_time-0.5.1/src/mcp_server_time/__init__.py +19 -0
- mcp_server_time-0.5.1/src/mcp_server_time/__main__.py +3 -0
- mcp_server_time-0.5.1/src/mcp_server_time/server.py +201 -0
- mcp_server_time-0.5.1/test/time_server_test.py +460 -0
- mcp_server_time-0.5.1/uv.lock +490 -0
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
# Logs
|
|
2
|
+
logs
|
|
3
|
+
*.log
|
|
4
|
+
npm-debug.log*
|
|
5
|
+
yarn-debug.log*
|
|
6
|
+
yarn-error.log*
|
|
7
|
+
lerna-debug.log*
|
|
8
|
+
.pnpm-debug.log*
|
|
9
|
+
|
|
10
|
+
# Diagnostic reports (https://nodejs.org/api/report.html)
|
|
11
|
+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
|
12
|
+
|
|
13
|
+
# Runtime data
|
|
14
|
+
pids
|
|
15
|
+
*.pid
|
|
16
|
+
*.seed
|
|
17
|
+
*.pid.lock
|
|
18
|
+
|
|
19
|
+
# Directory for instrumented libs generated by jscoverage/JSCover
|
|
20
|
+
lib-cov
|
|
21
|
+
|
|
22
|
+
# Coverage directory used by tools like istanbul
|
|
23
|
+
coverage
|
|
24
|
+
*.lcov
|
|
25
|
+
|
|
26
|
+
# nyc test coverage
|
|
27
|
+
.nyc_output
|
|
28
|
+
|
|
29
|
+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
|
30
|
+
.grunt
|
|
31
|
+
|
|
32
|
+
# Bower dependency directory (https://bower.io/)
|
|
33
|
+
bower_components
|
|
34
|
+
|
|
35
|
+
# node-waf configuration
|
|
36
|
+
.lock-wscript
|
|
37
|
+
|
|
38
|
+
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
|
39
|
+
build/Release
|
|
40
|
+
|
|
41
|
+
# Dependency directories
|
|
42
|
+
node_modules/
|
|
43
|
+
jspm_packages/
|
|
44
|
+
|
|
45
|
+
# Snowpack dependency directory (https://snowpack.dev/)
|
|
46
|
+
web_modules/
|
|
47
|
+
|
|
48
|
+
# TypeScript cache
|
|
49
|
+
*.tsbuildinfo
|
|
50
|
+
|
|
51
|
+
# Optional npm cache directory
|
|
52
|
+
.npm
|
|
53
|
+
|
|
54
|
+
# Optional eslint cache
|
|
55
|
+
.eslintcache
|
|
56
|
+
|
|
57
|
+
# Optional stylelint cache
|
|
58
|
+
.stylelintcache
|
|
59
|
+
|
|
60
|
+
# Microbundle cache
|
|
61
|
+
.rpt2_cache/
|
|
62
|
+
.rts2_cache_cjs/
|
|
63
|
+
.rts2_cache_es/
|
|
64
|
+
.rts2_cache_umd/
|
|
65
|
+
|
|
66
|
+
# Optional REPL history
|
|
67
|
+
.node_repl_history
|
|
68
|
+
|
|
69
|
+
# Output of 'npm pack'
|
|
70
|
+
*.tgz
|
|
71
|
+
|
|
72
|
+
# Yarn Integrity file
|
|
73
|
+
.yarn-integrity
|
|
74
|
+
|
|
75
|
+
# dotenv environment variable files
|
|
76
|
+
.env
|
|
77
|
+
.env.development.local
|
|
78
|
+
.env.test.local
|
|
79
|
+
.env.production.local
|
|
80
|
+
.env.local
|
|
81
|
+
|
|
82
|
+
# parcel-bundler cache (https://parceljs.org/)
|
|
83
|
+
.cache
|
|
84
|
+
.parcel-cache
|
|
85
|
+
|
|
86
|
+
# Next.js build output
|
|
87
|
+
.next
|
|
88
|
+
out
|
|
89
|
+
|
|
90
|
+
# Nuxt.js build / generate output
|
|
91
|
+
.nuxt
|
|
92
|
+
dist
|
|
93
|
+
|
|
94
|
+
# Gatsby files
|
|
95
|
+
.cache/
|
|
96
|
+
# Comment in the public line in if your project uses Gatsby and not Next.js
|
|
97
|
+
# https://nextjs.org/blog/next-9-1#public-directory-support
|
|
98
|
+
# public
|
|
99
|
+
|
|
100
|
+
# vuepress build output
|
|
101
|
+
.vuepress/dist
|
|
102
|
+
|
|
103
|
+
# vuepress v2.x temp and cache directory
|
|
104
|
+
.temp
|
|
105
|
+
.cache
|
|
106
|
+
|
|
107
|
+
# Docusaurus cache and generated files
|
|
108
|
+
.docusaurus
|
|
109
|
+
|
|
110
|
+
# Serverless directories
|
|
111
|
+
.serverless/
|
|
112
|
+
|
|
113
|
+
# FuseBox cache
|
|
114
|
+
.fusebox/
|
|
115
|
+
|
|
116
|
+
# DynamoDB Local files
|
|
117
|
+
.dynamodb/
|
|
118
|
+
|
|
119
|
+
# TernJS port file
|
|
120
|
+
.tern-port
|
|
121
|
+
|
|
122
|
+
# Stores VSCode versions used for testing VSCode extensions
|
|
123
|
+
.vscode-test
|
|
124
|
+
|
|
125
|
+
# yarn v2
|
|
126
|
+
.yarn/cache
|
|
127
|
+
.yarn/unplugged
|
|
128
|
+
.yarn/build-state.yml
|
|
129
|
+
.yarn/install-state.gz
|
|
130
|
+
.pnp.*
|
|
131
|
+
|
|
132
|
+
build/
|
|
133
|
+
|
|
134
|
+
gcp-oauth.keys.json
|
|
135
|
+
.*-server-credentials.json
|
|
136
|
+
|
|
137
|
+
# Byte-compiled / optimized / DLL files
|
|
138
|
+
__pycache__/
|
|
139
|
+
*.py[cod]
|
|
140
|
+
*$py.class
|
|
141
|
+
|
|
142
|
+
# C extensions
|
|
143
|
+
*.so
|
|
144
|
+
|
|
145
|
+
# Distribution / packaging
|
|
146
|
+
.Python
|
|
147
|
+
build/
|
|
148
|
+
develop-eggs/
|
|
149
|
+
dist/
|
|
150
|
+
downloads/
|
|
151
|
+
eggs/
|
|
152
|
+
.eggs/
|
|
153
|
+
lib/
|
|
154
|
+
lib64/
|
|
155
|
+
parts/
|
|
156
|
+
sdist/
|
|
157
|
+
var/
|
|
158
|
+
wheels/
|
|
159
|
+
share/python-wheels/
|
|
160
|
+
*.egg-info/
|
|
161
|
+
.installed.cfg
|
|
162
|
+
*.egg
|
|
163
|
+
MANIFEST
|
|
164
|
+
|
|
165
|
+
# PyInstaller
|
|
166
|
+
# Usually these files are written by a python script from a template
|
|
167
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
168
|
+
*.manifest
|
|
169
|
+
*.spec
|
|
170
|
+
|
|
171
|
+
# Installer logs
|
|
172
|
+
pip-log.txt
|
|
173
|
+
pip-delete-this-directory.txt
|
|
174
|
+
|
|
175
|
+
# Unit test / coverage reports
|
|
176
|
+
htmlcov/
|
|
177
|
+
.tox/
|
|
178
|
+
.nox/
|
|
179
|
+
.coverage
|
|
180
|
+
.coverage.*
|
|
181
|
+
.cache
|
|
182
|
+
nosetests.xml
|
|
183
|
+
coverage.xml
|
|
184
|
+
*.cover
|
|
185
|
+
*.py,cover
|
|
186
|
+
.hypothesis/
|
|
187
|
+
.pytest_cache/
|
|
188
|
+
cover/
|
|
189
|
+
|
|
190
|
+
# Translations
|
|
191
|
+
*.mo
|
|
192
|
+
*.pot
|
|
193
|
+
|
|
194
|
+
# Django stuff:
|
|
195
|
+
*.log
|
|
196
|
+
local_settings.py
|
|
197
|
+
db.sqlite3
|
|
198
|
+
db.sqlite3-journal
|
|
199
|
+
|
|
200
|
+
# Flask stuff:
|
|
201
|
+
instance/
|
|
202
|
+
.webassets-cache
|
|
203
|
+
|
|
204
|
+
# Scrapy stuff:
|
|
205
|
+
.scrapy
|
|
206
|
+
|
|
207
|
+
# Sphinx documentation
|
|
208
|
+
docs/_build/
|
|
209
|
+
|
|
210
|
+
# PyBuilder
|
|
211
|
+
.pybuilder/
|
|
212
|
+
target/
|
|
213
|
+
|
|
214
|
+
# Jupyter Notebook
|
|
215
|
+
.ipynb_checkpoints
|
|
216
|
+
|
|
217
|
+
# IPython
|
|
218
|
+
profile_default/
|
|
219
|
+
ipython_config.py
|
|
220
|
+
|
|
221
|
+
# pyenv
|
|
222
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
223
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
224
|
+
# .python-version
|
|
225
|
+
|
|
226
|
+
# pipenv
|
|
227
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
228
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
229
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
230
|
+
# install all needed dependencies.
|
|
231
|
+
#Pipfile.lock
|
|
232
|
+
|
|
233
|
+
# poetry
|
|
234
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
235
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
236
|
+
# commonly ignored for libraries.
|
|
237
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
238
|
+
#poetry.lock
|
|
239
|
+
|
|
240
|
+
# pdm
|
|
241
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
242
|
+
#pdm.lock
|
|
243
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
244
|
+
# in version control.
|
|
245
|
+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
|
246
|
+
.pdm.toml
|
|
247
|
+
.pdm-python
|
|
248
|
+
.pdm-build/
|
|
249
|
+
|
|
250
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
251
|
+
__pypackages__/
|
|
252
|
+
|
|
253
|
+
# Celery stuff
|
|
254
|
+
celerybeat-schedule
|
|
255
|
+
celerybeat.pid
|
|
256
|
+
|
|
257
|
+
# SageMath parsed files
|
|
258
|
+
*.sage.py
|
|
259
|
+
|
|
260
|
+
# Environments
|
|
261
|
+
.env
|
|
262
|
+
.venv
|
|
263
|
+
env/
|
|
264
|
+
venv/
|
|
265
|
+
ENV/
|
|
266
|
+
env.bak/
|
|
267
|
+
venv.bak/
|
|
268
|
+
|
|
269
|
+
# Spyder project settings
|
|
270
|
+
.spyderproject
|
|
271
|
+
.spyproject
|
|
272
|
+
|
|
273
|
+
# Rope project settings
|
|
274
|
+
.ropeproject
|
|
275
|
+
|
|
276
|
+
# mkdocs documentation
|
|
277
|
+
/site
|
|
278
|
+
|
|
279
|
+
# mypy
|
|
280
|
+
.mypy_cache/
|
|
281
|
+
.dmypy.json
|
|
282
|
+
dmypy.json
|
|
283
|
+
|
|
284
|
+
# Pyre type checker
|
|
285
|
+
.pyre/
|
|
286
|
+
|
|
287
|
+
# pytype static type analyzer
|
|
288
|
+
.pytype/
|
|
289
|
+
|
|
290
|
+
# Cython debug symbols
|
|
291
|
+
cython_debug/
|
|
292
|
+
|
|
293
|
+
.DS_Store
|
|
294
|
+
|
|
295
|
+
# PyCharm
|
|
296
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
297
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
298
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
299
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
300
|
+
#.idea/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.10
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: mcp-server-time
|
|
3
|
+
Version: 0.5.1
|
|
4
|
+
Summary: A Model Context Protocol server providing tools for time queries and timezone conversions for LLMs
|
|
5
|
+
Author-email: Mariusz 'maledorak' Korzekwa <mariusz@korzekwa.dev>
|
|
6
|
+
License: MIT
|
|
7
|
+
Keywords: llm,mcp,time,timezone
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Requires-Python: >=3.10
|
|
14
|
+
Requires-Dist: mcp>=1.0.0
|
|
15
|
+
Requires-Dist: pydantic>=2.0.0
|
|
16
|
+
Requires-Dist: tzdata>=2024.2
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
|
|
19
|
+
# Time MCP Server
|
|
20
|
+
|
|
21
|
+
A Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
|
|
22
|
+
|
|
23
|
+
### Available Tools
|
|
24
|
+
|
|
25
|
+
- `get_current_time` - Get current time in a specific timezone or system timezone.
|
|
26
|
+
- Required arguments:
|
|
27
|
+
- `timezone` (string): IANA timezone name (e.g., 'America/New_York', 'Europe/London')
|
|
28
|
+
|
|
29
|
+
- `convert_time` - Convert time between timezones.
|
|
30
|
+
- Required arguments:
|
|
31
|
+
- `source_timezone` (string): Source IANA timezone name
|
|
32
|
+
- `time` (string): Time in 24-hour format (HH:MM)
|
|
33
|
+
- `target_timezone` (string): Target IANA timezone name
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
### Using uv (recommended)
|
|
38
|
+
|
|
39
|
+
When using [`uv`](https://docs.astral.sh/uv/) no specific installation is needed. We will
|
|
40
|
+
use [`uvx`](https://docs.astral.sh/uv/guides/tools/) to directly run *mcp-server-time*.
|
|
41
|
+
|
|
42
|
+
### Using PIP
|
|
43
|
+
|
|
44
|
+
Alternatively you can install `mcp-server-time` via pip:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pip install mcp-server-time
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
After installation, you can run it as a script using:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
python -m mcp_server_time
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Configuration
|
|
57
|
+
|
|
58
|
+
### Configure for Claude.app
|
|
59
|
+
|
|
60
|
+
Add to your Claude settings:
|
|
61
|
+
|
|
62
|
+
<details>
|
|
63
|
+
<summary>Using uvx</summary>
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
"mcpServers": {
|
|
67
|
+
"time": {
|
|
68
|
+
"command": "uvx",
|
|
69
|
+
"args": ["mcp-server-time"]
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
</details>
|
|
74
|
+
|
|
75
|
+
<details>
|
|
76
|
+
<summary>Using pip installation</summary>
|
|
77
|
+
|
|
78
|
+
```json
|
|
79
|
+
"mcpServers": {
|
|
80
|
+
"time": {
|
|
81
|
+
"command": "python",
|
|
82
|
+
"args": ["-m", "mcp_server_time"]
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
</details>
|
|
87
|
+
|
|
88
|
+
### Configure for Zed
|
|
89
|
+
|
|
90
|
+
Add to your Zed settings.json:
|
|
91
|
+
|
|
92
|
+
<details>
|
|
93
|
+
<summary>Using uvx</summary>
|
|
94
|
+
|
|
95
|
+
```json
|
|
96
|
+
"context_servers": [
|
|
97
|
+
"mcp-server-time": {
|
|
98
|
+
"command": "uvx",
|
|
99
|
+
"args": ["mcp-server-time"]
|
|
100
|
+
}
|
|
101
|
+
],
|
|
102
|
+
```
|
|
103
|
+
</details>
|
|
104
|
+
|
|
105
|
+
<details>
|
|
106
|
+
<summary>Using pip installation</summary>
|
|
107
|
+
|
|
108
|
+
```json
|
|
109
|
+
"context_servers": {
|
|
110
|
+
"mcp-server-time": {
|
|
111
|
+
"command": "python",
|
|
112
|
+
"args": ["-m", "mcp_server_time"]
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
```
|
|
116
|
+
</details>
|
|
117
|
+
|
|
118
|
+
### Customization - System Timezone
|
|
119
|
+
|
|
120
|
+
By default, the server automatically detects your system's timezone. You can override this by adding the argument `--local-timezone` to the `args` list in the configuration.
|
|
121
|
+
|
|
122
|
+
Example:
|
|
123
|
+
```json
|
|
124
|
+
{
|
|
125
|
+
"command": "python",
|
|
126
|
+
"args": ["-m", "mcp_server_time", "--local-timezone=America/New_York"]
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Example Interactions
|
|
131
|
+
|
|
132
|
+
1. Get current time:
|
|
133
|
+
```json
|
|
134
|
+
{
|
|
135
|
+
"name": "get_current_time",
|
|
136
|
+
"arguments": {
|
|
137
|
+
"timezone": "Europe/Warsaw"
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
Response:
|
|
142
|
+
```json
|
|
143
|
+
{
|
|
144
|
+
"timezone": "Europe/Warsaw",
|
|
145
|
+
"datetime": "2024-01-01T13:00:00+01:00",
|
|
146
|
+
"is_dst": false
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
2. Convert time between timezones:
|
|
151
|
+
```json
|
|
152
|
+
{
|
|
153
|
+
"name": "convert_time",
|
|
154
|
+
"arguments": {
|
|
155
|
+
"source_timezone": "America/New_York",
|
|
156
|
+
"time": "16:30",
|
|
157
|
+
"target_timezone": "Asia/Tokyo"
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
Response:
|
|
162
|
+
```json
|
|
163
|
+
{
|
|
164
|
+
"source": {
|
|
165
|
+
"timezone": "America/New_York",
|
|
166
|
+
"datetime": "2024-01-01T12:30:00-05:00",
|
|
167
|
+
"is_dst": false
|
|
168
|
+
},
|
|
169
|
+
"target": {
|
|
170
|
+
"timezone": "Asia/Tokyo",
|
|
171
|
+
"datetime": "2024-01-01T12:30:00+09:00",
|
|
172
|
+
"is_dst": false
|
|
173
|
+
},
|
|
174
|
+
"time_difference": "+13.0h",
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Debugging
|
|
179
|
+
|
|
180
|
+
You can use the MCP inspector to debug the server. For uvx installations:
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
npx @modelcontextprotocol/inspector uvx mcp-server-time
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Or if you've installed the package in a specific directory or are developing on it:
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
cd path/to/servers/src/time
|
|
190
|
+
npx @modelcontextprotocol/inspector uv run mcp-server-time
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Examples of Questions for Claude
|
|
194
|
+
|
|
195
|
+
1. "What time is it now?" (will use system timezone)
|
|
196
|
+
2. "What time is it in Tokyo?"
|
|
197
|
+
3. "When it's 4 PM in New York, what time is it in London?"
|
|
198
|
+
4. "Convert 9:30 AM Tokyo time to New York time"
|
|
199
|
+
|
|
200
|
+
## Contributing
|
|
201
|
+
|
|
202
|
+
We encourage contributions to help expand and improve mcp-server-time. Whether you want to add new time-related tools, enhance existing functionality, or improve documentation, your input is valuable.
|
|
203
|
+
|
|
204
|
+
For examples of other MCP servers and implementation patterns, see:
|
|
205
|
+
https://github.com/modelcontextprotocol/servers
|
|
206
|
+
|
|
207
|
+
Pull requests are welcome! Feel free to contribute new ideas, bug fixes, or enhancements to make mcp-server-time even more powerful and useful.
|
|
208
|
+
|
|
209
|
+
## License
|
|
210
|
+
|
|
211
|
+
mcp-server-time is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# Time MCP Server
|
|
2
|
+
|
|
3
|
+
A Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
|
|
4
|
+
|
|
5
|
+
### Available Tools
|
|
6
|
+
|
|
7
|
+
- `get_current_time` - Get current time in a specific timezone or system timezone.
|
|
8
|
+
- Required arguments:
|
|
9
|
+
- `timezone` (string): IANA timezone name (e.g., 'America/New_York', 'Europe/London')
|
|
10
|
+
|
|
11
|
+
- `convert_time` - Convert time between timezones.
|
|
12
|
+
- Required arguments:
|
|
13
|
+
- `source_timezone` (string): Source IANA timezone name
|
|
14
|
+
- `time` (string): Time in 24-hour format (HH:MM)
|
|
15
|
+
- `target_timezone` (string): Target IANA timezone name
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
### Using uv (recommended)
|
|
20
|
+
|
|
21
|
+
When using [`uv`](https://docs.astral.sh/uv/) no specific installation is needed. We will
|
|
22
|
+
use [`uvx`](https://docs.astral.sh/uv/guides/tools/) to directly run *mcp-server-time*.
|
|
23
|
+
|
|
24
|
+
### Using PIP
|
|
25
|
+
|
|
26
|
+
Alternatively you can install `mcp-server-time` via pip:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install mcp-server-time
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
After installation, you can run it as a script using:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
python -m mcp_server_time
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Configuration
|
|
39
|
+
|
|
40
|
+
### Configure for Claude.app
|
|
41
|
+
|
|
42
|
+
Add to your Claude settings:
|
|
43
|
+
|
|
44
|
+
<details>
|
|
45
|
+
<summary>Using uvx</summary>
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
"mcpServers": {
|
|
49
|
+
"time": {
|
|
50
|
+
"command": "uvx",
|
|
51
|
+
"args": ["mcp-server-time"]
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
</details>
|
|
56
|
+
|
|
57
|
+
<details>
|
|
58
|
+
<summary>Using pip installation</summary>
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
"mcpServers": {
|
|
62
|
+
"time": {
|
|
63
|
+
"command": "python",
|
|
64
|
+
"args": ["-m", "mcp_server_time"]
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
</details>
|
|
69
|
+
|
|
70
|
+
### Configure for Zed
|
|
71
|
+
|
|
72
|
+
Add to your Zed settings.json:
|
|
73
|
+
|
|
74
|
+
<details>
|
|
75
|
+
<summary>Using uvx</summary>
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
"context_servers": [
|
|
79
|
+
"mcp-server-time": {
|
|
80
|
+
"command": "uvx",
|
|
81
|
+
"args": ["mcp-server-time"]
|
|
82
|
+
}
|
|
83
|
+
],
|
|
84
|
+
```
|
|
85
|
+
</details>
|
|
86
|
+
|
|
87
|
+
<details>
|
|
88
|
+
<summary>Using pip installation</summary>
|
|
89
|
+
|
|
90
|
+
```json
|
|
91
|
+
"context_servers": {
|
|
92
|
+
"mcp-server-time": {
|
|
93
|
+
"command": "python",
|
|
94
|
+
"args": ["-m", "mcp_server_time"]
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
```
|
|
98
|
+
</details>
|
|
99
|
+
|
|
100
|
+
### Customization - System Timezone
|
|
101
|
+
|
|
102
|
+
By default, the server automatically detects your system's timezone. You can override this by adding the argument `--local-timezone` to the `args` list in the configuration.
|
|
103
|
+
|
|
104
|
+
Example:
|
|
105
|
+
```json
|
|
106
|
+
{
|
|
107
|
+
"command": "python",
|
|
108
|
+
"args": ["-m", "mcp_server_time", "--local-timezone=America/New_York"]
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Example Interactions
|
|
113
|
+
|
|
114
|
+
1. Get current time:
|
|
115
|
+
```json
|
|
116
|
+
{
|
|
117
|
+
"name": "get_current_time",
|
|
118
|
+
"arguments": {
|
|
119
|
+
"timezone": "Europe/Warsaw"
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
Response:
|
|
124
|
+
```json
|
|
125
|
+
{
|
|
126
|
+
"timezone": "Europe/Warsaw",
|
|
127
|
+
"datetime": "2024-01-01T13:00:00+01:00",
|
|
128
|
+
"is_dst": false
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
2. Convert time between timezones:
|
|
133
|
+
```json
|
|
134
|
+
{
|
|
135
|
+
"name": "convert_time",
|
|
136
|
+
"arguments": {
|
|
137
|
+
"source_timezone": "America/New_York",
|
|
138
|
+
"time": "16:30",
|
|
139
|
+
"target_timezone": "Asia/Tokyo"
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
Response:
|
|
144
|
+
```json
|
|
145
|
+
{
|
|
146
|
+
"source": {
|
|
147
|
+
"timezone": "America/New_York",
|
|
148
|
+
"datetime": "2024-01-01T12:30:00-05:00",
|
|
149
|
+
"is_dst": false
|
|
150
|
+
},
|
|
151
|
+
"target": {
|
|
152
|
+
"timezone": "Asia/Tokyo",
|
|
153
|
+
"datetime": "2024-01-01T12:30:00+09:00",
|
|
154
|
+
"is_dst": false
|
|
155
|
+
},
|
|
156
|
+
"time_difference": "+13.0h",
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Debugging
|
|
161
|
+
|
|
162
|
+
You can use the MCP inspector to debug the server. For uvx installations:
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
npx @modelcontextprotocol/inspector uvx mcp-server-time
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Or if you've installed the package in a specific directory or are developing on it:
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
cd path/to/servers/src/time
|
|
172
|
+
npx @modelcontextprotocol/inspector uv run mcp-server-time
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## Examples of Questions for Claude
|
|
176
|
+
|
|
177
|
+
1. "What time is it now?" (will use system timezone)
|
|
178
|
+
2. "What time is it in Tokyo?"
|
|
179
|
+
3. "When it's 4 PM in New York, what time is it in London?"
|
|
180
|
+
4. "Convert 9:30 AM Tokyo time to New York time"
|
|
181
|
+
|
|
182
|
+
## Contributing
|
|
183
|
+
|
|
184
|
+
We encourage contributions to help expand and improve mcp-server-time. Whether you want to add new time-related tools, enhance existing functionality, or improve documentation, your input is valuable.
|
|
185
|
+
|
|
186
|
+
For examples of other MCP servers and implementation patterns, see:
|
|
187
|
+
https://github.com/modelcontextprotocol/servers
|
|
188
|
+
|
|
189
|
+
Pull requests are welcome! Feel free to contribute new ideas, bug fixes, or enhancements to make mcp-server-time even more powerful and useful.
|
|
190
|
+
|
|
191
|
+
## License
|
|
192
|
+
|
|
193
|
+
mcp-server-time is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.
|