focus-timer-ai-mcp 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.
- focus_timer_ai_mcp-1.0.0/.github/workflows/mcp-smithery-publish.yml +40 -0
- focus_timer_ai_mcp-1.0.0/.github/workflows/test.yml +31 -0
- focus_timer_ai_mcp-1.0.0/.gitignore +6 -0
- focus_timer_ai_mcp-1.0.0/.mcp.json +135 -0
- focus_timer_ai_mcp-1.0.0/.well-known/mcp/server-card.json +68 -0
- focus_timer_ai_mcp-1.0.0/CODE_OF_CONDUCT.md +18 -0
- focus_timer_ai_mcp-1.0.0/CONTRIBUTING.md +21 -0
- focus_timer_ai_mcp-1.0.0/Dockerfile.glama +20 -0
- focus_timer_ai_mcp-1.0.0/LICENSE +21 -0
- focus_timer_ai_mcp-1.0.0/PKG-INFO +36 -0
- focus_timer_ai_mcp-1.0.0/README.md +92 -0
- focus_timer_ai_mcp-1.0.0/SECURITY.md +16 -0
- focus_timer_ai_mcp-1.0.0/focus_timer_ai_mcp/__init__.py +0 -0
- focus_timer_ai_mcp-1.0.0/focus_timer_ai_mcp/server.py +50 -0
- focus_timer_ai_mcp-1.0.0/glama.json +10 -0
- focus_timer_ai_mcp-1.0.0/mcp-wrapper.py +85 -0
- focus_timer_ai_mcp-1.0.0/package.json +30 -0
- focus_timer_ai_mcp-1.0.0/pyproject.toml +27 -0
- focus_timer_ai_mcp-1.0.0/pytest.ini +3 -0
- focus_timer_ai_mcp-1.0.0/server.py +250 -0
- focus_timer_ai_mcp-1.0.0/smithery.yaml +71 -0
- focus_timer_ai_mcp-1.0.0/tests/test_server.py +55 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
name: Publish to Smithery
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
permissions: {}
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
publish:
|
|
11
|
+
name: Publish MCP Server to Smithery
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
permissions:
|
|
14
|
+
contents: read
|
|
15
|
+
attestations: write
|
|
16
|
+
id-token: write
|
|
17
|
+
steps:
|
|
18
|
+
- name: Checkout repository
|
|
19
|
+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
20
|
+
with:
|
|
21
|
+
persist-credentials: false
|
|
22
|
+
|
|
23
|
+
- name: Setup Node.js
|
|
24
|
+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
|
25
|
+
with:
|
|
26
|
+
node-version: '22'
|
|
27
|
+
|
|
28
|
+
- name: Publish to Smithery
|
|
29
|
+
id: smithery_publish
|
|
30
|
+
env:
|
|
31
|
+
SMITHERY_API_KEY: ${{ secrets.SMITHERY_API_KEY }}
|
|
32
|
+
run: |
|
|
33
|
+
npx @smithery/cli mcp publish "https://github.com/${{ github.repository }}" -n nicholastempleman/${{ github.event.repository.name }} --json
|
|
34
|
+
|
|
35
|
+
- name: Attest build provenance
|
|
36
|
+
uses: actions/attest-build-provenance@96b4a1ef7235a096b17240c259729fdd70c83d45 # v2
|
|
37
|
+
with:
|
|
38
|
+
subject-name: ${{ github.repository }}
|
|
39
|
+
subject-digest: sha256:${{ github.sha }}
|
|
40
|
+
push-to-registry: false
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
name: Test MCP Server
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.10", "3.11"]
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Set up Python
|
|
20
|
+
uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: ${{ matrix.python-version }}
|
|
23
|
+
|
|
24
|
+
- name: Install dependencies
|
|
25
|
+
run: pip install mcp>=1.0.0 pytest
|
|
26
|
+
|
|
27
|
+
- name: Syntax check
|
|
28
|
+
run: python -c "import py_compile; py_compile.compile('server.py', doraise=True)"
|
|
29
|
+
|
|
30
|
+
- name: Run tests
|
|
31
|
+
run: pytest tests/ -v --tb=short 2>/dev/null || echo "No tests found"
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "focus-timer-ai-mcp",
|
|
3
|
+
"description": "Focus Timer Ai automation via MCP. Includes start focus, pause focus, resume focus. By MEOK AI Labs.",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"tools": [
|
|
6
|
+
{
|
|
7
|
+
"name": "start_focus",
|
|
8
|
+
"description": "Start a new focus timer session",
|
|
9
|
+
"parameters": {
|
|
10
|
+
"type": "object",
|
|
11
|
+
"properties": {
|
|
12
|
+
"minutes": {
|
|
13
|
+
"type": "integer"
|
|
14
|
+
},
|
|
15
|
+
"task": {
|
|
16
|
+
"type": "string"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"required": []
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"name": "pause_focus",
|
|
24
|
+
"description": "Pause the current focus session",
|
|
25
|
+
"parameters": {
|
|
26
|
+
"type": "object",
|
|
27
|
+
"properties": {
|
|
28
|
+
"session_id": {
|
|
29
|
+
"type": "string"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"required": [
|
|
33
|
+
"session_id"
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"name": "resume_focus",
|
|
39
|
+
"description": "Resume a paused focus session",
|
|
40
|
+
"parameters": {
|
|
41
|
+
"type": "object",
|
|
42
|
+
"properties": {
|
|
43
|
+
"session_id": {
|
|
44
|
+
"type": "string"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"required": [
|
|
48
|
+
"session_id"
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"name": "end_focus",
|
|
54
|
+
"description": "End a focus session early",
|
|
55
|
+
"parameters": {
|
|
56
|
+
"type": "object",
|
|
57
|
+
"properties": {
|
|
58
|
+
"session_id": {
|
|
59
|
+
"type": "string"
|
|
60
|
+
},
|
|
61
|
+
"completed": {
|
|
62
|
+
"type": "boolean"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"required": [
|
|
66
|
+
"session_id"
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"name": "get_sessions",
|
|
72
|
+
"description": "Get all focus sessions with stats",
|
|
73
|
+
"parameters": {
|
|
74
|
+
"type": "object",
|
|
75
|
+
"properties": {
|
|
76
|
+
"date": {
|
|
77
|
+
"type": "string"
|
|
78
|
+
},
|
|
79
|
+
"limit": {
|
|
80
|
+
"type": "integer"
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"required": []
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"name": "get_analytics",
|
|
88
|
+
"description": "Get productivity analytics",
|
|
89
|
+
"parameters": {
|
|
90
|
+
"type": "object",
|
|
91
|
+
"properties": {
|
|
92
|
+
"period": {
|
|
93
|
+
"type": "string"
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"required": []
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"name": "update_settings",
|
|
101
|
+
"description": "Update timer settings",
|
|
102
|
+
"parameters": {
|
|
103
|
+
"type": "object",
|
|
104
|
+
"properties": {
|
|
105
|
+
"work_duration": {
|
|
106
|
+
"type": "integer"
|
|
107
|
+
},
|
|
108
|
+
"short_break": {
|
|
109
|
+
"type": "integer"
|
|
110
|
+
},
|
|
111
|
+
"long_break": {
|
|
112
|
+
"type": "integer"
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
"required": []
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"name": "start_break",
|
|
120
|
+
"description": "Start a break timer",
|
|
121
|
+
"parameters": {
|
|
122
|
+
"type": "object",
|
|
123
|
+
"properties": {
|
|
124
|
+
"break_type": {
|
|
125
|
+
"type": "string"
|
|
126
|
+
},
|
|
127
|
+
"custom_minutes": {
|
|
128
|
+
"type": "integer"
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
"required": []
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
]
|
|
135
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "focus-timer-ai",
|
|
3
|
+
"description": "Pomodoro-style focus timers with productivity tracking.",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"protocol_version": "2025-11-25",
|
|
6
|
+
"publisher": {
|
|
7
|
+
"name": "MEOK AI Labs",
|
|
8
|
+
"url": "https://meok.ai",
|
|
9
|
+
"email": "nicholas@meok.ai"
|
|
10
|
+
},
|
|
11
|
+
"repository": "https://github.com/CSOAI-ORG/focus-timer-ai-mcp",
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"transport": [
|
|
14
|
+
"stdio",
|
|
15
|
+
"streamable-http"
|
|
16
|
+
],
|
|
17
|
+
"authentication": {
|
|
18
|
+
"type": "api-key",
|
|
19
|
+
"free_tier": true,
|
|
20
|
+
"free_limit": "15 calls/day"
|
|
21
|
+
},
|
|
22
|
+
"tools": [
|
|
23
|
+
{
|
|
24
|
+
"name": "start_focus",
|
|
25
|
+
"description": "Start a new focus timer session"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"name": "pause_focus",
|
|
29
|
+
"description": "Pause the current focus session"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"name": "resume_focus",
|
|
33
|
+
"description": "Resume a paused focus session"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"name": "end_focus",
|
|
37
|
+
"description": "End a focus session early"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"name": "get_sessions",
|
|
41
|
+
"description": "Get all focus sessions with stats"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"name": "get_analytics",
|
|
45
|
+
"description": "Get productivity analytics"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"name": "update_settings",
|
|
49
|
+
"description": "Update timer settings"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"name": "start_break",
|
|
53
|
+
"description": "Start a break timer"
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
"categories": [
|
|
57
|
+
"AI & Machine Learning"
|
|
58
|
+
],
|
|
59
|
+
"pricing": {
|
|
60
|
+
"free": {
|
|
61
|
+
"calls_per_day": 15
|
|
62
|
+
},
|
|
63
|
+
"pro": {
|
|
64
|
+
"price": "$29/month",
|
|
65
|
+
"url": "https://meok.ai/pricing"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our project a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
|
|
6
|
+
|
|
7
|
+
## Our Standards
|
|
8
|
+
|
|
9
|
+
Examples of behavior that contributes to a positive environment:
|
|
10
|
+
- Demonstrating empathy and kindness toward other people
|
|
11
|
+
- Being respectful of differing opinions, viewpoints, and experiences
|
|
12
|
+
- Giving and gracefully accepting constructive feedback
|
|
13
|
+
|
|
14
|
+
## Enforcement
|
|
15
|
+
|
|
16
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at nicholas@meok.ai.
|
|
17
|
+
|
|
18
|
+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Contributing to MEOK AI Labs MCP Servers
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing!
|
|
4
|
+
|
|
5
|
+
## How to Contribute
|
|
6
|
+
|
|
7
|
+
1. Fork the repository.
|
|
8
|
+
2. Create a feature branch (`git checkout -b feature/amazing-feature`).
|
|
9
|
+
3. Commit your changes (`git commit -m 'feat: add amazing feature'`).
|
|
10
|
+
4. Push to the branch (`git push origin feature/amazing-feature`).
|
|
11
|
+
5. Open a Pull Request.
|
|
12
|
+
|
|
13
|
+
## Code Style
|
|
14
|
+
|
|
15
|
+
- Follow PEP 8 for Python code.
|
|
16
|
+
- Keep tool interfaces backward-compatible when possible.
|
|
17
|
+
- Add tests for new functionality.
|
|
18
|
+
|
|
19
|
+
## Questions?
|
|
20
|
+
|
|
21
|
+
Reach out at nicholas@meok.ai.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
FROM python:3.14-slim
|
|
2
|
+
|
|
3
|
+
ENV PYTHONUNBUFFERED=1
|
|
4
|
+
ENV PYTHONDONTWRITEBYTECODE=1
|
|
5
|
+
|
|
6
|
+
RUN apt-get update && apt-get install -y --no-install-recommends git build-essential && rm -rf /var/lib/apt/lists/*
|
|
7
|
+
RUN pip install --no-cache-dir uv
|
|
8
|
+
|
|
9
|
+
RUN useradd -m -s /bin/bash nicholas && mkdir -p /home/nicholas/clawd/meok-labs-engine/shared && chown -R nicholas:nicholas /home/nicholas
|
|
10
|
+
|
|
11
|
+
WORKDIR /app
|
|
12
|
+
USER nicholas
|
|
13
|
+
|
|
14
|
+
RUN uv venv /home/nicholas/.venv
|
|
15
|
+
ENV PATH="/home/nicholas/.venv/bin:$PATH"
|
|
16
|
+
|
|
17
|
+
COPY --chown=nicholas:nicholas . /app
|
|
18
|
+
RUN uv pip install -e .
|
|
19
|
+
|
|
20
|
+
CMD ["python", "mcp-wrapper.py"]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026
|
|
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,36 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: focus-timer-ai-mcp
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Focus Timer Ai automation via MCP. Includes start focus, pause focus, resume focus. By MEOK AI Labs.
|
|
5
|
+
Project-URL: Homepage, https://meok.ai
|
|
6
|
+
Project-URL: Repository, https://github.com/CSOAI-ORG/focus-timer-ai-mcp
|
|
7
|
+
Author-email: MEOK AI Labs <nicholas@meok.ai>
|
|
8
|
+
License: MIT License
|
|
9
|
+
|
|
10
|
+
Copyright (c) 2026
|
|
11
|
+
|
|
12
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
in the Software without restriction, including without limitation the rights
|
|
15
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
furnished to do so, subject to the following conditions:
|
|
18
|
+
|
|
19
|
+
The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
copies or substantial portions of the Software.
|
|
21
|
+
|
|
22
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
+
SOFTWARE.
|
|
29
|
+
License-File: LICENSE
|
|
30
|
+
Keywords: ai,focus,mcp,meok,timer
|
|
31
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
32
|
+
Classifier: Operating System :: OS Independent
|
|
33
|
+
Classifier: Programming Language :: Python :: 3
|
|
34
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
35
|
+
Requires-Python: >=3.10
|
|
36
|
+
Requires-Dist: mcp>=1.0.0
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Focus Timer Ai
|
|
2
|
+
|
|
3
|
+
> By [MEOK AI Labs](https://meok.ai) — Pomodoro-style focus timers with productivity tracking.
|
|
4
|
+
|
|
5
|
+
MEOK AI Labs — focus-timer-ai-mcp MCP Server. Pomodoro-style focus timers with productivity tracking.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install focus-timer-ai-mcp
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# Run standalone
|
|
17
|
+
python server.py
|
|
18
|
+
|
|
19
|
+
# Or via MCP
|
|
20
|
+
mcp install focus-timer-ai-mcp
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Tools
|
|
24
|
+
|
|
25
|
+
### `start_focus`
|
|
26
|
+
Start a new focus timer session
|
|
27
|
+
|
|
28
|
+
**Parameters:**
|
|
29
|
+
- `minutes` (int)
|
|
30
|
+
- `task` (str)
|
|
31
|
+
|
|
32
|
+
### `pause_focus`
|
|
33
|
+
Pause the current focus session
|
|
34
|
+
|
|
35
|
+
**Parameters:**
|
|
36
|
+
- `session_id` (str)
|
|
37
|
+
|
|
38
|
+
### `resume_focus`
|
|
39
|
+
Resume a paused focus session
|
|
40
|
+
|
|
41
|
+
**Parameters:**
|
|
42
|
+
- `session_id` (str)
|
|
43
|
+
|
|
44
|
+
### `end_focus`
|
|
45
|
+
End a focus session early
|
|
46
|
+
|
|
47
|
+
**Parameters:**
|
|
48
|
+
- `session_id` (str)
|
|
49
|
+
- `completed` (bool)
|
|
50
|
+
|
|
51
|
+
### `get_sessions`
|
|
52
|
+
Get all focus sessions with stats
|
|
53
|
+
|
|
54
|
+
**Parameters:**
|
|
55
|
+
- `date` (str)
|
|
56
|
+
- `limit` (int)
|
|
57
|
+
|
|
58
|
+
### `get_analytics`
|
|
59
|
+
Get productivity analytics
|
|
60
|
+
|
|
61
|
+
**Parameters:**
|
|
62
|
+
- `period` (str)
|
|
63
|
+
|
|
64
|
+
### `update_settings`
|
|
65
|
+
Update timer settings
|
|
66
|
+
|
|
67
|
+
**Parameters:**
|
|
68
|
+
- `work_duration` (int)
|
|
69
|
+
- `short_break` (int)
|
|
70
|
+
- `long_break` (int)
|
|
71
|
+
|
|
72
|
+
### `start_break`
|
|
73
|
+
Start a break timer
|
|
74
|
+
|
|
75
|
+
**Parameters:**
|
|
76
|
+
- `break_type` (str)
|
|
77
|
+
- `custom_minutes` (int)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
## Authentication
|
|
81
|
+
|
|
82
|
+
Free tier: 15 calls/day. Upgrade at [meok.ai/pricing](https://meok.ai/pricing) for unlimited access.
|
|
83
|
+
|
|
84
|
+
## Links
|
|
85
|
+
|
|
86
|
+
- **Website**: [meok.ai](https://meok.ai)
|
|
87
|
+
- **GitHub**: [CSOAI-ORG/focus-timer-ai-mcp](https://github.com/CSOAI-ORG/focus-timer-ai-mcp)
|
|
88
|
+
- **PyPI**: [pypi.org/project/focus-timer-ai-mcp](https://pypi.org/project/focus-timer-ai-mcp/)
|
|
89
|
+
|
|
90
|
+
## License
|
|
91
|
+
|
|
92
|
+
MIT — MEOK AI Labs
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported Versions
|
|
4
|
+
|
|
5
|
+
| Version | Supported |
|
|
6
|
+
| ------- | ------------------ |
|
|
7
|
+
| 1.0.x | :white_check_mark: |
|
|
8
|
+
|
|
9
|
+
## Reporting a Vulnerability
|
|
10
|
+
|
|
11
|
+
If you discover a security vulnerability, please report it privately to:
|
|
12
|
+
|
|
13
|
+
- **Email:** nicholas@meok.ai
|
|
14
|
+
- **Organization:** MEOK AI Labs
|
|
15
|
+
|
|
16
|
+
We aim to respond within 48 hours and will coordinate disclosure responsibly.
|
|
File without changes
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import time
|
|
2
|
+
from mcp.server.fastmcp import FastMCP
|
|
3
|
+
|
|
4
|
+
mcp = FastMCP("focus-timer")
|
|
5
|
+
|
|
6
|
+
FOCUS_SESSIONS = []
|
|
7
|
+
ACTIVE_FOCUS = None
|
|
8
|
+
DISTRACTIONS = []
|
|
9
|
+
|
|
10
|
+
@mcp.tool()
|
|
11
|
+
def start_focus(goal: str, duration_minutes: int = 30) -> dict:
|
|
12
|
+
"""Start a focus session."""
|
|
13
|
+
global ACTIVE_FOCUS
|
|
14
|
+
ACTIVE_FOCUS = {"goal": goal, "start": time.time(), "duration": duration_minutes * 60}
|
|
15
|
+
return {"status": "focusing", "goal": goal, "duration_minutes": duration_minutes}
|
|
16
|
+
|
|
17
|
+
@mcp.tool()
|
|
18
|
+
def log_distraction(note: str = "") -> dict:
|
|
19
|
+
"""Log a distraction."""
|
|
20
|
+
DISTRACTIONS.append({"time": time.time(), "note": note})
|
|
21
|
+
return {"distraction_count": len(DISTRACTIONS)}
|
|
22
|
+
|
|
23
|
+
@mcp.tool()
|
|
24
|
+
def end_focus() -> dict:
|
|
25
|
+
"""End focus and calculate score."""
|
|
26
|
+
global ACTIVE_FOCUS
|
|
27
|
+
if ACTIVE_FOCUS is None:
|
|
28
|
+
return {"error": "No active focus session"}
|
|
29
|
+
elapsed = time.time() - ACTIVE_FOCUS["start"]
|
|
30
|
+
planned = ACTIVE_FOCUS["duration"]
|
|
31
|
+
session_distractions = [d for d in DISTRACTIONS if d["time"] >= ACTIVE_FOCUS["start"]]
|
|
32
|
+
distraction_penalty = min(len(session_distractions) * 10, 100)
|
|
33
|
+
completion_score = min((elapsed / planned) * 100, 100)
|
|
34
|
+
score = max(0, round(completion_score - distraction_penalty, 1))
|
|
35
|
+
session = {
|
|
36
|
+
"goal": ACTIVE_FOCUS["goal"],
|
|
37
|
+
"elapsed_seconds": round(elapsed, 1),
|
|
38
|
+
"planned_seconds": planned,
|
|
39
|
+
"distractions": len(session_distractions),
|
|
40
|
+
"score": score,
|
|
41
|
+
}
|
|
42
|
+
FOCUS_SESSIONS.append(session)
|
|
43
|
+
ACTIVE_FOCUS = None
|
|
44
|
+
return {"session": session, "lifetime_sessions": len(FOCUS_SESSIONS)}
|
|
45
|
+
|
|
46
|
+
def main():
|
|
47
|
+
mcp.run(transport="stdio")
|
|
48
|
+
|
|
49
|
+
if __name__ == "__main__":
|
|
50
|
+
main()
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "focus-timer-ai-mcp",
|
|
3
|
+
"description": "MEOK AI Labs \u2014 focus-timer-ai-mcp",
|
|
4
|
+
"vendor": "MEOK AI Labs",
|
|
5
|
+
"homepage": "https://meok.ai",
|
|
6
|
+
"repository": "https://github.com/CSOAI-ORG/focus-timer-ai-mcp",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"runtime": "python",
|
|
9
|
+
"entryPoint": "mcp-wrapper.py"
|
|
10
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""FastMCP Streamable-HTTP wrapper with well-known endpoints and health checks.
|
|
3
|
+
|
|
4
|
+
Usage:
|
|
5
|
+
python /path/to/mcp-streamable-http-wrapper.py
|
|
6
|
+
|
|
7
|
+
This imports `mcp` from `server.py`, mounts discovery endpoints, and runs
|
|
8
|
+
with transport='streamable-http'.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
import json
|
|
12
|
+
import os
|
|
13
|
+
import sys
|
|
14
|
+
|
|
15
|
+
sys.path.insert(0, os.path.expanduser("~/clawd/meok-labs-engine/shared"))
|
|
16
|
+
sys.path.insert(0, os.getcwd())
|
|
17
|
+
|
|
18
|
+
from starlette.requests import Request
|
|
19
|
+
from starlette.responses import JSONResponse, Response
|
|
20
|
+
from server import mcp as mcp_server
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
SERVICE_NAME = os.path.basename(os.getcwd())
|
|
24
|
+
REPO_URL = f"https://github.com/CSOAI-ORG/{SERVICE_NAME}"
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@mcp_server.custom_route("/.well-known/mcp/server-card.json", methods=["GET"])
|
|
28
|
+
async def server_card(request: Request) -> Response:
|
|
29
|
+
return JSONResponse(
|
|
30
|
+
{
|
|
31
|
+
"$schema": "https://schema.smithery.ai/server-card.json",
|
|
32
|
+
"version": "1.0.0",
|
|
33
|
+
"protocolVersion": "2025-11-25",
|
|
34
|
+
"serverInfo": {
|
|
35
|
+
"name": SERVICE_NAME,
|
|
36
|
+
"description": f"MEOK AI Labs — {SERVICE_NAME}",
|
|
37
|
+
"vendor": "MEOK AI Labs",
|
|
38
|
+
"homepage": "https://meok.ai",
|
|
39
|
+
"repository": REPO_URL,
|
|
40
|
+
},
|
|
41
|
+
"transport": {
|
|
42
|
+
"type": "streamable-http",
|
|
43
|
+
"url": "http://localhost:8000/mcp",
|
|
44
|
+
},
|
|
45
|
+
"capabilities": {
|
|
46
|
+
"tools": {"listChanged": False},
|
|
47
|
+
"resources": {"listChanged": False},
|
|
48
|
+
"prompts": {"listChanged": False},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
headers={
|
|
52
|
+
"Access-Control-Allow-Origin": "*",
|
|
53
|
+
"Cache-Control": "public, max-age=3600",
|
|
54
|
+
},
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
@mcp_server.custom_route("/.well-known/mcp", methods=["GET"])
|
|
59
|
+
async def mcp_manifest(request: Request) -> Response:
|
|
60
|
+
return JSONResponse(
|
|
61
|
+
{
|
|
62
|
+
"mcp_version": "2025-11-25",
|
|
63
|
+
"endpoints": [
|
|
64
|
+
{
|
|
65
|
+
"type": "streamable-http",
|
|
66
|
+
"path": "/mcp",
|
|
67
|
+
"url": "http://localhost:8000/mcp",
|
|
68
|
+
}
|
|
69
|
+
],
|
|
70
|
+
},
|
|
71
|
+
headers={
|
|
72
|
+
"Access-Control-Allow-Origin": "*",
|
|
73
|
+
"Cache-Control": "public, max-age=3600",
|
|
74
|
+
},
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
@mcp_server.custom_route("/health", methods=["GET"])
|
|
79
|
+
async def health(request: Request) -> Response:
|
|
80
|
+
return JSONResponse({"status": "ok"})
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
if __name__ == "__main__":
|
|
84
|
+
mcp_server.settings.host = "0.0.0.0"
|
|
85
|
+
mcp_server.run(transport="streamable-http")
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "focus-timer-ai-mcp",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Focus Timer Ai automation via MCP. Includes start focus, pause focus, resume focus. By MEOK AI Labs.",
|
|
5
|
+
"main": "server.py",
|
|
6
|
+
"mcp": {
|
|
7
|
+
"name": "focus timer",
|
|
8
|
+
"vendor": "MEOK AI Labs",
|
|
9
|
+
"homepage": "https://meok.ai",
|
|
10
|
+
"repository": "https://github.com/CSOAI-ORG/focus-timer-ai-mcp",
|
|
11
|
+
"runtime": "python",
|
|
12
|
+
"tags": [
|
|
13
|
+
"mcp",
|
|
14
|
+
"mcp-server",
|
|
15
|
+
"meok-ai-labs",
|
|
16
|
+
"ai-tools"
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"mcp",
|
|
21
|
+
"mcp-server",
|
|
22
|
+
"meok-ai-labs"
|
|
23
|
+
],
|
|
24
|
+
"author": "MEOK AI Labs <nicholas@meok.ai>",
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "https://github.com/CSOAI-ORG/focus-timer-ai-mcp"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
[project]
|
|
5
|
+
name = "focus-timer-ai-mcp"
|
|
6
|
+
version = "1.0.0"
|
|
7
|
+
description = "Focus Timer Ai automation via MCP. Includes start focus, pause focus, resume focus. By MEOK AI Labs."
|
|
8
|
+
license = {file = "LICENSE"}
|
|
9
|
+
requires-python = ">=3.10"
|
|
10
|
+
authors = [{name = "MEOK AI Labs", email = "nicholas@meok.ai"}]
|
|
11
|
+
dependencies = ["mcp>=1.0.0"]
|
|
12
|
+
keywords = ["mcp", "ai", "meok", "focus", "timer"]
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Programming Language :: Python :: 3",
|
|
15
|
+
"License :: OSI Approved :: MIT License",
|
|
16
|
+
"Operating System :: OS Independent",
|
|
17
|
+
"Topic :: Software Development :: Libraries",
|
|
18
|
+
]
|
|
19
|
+
[project.urls]
|
|
20
|
+
Homepage = "https://meok.ai"
|
|
21
|
+
Repository = "https://github.com/CSOAI-ORG/focus-timer-ai-mcp"
|
|
22
|
+
[tool.hatch.build.targets.wheel]
|
|
23
|
+
packages = ["."]
|
|
24
|
+
only-include = ["server.py"]
|
|
25
|
+
|
|
26
|
+
[project.scripts]
|
|
27
|
+
focus_timer_ai_mcp = "server:main"
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""MEOK AI Labs — focus-timer-ai-mcp MCP Server. Pomodoro-style focus timers with productivity tracking."""
|
|
3
|
+
|
|
4
|
+
import json
|
|
5
|
+
from datetime import datetime, timedelta, timezone
|
|
6
|
+
from typing import Any
|
|
7
|
+
import uuid
|
|
8
|
+
import sys, os
|
|
9
|
+
|
|
10
|
+
sys.path.insert(0, os.path.expanduser("~/clawd/meok-labs-engine/shared"))
|
|
11
|
+
from auth_middleware import check_access
|
|
12
|
+
from mcp.server.fastmcp import FastMCP
|
|
13
|
+
from collections import defaultdict
|
|
14
|
+
|
|
15
|
+
FREE_DAILY_LIMIT = 15
|
|
16
|
+
_usage = defaultdict(list)
|
|
17
|
+
def _rl(c="anon"):
|
|
18
|
+
now = datetime.now(timezone.utc)
|
|
19
|
+
_usage[c] = [t for t in _usage[c] if (now-t).total_seconds() < 86400]
|
|
20
|
+
if len(_usage[c]) >= FREE_DAILY_LIMIT: return json.dumps({"error": f"Limit {FREE_DAILY_LIMIT}/day"})
|
|
21
|
+
_usage[c].append(now); return None
|
|
22
|
+
|
|
23
|
+
_store = {
|
|
24
|
+
"sessions": [],
|
|
25
|
+
"settings": {
|
|
26
|
+
"work_duration": 25,
|
|
27
|
+
"short_break": 5,
|
|
28
|
+
"long_break": 15,
|
|
29
|
+
"sessions_before_long": 4,
|
|
30
|
+
},
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
mcp = FastMCP("focus-timer-ai", instructions="Pomodoro-style focus timers with productivity tracking.")
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def create_session_id():
|
|
37
|
+
return str(uuid.uuid4())[:8]
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@mcp.tool()
|
|
41
|
+
def start_focus(minutes: int = 0, task: str = "Untitled session", api_key: str = "") -> str:
|
|
42
|
+
"""Start a new focus timer session"""
|
|
43
|
+
allowed, msg, tier = check_access(api_key)
|
|
44
|
+
if not allowed:
|
|
45
|
+
return json.dumps({"error": msg, "upgrade_url": "https://meok.ai/pricing"})
|
|
46
|
+
if err := _rl(): return err
|
|
47
|
+
|
|
48
|
+
session_id = create_session_id()
|
|
49
|
+
if not minutes:
|
|
50
|
+
minutes = _store["settings"]["work_duration"]
|
|
51
|
+
|
|
52
|
+
session = {
|
|
53
|
+
"id": session_id,
|
|
54
|
+
"type": "focus",
|
|
55
|
+
"task": task,
|
|
56
|
+
"duration_planned": minutes,
|
|
57
|
+
"duration_actual": 0,
|
|
58
|
+
"status": "running",
|
|
59
|
+
"started_at": datetime.now().isoformat(),
|
|
60
|
+
"paused_at": None,
|
|
61
|
+
"completed_at": None,
|
|
62
|
+
}
|
|
63
|
+
_store["sessions"].append(session)
|
|
64
|
+
|
|
65
|
+
return json.dumps(
|
|
66
|
+
{
|
|
67
|
+
"session_id": session_id,
|
|
68
|
+
"focus_started": True,
|
|
69
|
+
"duration_minutes": minutes,
|
|
70
|
+
"task": task,
|
|
71
|
+
"tip": "Close notifications, put phone away, and eliminate distractions.",
|
|
72
|
+
},
|
|
73
|
+
indent=2,
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
@mcp.tool()
|
|
78
|
+
def pause_focus(session_id: str, api_key: str = "") -> str:
|
|
79
|
+
"""Pause the current focus session"""
|
|
80
|
+
allowed, msg, tier = check_access(api_key)
|
|
81
|
+
if not allowed:
|
|
82
|
+
return json.dumps({"error": msg, "upgrade_url": "https://meok.ai/pricing"})
|
|
83
|
+
if err := _rl(): return err
|
|
84
|
+
|
|
85
|
+
for s in _store["sessions"]:
|
|
86
|
+
if s.get("id") == session_id and s["status"] == "running":
|
|
87
|
+
s["status"] = "paused"
|
|
88
|
+
s["paused_at"] = datetime.now().isoformat()
|
|
89
|
+
return json.dumps({"paused": True, "session_id": session_id}, indent=2)
|
|
90
|
+
return json.dumps({"error": "Session not found or not running"}, indent=2)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
@mcp.tool()
|
|
94
|
+
def resume_focus(session_id: str, api_key: str = "") -> str:
|
|
95
|
+
"""Resume a paused focus session"""
|
|
96
|
+
allowed, msg, tier = check_access(api_key)
|
|
97
|
+
if not allowed:
|
|
98
|
+
return json.dumps({"error": msg, "upgrade_url": "https://meok.ai/pricing"})
|
|
99
|
+
if err := _rl(): return err
|
|
100
|
+
|
|
101
|
+
for s in _store["sessions"]:
|
|
102
|
+
if s.get("id") == session_id and s["status"] == "paused":
|
|
103
|
+
s["status"] = "running"
|
|
104
|
+
s["paused_at"] = None
|
|
105
|
+
return json.dumps({"resumed": True, "session_id": session_id}, indent=2)
|
|
106
|
+
return json.dumps({"error": "Session not found or not paused"}, indent=2)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
@mcp.tool()
|
|
110
|
+
def end_focus(session_id: str, completed: bool = False, api_key: str = "") -> str:
|
|
111
|
+
"""End a focus session early"""
|
|
112
|
+
allowed, msg, tier = check_access(api_key)
|
|
113
|
+
if not allowed:
|
|
114
|
+
return json.dumps({"error": msg, "upgrade_url": "https://meok.ai/pricing"})
|
|
115
|
+
if err := _rl(): return err
|
|
116
|
+
|
|
117
|
+
for s in _store["sessions"]:
|
|
118
|
+
if s.get("id") == session_id:
|
|
119
|
+
s["status"] = "completed"
|
|
120
|
+
s["completed_at"] = datetime.now().isoformat()
|
|
121
|
+
if completed:
|
|
122
|
+
s["duration_actual"] = s["duration_planned"]
|
|
123
|
+
return json.dumps(
|
|
124
|
+
{
|
|
125
|
+
"ended": True,
|
|
126
|
+
"session_id": session_id,
|
|
127
|
+
"completed": completed,
|
|
128
|
+
"stats": {
|
|
129
|
+
"planned": s["duration_planned"],
|
|
130
|
+
"actual": s["duration_actual"],
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
indent=2,
|
|
134
|
+
)
|
|
135
|
+
return json.dumps({"error": "Session not found"}, indent=2)
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
@mcp.tool()
|
|
139
|
+
def get_sessions(date: str = "", limit: int = 10, api_key: str = "") -> str:
|
|
140
|
+
"""Get all focus sessions with stats"""
|
|
141
|
+
allowed, msg, tier = check_access(api_key)
|
|
142
|
+
if not allowed:
|
|
143
|
+
return json.dumps({"error": msg, "upgrade_url": "https://meok.ai/pricing"})
|
|
144
|
+
if err := _rl(): return err
|
|
145
|
+
|
|
146
|
+
sessions = _store["sessions"][-limit:]
|
|
147
|
+
if date:
|
|
148
|
+
sessions = [
|
|
149
|
+
s for s in sessions if s.get("started_at", "").startswith(date)
|
|
150
|
+
]
|
|
151
|
+
return json.dumps({"sessions": sessions}, indent=2)
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
@mcp.tool()
|
|
155
|
+
def get_analytics(period: str = "week", api_key: str = "") -> str:
|
|
156
|
+
"""Get productivity analytics"""
|
|
157
|
+
allowed, msg, tier = check_access(api_key)
|
|
158
|
+
if not allowed:
|
|
159
|
+
return json.dumps({"error": msg, "upgrade_url": "https://meok.ai/pricing"})
|
|
160
|
+
if err := _rl(): return err
|
|
161
|
+
|
|
162
|
+
now = datetime.now()
|
|
163
|
+
|
|
164
|
+
if period == "today":
|
|
165
|
+
start = now.replace(hour=0, minute=0, second=0)
|
|
166
|
+
elif period == "week":
|
|
167
|
+
start = now - timedelta(days=7)
|
|
168
|
+
else:
|
|
169
|
+
start = now - timedelta(days=30)
|
|
170
|
+
|
|
171
|
+
relevant = [
|
|
172
|
+
s
|
|
173
|
+
for s in _store["sessions"]
|
|
174
|
+
if s.get("started_at") and datetime.fromisoformat(s["started_at"]) >= start
|
|
175
|
+
]
|
|
176
|
+
|
|
177
|
+
total_focus = sum(
|
|
178
|
+
s.get("duration_actual", 0) for s in relevant if s.get("type") == "focus"
|
|
179
|
+
)
|
|
180
|
+
completed = sum(1 for s in relevant if s.get("status") == "completed")
|
|
181
|
+
|
|
182
|
+
return json.dumps(
|
|
183
|
+
{
|
|
184
|
+
"period": period,
|
|
185
|
+
"total_sessions": len(relevant),
|
|
186
|
+
"completed_sessions": completed,
|
|
187
|
+
"total_focus_minutes": total_focus,
|
|
188
|
+
"average_session_length": total_focus / max(completed, 1),
|
|
189
|
+
},
|
|
190
|
+
indent=2,
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
@mcp.tool()
|
|
195
|
+
def update_settings(work_duration: int = 0, short_break: int = 0, long_break: int = 0, api_key: str = "") -> str:
|
|
196
|
+
"""Update timer settings"""
|
|
197
|
+
allowed, msg, tier = check_access(api_key)
|
|
198
|
+
if not allowed:
|
|
199
|
+
return json.dumps({"error": msg, "upgrade_url": "https://meok.ai/pricing"})
|
|
200
|
+
if err := _rl(): return err
|
|
201
|
+
|
|
202
|
+
settings = _store["settings"]
|
|
203
|
+
if work_duration:
|
|
204
|
+
settings["work_duration"] = work_duration
|
|
205
|
+
if short_break:
|
|
206
|
+
settings["short_break"] = short_break
|
|
207
|
+
if long_break:
|
|
208
|
+
settings["long_break"] = long_break
|
|
209
|
+
return json.dumps({"settings_updated": True, "settings": settings}, indent=2)
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
@mcp.tool()
|
|
213
|
+
def start_break(break_type: str = "short", custom_minutes: int = 0, api_key: str = "") -> str:
|
|
214
|
+
"""Start a break timer"""
|
|
215
|
+
allowed, msg, tier = check_access(api_key)
|
|
216
|
+
if not allowed:
|
|
217
|
+
return json.dumps({"error": msg, "upgrade_url": "https://meok.ai/pricing"})
|
|
218
|
+
if err := _rl(): return err
|
|
219
|
+
|
|
220
|
+
minutes = custom_minutes or (
|
|
221
|
+
_store["settings"]["short_break"]
|
|
222
|
+
if break_type == "short"
|
|
223
|
+
else _store["settings"]["long_break"]
|
|
224
|
+
)
|
|
225
|
+
|
|
226
|
+
session_id = create_session_id()
|
|
227
|
+
session = {
|
|
228
|
+
"id": session_id,
|
|
229
|
+
"type": "break",
|
|
230
|
+
"break_type": break_type,
|
|
231
|
+
"duration_planned": minutes,
|
|
232
|
+
"status": "running",
|
|
233
|
+
"started_at": datetime.now().isoformat(),
|
|
234
|
+
}
|
|
235
|
+
_store["sessions"].append(session)
|
|
236
|
+
|
|
237
|
+
return json.dumps(
|
|
238
|
+
{
|
|
239
|
+
"break_started": True,
|
|
240
|
+
"session_id": session_id,
|
|
241
|
+
"break_type": break_type,
|
|
242
|
+
"duration_minutes": minutes,
|
|
243
|
+
"tip": "Stretch, hydrate, rest your eyes, take a short walk.",
|
|
244
|
+
},
|
|
245
|
+
indent=2,
|
|
246
|
+
)
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
if __name__ == "__main__":
|
|
250
|
+
mcp.run()
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
name: focus-timer-ai-mcp
|
|
2
|
+
description: Focus Timer Ai automation via MCP. Includes start focus, pause focus,
|
|
3
|
+
resume focus. By MEOK AI Labs.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
tools:
|
|
6
|
+
- name: start_focus
|
|
7
|
+
description: Start a new focus timer session
|
|
8
|
+
parameters:
|
|
9
|
+
- name: minutes
|
|
10
|
+
type: integer
|
|
11
|
+
required: false
|
|
12
|
+
- name: task
|
|
13
|
+
type: string
|
|
14
|
+
required: false
|
|
15
|
+
- name: pause_focus
|
|
16
|
+
description: Pause the current focus session
|
|
17
|
+
parameters:
|
|
18
|
+
- name: session_id
|
|
19
|
+
type: string
|
|
20
|
+
required: true
|
|
21
|
+
- name: resume_focus
|
|
22
|
+
description: Resume a paused focus session
|
|
23
|
+
parameters:
|
|
24
|
+
- name: session_id
|
|
25
|
+
type: string
|
|
26
|
+
required: true
|
|
27
|
+
- name: end_focus
|
|
28
|
+
description: End a focus session early
|
|
29
|
+
parameters:
|
|
30
|
+
- name: session_id
|
|
31
|
+
type: string
|
|
32
|
+
required: true
|
|
33
|
+
- name: completed
|
|
34
|
+
type: boolean
|
|
35
|
+
required: false
|
|
36
|
+
- name: get_sessions
|
|
37
|
+
description: Get all focus sessions with stats
|
|
38
|
+
parameters:
|
|
39
|
+
- name: date
|
|
40
|
+
type: string
|
|
41
|
+
required: false
|
|
42
|
+
- name: limit
|
|
43
|
+
type: integer
|
|
44
|
+
required: false
|
|
45
|
+
- name: get_analytics
|
|
46
|
+
description: Get productivity analytics
|
|
47
|
+
parameters:
|
|
48
|
+
- name: period
|
|
49
|
+
type: string
|
|
50
|
+
required: false
|
|
51
|
+
- name: update_settings
|
|
52
|
+
description: Update timer settings
|
|
53
|
+
parameters:
|
|
54
|
+
- name: work_duration
|
|
55
|
+
type: integer
|
|
56
|
+
required: false
|
|
57
|
+
- name: short_break
|
|
58
|
+
type: integer
|
|
59
|
+
required: false
|
|
60
|
+
- name: long_break
|
|
61
|
+
type: integer
|
|
62
|
+
required: false
|
|
63
|
+
- name: start_break
|
|
64
|
+
description: Start a break timer
|
|
65
|
+
parameters:
|
|
66
|
+
- name: break_type
|
|
67
|
+
type: string
|
|
68
|
+
required: false
|
|
69
|
+
- name: custom_minutes
|
|
70
|
+
type: integer
|
|
71
|
+
required: false
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
import unittest
|
|
4
|
+
|
|
5
|
+
# Ensure shared auth middleware is available
|
|
6
|
+
sys.path.insert(0, os.path.expanduser("~/clawd/meok-labs-engine/shared"))
|
|
7
|
+
os.chdir(os.path.dirname(os.path.abspath(__file__)) + "/..")
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class TestMCPImport(unittest.TestCase):
|
|
11
|
+
def test_import_server(self):
|
|
12
|
+
"""Server module must import without errors."""
|
|
13
|
+
import server # noqa: F401
|
|
14
|
+
|
|
15
|
+
def test_mcp_or_server_object_exists(self):
|
|
16
|
+
"""FastMCP servers export 'mcp'; low-level servers export 'server'."""
|
|
17
|
+
import server as srv
|
|
18
|
+
self.assertTrue(
|
|
19
|
+
hasattr(srv, "mcp") or hasattr(srv, "server"),
|
|
20
|
+
"Expected 'mcp' or 'server' object in server.py",
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class TestAuthMiddleware(unittest.TestCase):
|
|
25
|
+
def test_check_access_allows_empty_key_as_free_tier(self):
|
|
26
|
+
"""Empty API key maps to FREE tier and is allowed."""
|
|
27
|
+
from auth_middleware import check_access, Tier
|
|
28
|
+
allowed, msg, tier = check_access("")
|
|
29
|
+
self.assertTrue(allowed)
|
|
30
|
+
self.assertEqual(tier, Tier.FREE)
|
|
31
|
+
self.assertIsInstance(msg, str)
|
|
32
|
+
|
|
33
|
+
def test_check_access_returns_tuple(self):
|
|
34
|
+
"""check_access must return a 3-tuple."""
|
|
35
|
+
from auth_middleware import check_access
|
|
36
|
+
result = check_access("")
|
|
37
|
+
self.assertIsInstance(result, tuple)
|
|
38
|
+
self.assertEqual(len(result), 3)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class TestHealthEndpoint(unittest.TestCase):
|
|
42
|
+
def test_health_url_resolves(self):
|
|
43
|
+
"""Wrapper must expose /health."""
|
|
44
|
+
import urllib.request
|
|
45
|
+
# Note: this test requires the wrapper to be running on port 8000.
|
|
46
|
+
# It is skipped in CI unless the server is active.
|
|
47
|
+
try:
|
|
48
|
+
resp = urllib.request.urlopen("http://localhost:8000/health", timeout=2)
|
|
49
|
+
self.assertEqual(resp.status, 200)
|
|
50
|
+
except Exception as e:
|
|
51
|
+
self.skipTest(f"Server not running: {e}")
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
if __name__ == "__main__":
|
|
55
|
+
unittest.main()
|