Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dist/
pomodoro
/pomodoro-mcp
test/.bats/
13 changes: 12 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
BINARY := pomodoro
BINARY_MCP := pomodoro-mcp

GO_SOURCES := $(shell find . -name '*.go' -not -path './vendor/*')
VERSION := $(shell git describe --tags --exact-match 2>/dev/null || git rev-parse --short HEAD 2>/dev/null || echo "dev")
Expand Down Expand Up @@ -27,13 +28,23 @@ test-acceptance: bats $(BINARY)
$(BINARY): $(GO_SOURCES) go.mod go.sum
go build -ldflags "$(LDFLAGS)" -o $(BINARY) .

$(BINARY_MCP): $(GO_SOURCES) go.mod go.sum
go build -ldflags "$(LDFLAGS)" -o $(BINARY_MCP) ./cmd/pomodoro-mcp

.PHONY: all
all: $(BINARY) $(BINARY_MCP)

.PHONY: install
install:
go install ./cmd/pomodoro

.PHONY: install-mcp
install-mcp:
go install ./cmd/pomodoro-mcp

.PHONY: clean
clean:
rm -rf $(BINARY)
rm -rf $(BINARY) $(BINARY_MCP)

.PHONY: bats
bats: $(BATS_CORE) $(BATS_SUPPORT) $(BATS_ASSERT)
Expand Down
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
* [Available Parts](#available-parts)
* [Hooks](#hooks)
* [Settings](#settings)
* [MCP Server](#mcp-server)

## Installation

Expand Down Expand Up @@ -330,3 +331,36 @@ Settings are automatically applied when:
* Displaying daily progress in status format (`%c/%g`)

The daily goal setting is used by the status format parts `%g` (goal) and `%c` (completed today) to show progress toward your daily target.

## MCP Server

An MCP (Model Context Protocol) server is available for integration with Claude Code and other MCP-compatible clients.

### Installation

```bash
go install github.com/open-pomodoro/openpomodoro-cli/cmd/pomodoro-mcp@latest
```

### Configure with Claude Code

```bash
claude mcp add pomodoro -- pomodoro-mcp
```

### Available Tools

| Tool | Description |
|------|-------------|
| `start_pomodoro` | Start a new Pomodoro (description, duration, tags) |
| `get_status` | Get current Pomodoro status |
| `finish_pomodoro` | Finish the current Pomodoro early |
| `cancel_pomodoro` | Cancel the active Pomodoro |
| `clear_pomodoro` | Clear a finished Pomodoro |
| `start_break` | Start a break timer |
| `repeat_pomodoro` | Repeat the last Pomodoro |
| `amend_pomodoro` | Amend current Pomodoro |
| `get_history` | Get Pomodoro history |
| `get_settings` | Get current settings |

All tools trigger hooks (start/stop/break) just like the CLI commands.
18 changes: 18 additions & 0 deletions cmd/pomodoro-mcp/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package main

import (
"log"

pomodoromcp "github.com/open-pomodoro/openpomodoro-cli/mcp"
"github.com/mark3labs/mcp-go/server"
)

func main() {
// Create the MCP server
s := pomodoromcp.NewServer()

// Start the server with stdio transport
if err := server.ServeStdio(s); err != nil {
log.Fatalf("Server error: %v", err)
}
}
71 changes: 71 additions & 0 deletions contribution.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/bin/bash
# contribution.sh - Helper script for switching between fork and upstream module paths
#
# Usage:
# ./contribution.sh upstream - Switch to upstream module path (for PRs)
# ./contribution.sh fork - Switch to fork module path (for personal use)
# ./contribution.sh status - Show current module path

set -e

UPSTREAM_PATH="github.com/open-pomodoro/openpomodoro-cli"
FORK_PATH="github.com/BuddhiLW/openpomodoro-cli"

GO_FILES=$(find . -name "*.go" -type f | grep -v vendor)

current_path() {
grep "^module" go.mod | awk '{print $2}'
}

switch_to() {
local from=$1
local to=$2

echo "Switching from $from to $to..."

# Update go.mod
sed -i "s|module $from|module $to|g" go.mod

# Update all Go imports
for file in $GO_FILES; do
sed -i "s|$from|$to|g" "$file"
done

# Update README.md
sed -i "s|$from|$to|g" README.md

# Tidy modules
go mod tidy

echo "Done! Module path is now: $to"
}

case "$1" in
upstream)
current=$(current_path)
if [ "$current" = "$UPSTREAM_PATH" ]; then
echo "Already using upstream path: $UPSTREAM_PATH"
exit 0
fi
switch_to "$FORK_PATH" "$UPSTREAM_PATH"
;;
fork)
current=$(current_path)
if [ "$current" = "$FORK_PATH" ]; then
echo "Already using fork path: $FORK_PATH"
exit 0
fi
switch_to "$UPSTREAM_PATH" "$FORK_PATH"
;;
status)
echo "Current module path: $(current_path)"
;;
*)
echo "Usage: $0 {upstream|fork|status}"
echo ""
echo " upstream - Switch to upstream module path (for PRs to open-pomodoro)"
echo " fork - Switch to fork module path (for personal use/releases)"
echo " status - Show current module path"
exit 1
;;
esac
38 changes: 32 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,18 +1,44 @@
module github.com/open-pomodoro/openpomodoro-cli

go 1.16
go 1.23.0

require (
github.com/go-logfmt/logfmt v0.6.0 // indirect
github.com/justincampbell/go-countdown v0.0.0-20180522133831-c8d99217f0f9
github.com/kr/logfmt v0.0.0-20210122060352-19f9bcb100e6 // indirect
github.com/magiconair/properties v1.8.6 // indirect
github.com/mark3labs/mcp-go v0.43.2
github.com/open-pomodoro/go-openpomodoro v0.0.0-20190916124501-e8f2ba2ebd6a
github.com/soh335/ical v0.0.0-20160115065015-8bf3eeeb3583
github.com/spf13/afero v1.8.2 // indirect
github.com/spf13/cobra v1.4.0
github.com/spf13/viper v1.10.1
github.com/stretchr/testify v1.7.0
github.com/stretchr/testify v1.9.0
)

require (
github.com/bahlo/generic-list-go v0.2.0 // indirect
github.com/buger/jsonparser v1.1.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fsnotify/fsnotify v1.5.1 // indirect
github.com/go-logfmt/logfmt v0.6.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/invopop/jsonschema v0.13.0 // indirect
github.com/justincampbell/go-logfmt v0.2.1 // indirect
github.com/kr/logfmt v0.0.0-20210122060352-19f9bcb100e6 // indirect
github.com/magiconair/properties v1.8.6 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mitchellh/mapstructure v1.4.3 // indirect
github.com/pelletier/go-toml v1.9.4 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/afero v1.8.2 // indirect
github.com/spf13/cast v1.7.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect
github.com/yosida95/uritemplate/v3 v3.0.2 // indirect
golang.org/x/sys v0.0.0-20220408201424-a24fb2fb8a0f // indirect
golang.org/x/text v0.3.7 // indirect
gopkg.in/ini.v1 v1.66.4 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading