mcp-sequential-thinking 0.6.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.
Files changed (28) hide show
  1. mcp_sequential_thinking-0.6.0/.github/dependabot.yml +10 -0
  2. mcp_sequential_thinking-0.6.0/.github/workflows/ci.yml +21 -0
  3. mcp_sequential_thinking-0.6.0/.github/workflows/claude.yml +50 -0
  4. mcp_sequential_thinking-0.6.0/.github/workflows/release.yml +18 -0
  5. mcp_sequential_thinking-0.6.0/.gitignore +5 -0
  6. mcp_sequential_thinking-0.6.0/CHANGELOG.md +111 -0
  7. mcp_sequential_thinking-0.6.0/LICENSE +21 -0
  8. mcp_sequential_thinking-0.6.0/PKG-INFO +553 -0
  9. mcp_sequential_thinking-0.6.0/README.md +516 -0
  10. mcp_sequential_thinking-0.6.0/SECURITY.md +18 -0
  11. mcp_sequential_thinking-0.6.0/debug_mcp_connection.py +79 -0
  12. mcp_sequential_thinking-0.6.0/example.md +785 -0
  13. mcp_sequential_thinking-0.6.0/mcp_sequential_thinking/__init__.py +0 -0
  14. mcp_sequential_thinking-0.6.0/mcp_sequential_thinking/analysis.py +289 -0
  15. mcp_sequential_thinking-0.6.0/mcp_sequential_thinking/logging_conf.py +24 -0
  16. mcp_sequential_thinking-0.6.0/mcp_sequential_thinking/models.py +226 -0
  17. mcp_sequential_thinking-0.6.0/mcp_sequential_thinking/server.py +226 -0
  18. mcp_sequential_thinking-0.6.0/mcp_sequential_thinking/storage.py +253 -0
  19. mcp_sequential_thinking-0.6.0/mcp_sequential_thinking/storage_utils.py +323 -0
  20. mcp_sequential_thinking-0.6.0/mcp_sequential_thinking/utils.py +17 -0
  21. mcp_sequential_thinking-0.6.0/pyproject.toml +74 -0
  22. mcp_sequential_thinking-0.6.0/run_server.py +29 -0
  23. mcp_sequential_thinking-0.6.0/tests/__init__.py +1 -0
  24. mcp_sequential_thinking-0.6.0/tests/test_analysis.py +219 -0
  25. mcp_sequential_thinking-0.6.0/tests/test_models.py +264 -0
  26. mcp_sequential_thinking-0.6.0/tests/test_server.py +109 -0
  27. mcp_sequential_thinking-0.6.0/tests/test_storage.py +632 -0
  28. mcp_sequential_thinking-0.6.0/uv.lock +1228 -0
@@ -0,0 +1,10 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: pip
4
+ directory: /
5
+ schedule:
6
+ interval: weekly
7
+ - package-ecosystem: github-actions
8
+ directory: /
9
+ schedule:
10
+ interval: weekly
@@ -0,0 +1,21 @@
1
+ name: CI
2
+ on:
3
+ push:
4
+ branches: [master]
5
+ pull_request:
6
+
7
+ jobs:
8
+ test:
9
+ runs-on: ${{ matrix.os }}
10
+ strategy:
11
+ matrix:
12
+ os: [ubuntu-latest, windows-latest]
13
+ python-version: ["3.10", "3.12"]
14
+ steps:
15
+ - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
16
+ - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
17
+ with:
18
+ python-version: ${{ matrix.python-version }}
19
+ - run: pip install -e ".[dev]"
20
+ - run: pytest tests/ -v
21
+ - run: mypy mcp_sequential_thinking/
@@ -0,0 +1,50 @@
1
+ name: Claude Code
2
+
3
+ on:
4
+ issue_comment:
5
+ types: [created]
6
+ pull_request_review_comment:
7
+ types: [created]
8
+ issues:
9
+ types: [opened, assigned]
10
+ pull_request_review:
11
+ types: [submitted]
12
+
13
+ jobs:
14
+ claude:
15
+ if: |
16
+ (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
17
+ (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
18
+ (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
19
+ (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
20
+ runs-on: ubuntu-latest
21
+ permissions:
22
+ contents: read
23
+ pull-requests: read
24
+ issues: read
25
+ id-token: write
26
+ actions: read # Required for Claude to read CI results on PRs
27
+ steps:
28
+ - name: Checkout repository
29
+ uses: actions/checkout@v4
30
+ with:
31
+ fetch-depth: 1
32
+
33
+ - name: Run Claude Code
34
+ id: claude
35
+ uses: anthropics/claude-code-action@v1
36
+ with:
37
+ claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
38
+
39
+ # This is an optional setting that allows Claude to read CI results on PRs
40
+ additional_permissions: |
41
+ actions: read
42
+
43
+ # Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
44
+ # prompt: 'Update the pull request description to include a summary of changes.'
45
+
46
+ # Optional: Add claude_args to customize behavior and configuration
47
+ # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
48
+ # or https://code.claude.com/docs/en/cli-reference for available options
49
+ # claude_args: '--allowed-tools Bash(gh pr:*)'
50
+
@@ -0,0 +1,18 @@
1
+ name: Release
2
+ on:
3
+ release:
4
+ types: [published]
5
+
6
+ jobs:
7
+ pypi:
8
+ runs-on: ubuntu-latest
9
+ environment: pypi
10
+ permissions:
11
+ id-token: write
12
+ steps:
13
+ - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
14
+ - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
15
+ with:
16
+ python-version: "3.12"
17
+ - run: pip install build && python -m build
18
+ - uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0
@@ -0,0 +1,5 @@
1
+ .venv
2
+ __pycache__
3
+ *.pyc
4
+ .coverage
5
+ CLAUDE.md
@@ -0,0 +1,111 @@
1
+ # Changelog
2
+
3
+ ## [0.6.0] - 2026-07-03
4
+
5
+ ### Added
6
+ - **Thought revisions and branching**: `process_thought` accepts new optional
7
+ parameters `is_revision`, `revises_thought_number`, `branch_from_thought` and
8
+ `branch_id` to revise an earlier thought or fork an alternative line of
9
+ reasoning. Cross-field validation enforces consistent usage. Analysis output
10
+ reports `isRevision`/`revisedThought`/`branchId` (plus a `revisionOf` snippet
11
+ for revisions), and `generate_summary` gains a `branches` object and a
12
+ `revisionCount`. Progress metrics are based on mainline thoughts only, so
13
+ revisions and branches no longer inflate completion beyond 100%.
14
+ - **Append-only JSONL session format (schema v2)**: the session now lives in
15
+ `current_session.jsonl` (header record + one thought per line). `process_thought`
16
+ is O(1) per call instead of rewriting the full history, and the file doubles as
17
+ an audit trail. A truncated final line (interrupted write) is dropped on load
18
+ instead of invalidating the whole session. Existing v1 `current_session.json`
19
+ files are migrated automatically and losslessly on first start; the original is
20
+ kept as `current_session.json.migrated-to-v2`.
21
+ - JSON exports now carry a top-level `"version": 2` field. Legacy v0.5.0 exports
22
+ (no version field) remain importable.
23
+ - CI workflow (GitHub Actions): test matrix on Linux/Windows with Python 3.10
24
+ and 3.12, running pytest and mypy on every push and pull request.
25
+ - Release workflow publishing to PyPI via Trusted Publishing when a GitHub
26
+ release is published (requires one-time Trusted Publisher setup on pypi.org).
27
+ - Dependabot configuration for pip and GitHub Actions dependencies.
28
+ - `SECURITY.md` with a private disclosure contact.
29
+
30
+ ### Changed
31
+ - **Package renamed** from `sequential-thinking` to `mcp-sequential-thinking` for the PyPI
32
+ release (the old name is occupied by a third-party fork). The console script
33
+ `mcp-sequential-thinking` and the import package `mcp_sequential_thinking` are unchanged.
34
+ - **Breaking:** `export_session` and `import_session` are now confined to the
35
+ `exports/` subdirectory of the storage directory (relative paths resolve to
36
+ `~/.mcp_sequential_thinking/exports/` by default). This prevents an export from
37
+ overwriting the active session file or its lock file.
38
+
39
+ ### Fixed
40
+ - `import_session` no longer silently replaces the active session with an empty
41
+ one when the given file is a valid JSON file without a `thoughts` key, or when
42
+ the file does not exist. Both cases now raise and leave the session untouched.
43
+ - Path-validation errors returned to the MCP client no longer leak the absolute
44
+ storage path (e.g. the user's home directory); the full path is only logged
45
+ server-side.
46
+ - `mypy` now passes cleanly: added missing type annotations in `analysis.py`
47
+ (`stages`, `percent_complete`) and `server.py` (`main() -> None`), and removed
48
+ duplicate `import os` / `import sys` in the `__main__` block of `server.py`.
49
+
50
+ ## Version 0.5.0 (Unreleased)
51
+
52
+ ### Code Quality Improvements
53
+
54
+ #### 1. Reduced Code Duplication in Storage Layer
55
+ - Created a new `storage_utils.py` module with shared utility functions
56
+ - Implemented reusable functions for file operations and serialization
57
+ - Standardized error handling and backup creation
58
+ - Improved consistency across serialization operations
59
+ - Optimized resource management with cleaner context handling
60
+
61
+ #### 2. API and Data Structure Improvements
62
+ - Added explicit parameter for ID inclusion in `to_dict()` method
63
+ - Created utility module with snake_case/camelCase conversion functions
64
+ - Eliminated flag-based solution in favor of explicit method parameters
65
+ - Improved readability with clearer, more explicit list comprehensions
66
+ - Eliminated duplicate calculations in analysis methods
67
+
68
+ ## Version 0.4.0
69
+
70
+ ### Major Improvements
71
+
72
+ #### 1. Serialization & Validation with Pydantic
73
+ - Converted `ThoughtData` from dataclass to Pydantic model
74
+ - Added automatic validation with field validators
75
+ - Maintained backward compatibility with existing code
76
+
77
+ #### 2. Thread-Safety in Storage Layer
78
+ - Added file locking with `portalocker` to prevent race conditions
79
+ - Added thread locks to protect shared data structures
80
+ - Made all methods thread-safe
81
+
82
+ #### 3. Fixed Division-by-Zero in Analysis
83
+ - Added proper error handling in `generate_summary` method
84
+ - Added safe calculation of percent complete with default values
85
+
86
+ #### 4. Case-Insensitive Stage Comparison
87
+ - Updated `ThoughtStage.from_string` to use case-insensitive comparison
88
+ - Improved user experience by accepting any case for stage names
89
+
90
+ #### 5. Added UUID to ThoughtData
91
+ - Added a unique identifier to each thought for better tracking
92
+ - Maintained backward compatibility with existing code
93
+
94
+ #### 6. Consolidated Logging Setup
95
+ - Created a central logging configuration in `logging_conf.py`
96
+ - Standardized logging across all modules
97
+
98
+ #### 7. Improved Package Entry Point
99
+ - Cleaned up the path handling in `run_server.py`
100
+ - Removed redundant code
101
+
102
+ ### New Dependencies
103
+ - Added `portalocker` for file locking
104
+ - Added `pydantic` for data validation
105
+
106
+ ## Version 0.3.0
107
+
108
+ Initial release with basic functionality:
109
+ - Sequential thinking process with defined stages
110
+ - Thought storage and retrieval
111
+ - Analysis and summary generation
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) <2025> <Arben Ademi>
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.