backlog-tiny-mcp 0.35.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.
- backlog_tiny_mcp-0.35.0/PKG-INFO +84 -0
- backlog_tiny_mcp-0.35.0/README.md +65 -0
- backlog_tiny_mcp-0.35.0/pyproject.toml +93 -0
- backlog_tiny_mcp-0.35.0/pyproject.toml.orig +81 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/__init__.py +29 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/__main__.py +10 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/auth.py +199 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/backlog.py +696 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/cli.py +2046 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/client.py +320 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/computer.py +33 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/database.py +80 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/embeddings.py +900 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/global_rules.md +126 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/guidance.py +11 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/guide/index.md +11 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/guide/memory.md +27 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/guide/projects.md +16 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/guide/search.md +72 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/guide/tasks.md +40 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/guide/workflow.md +22 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/httpd.py +270 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/migrate.py +113 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/migrations/0001-initial.sql +194 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/migrations/0002-task-assignment.sql +2 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/migrations/0003-task-edit-claims.sql +5 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/migrations/0004-memory-visibility.sql +42 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/model/CITATION.bib +9 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/model/LICENSE +202 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/model/README.md +12 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/model/UPSTREAM.md +2053 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/model/config.json +12 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/model/model.safetensors +4 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/model/modules.json +14 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/model/provenance.json +16 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/model/tokenizer.json +1 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/models.py +581 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/names.py +35 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/paths.py +53 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/protocol_storage.py +104 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/queries.py +7 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/queries.sql +531 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/records.py +215 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/render.py +479 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/server.py +2864 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/skills/autopilot/SKILL.md +96 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/skills/planning/SKILL.md +106 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/skills/planning/references/splitting.md +45 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/skills/triage/SKILL.md +104 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/skills/triage/references/conventions.md +43 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/skills.py +56 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/static/agent-config.js +20 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/static/app.css +1950 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/static/app.js +1301 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/static/assignments.js +96 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/static/breadcrumbs.js +54 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/static/comment-composer.js +95 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/static/connect.css +98 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/static/connect.html +74 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/static/connect.js +160 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/static/credentials.js +72 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/static/diagrams.js +128 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/static/dom.js +162 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/static/editor-claim.js +104 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/static/editor.js +355 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/static/index.html +137 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/static/markdown.css +33 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/static/markdown.js +72 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/static/mcp.js +177 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/static/memory-append.js +34 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/static/memory-editor.js +173 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/static/memory.js +279 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/static/package.json +1 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/static/project-form.js +71 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/static/project-settings.js +225 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/static/scope.js +90 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/static/statistics.js +87 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/static/task-browser.js +100 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/static/task-pagination.js +94 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/static/task-picker.js +164 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/static/task-table.js +74 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/static/vendor/README.md +12 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/static/vendor/dompurify-LICENSE +202 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/static/vendor/highlight-LICENSE +29 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/static/vendor/highlight-dark.css +118 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/static/vendor/highlight-light.css +118 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/static/vendor/highlight.min.js +1262 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/static/vendor/marked-LICENSE +44 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/static/vendor/marked.esm.js +80 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/static/vendor/marked.esm.js.map +7 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/static/vendor/mermaid-LICENSE +21 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/static/vendor/mermaid.min.js +4376 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/static/vendor/purify.es.mjs +2722 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/static/vendor/purify.es.mjs.map +1 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/transaction.py +47 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/version.py +79 -0
- backlog_tiny_mcp-0.35.0/src/backlog_mcp/webui.py +63 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: backlog-tiny-mcp
|
|
3
|
+
Version: 0.35.0
|
|
4
|
+
Summary: A project backlog over MCP: projects scoped to directories, tasks scoped to projects
|
|
5
|
+
Author: Dmitry Orlov
|
|
6
|
+
Author-email: Dmitry Orlov <orlovdl@gmail.com>
|
|
7
|
+
Requires-Dist: aiohttp-tiny-mcp[jwt,skills]~=0.10.1
|
|
8
|
+
Requires-Dist: aiosql>=15.0
|
|
9
|
+
Requires-Dist: aiosqlite>=0.21.0
|
|
10
|
+
Requires-Dist: argclass>=1.11.0
|
|
11
|
+
Requires-Dist: bcrypt>=5.0.0
|
|
12
|
+
Requires-Dist: model2vec>=0.9.0
|
|
13
|
+
Requires-Dist: numpy>=2.0
|
|
14
|
+
Requires-Dist: rich>=15.0.0
|
|
15
|
+
Requires-Dist: rtoml>=0.13.0
|
|
16
|
+
Requires-Python: >=3.14
|
|
17
|
+
Project-URL: Documentation, https://mosquito.github.io/backlog-mcp/
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
|
|
20
|
+
# backlog-mcp
|
|
21
|
+
|
|
22
|
+
A task tracker and a memory for AI agents over the Model Context Protocol (MCP). People use the
|
|
23
|
+
same data from the terminal and from a browser.
|
|
24
|
+
|
|
25
|
+
A project has many participants, and each of them works with agents. backlog-mcp keeps what
|
|
26
|
+
the agents did and why in one place, and its semantic search gives it to every agent of every
|
|
27
|
+
participant: an agent asks a question in its own words and gets the tasks that answer it.
|
|
28
|
+
|
|
29
|
+
```text
|
|
30
|
+
Anna: Why are the sign-in rate limits kept in a database table?
|
|
31
|
+
Redis is the usual choice.
|
|
32
|
+
|
|
33
|
+
Agent: Michael built it this way in task #42. Redis was considered and
|
|
34
|
+
rejected: the team does not run Redis in production and did not
|
|
35
|
+
want to add a service for one feature.
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Anna's agent never saw this code or Michael's conversation. It made one semantic search in the
|
|
39
|
+
backlog; the search matches meaning, not words, and runs on a model that ships with the package.
|
|
40
|
+
[How it works](https://mosquito.github.io/backlog-mcp/#how-it-works).
|
|
41
|
+
|
|
42
|
+
Documentation: https://mosquito.github.io/backlog-mcp/
|
|
43
|
+
|
|
44
|
+
## Install
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
uv tool install backlog-tiny-mcp
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
The package on PyPI is `backlog-tiny-mcp`; it installs two commands: `backlog` and
|
|
51
|
+
`backlog-mcp`. To run the server in Docker or Kubernetes, see
|
|
52
|
+
[Installation](https://mosquito.github.io/backlog-mcp/install.html).
|
|
53
|
+
|
|
54
|
+
## Choose how to run it
|
|
55
|
+
|
|
56
|
+
**Local MCP server over stdio.** An agent on your computer starts the server itself. The data
|
|
57
|
+
stays in a local SQLite file. `backlog install` registers the server with Claude Code and Codex.
|
|
58
|
+
See [Local MCP server over stdio](https://mosquito.github.io/backlog-mcp/stdio.html).
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
backlog mcp
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Remote MCP server over HTTP.** One server for several computers, agents and people, with Basic
|
|
65
|
+
or JWT authentication, a browser interface and a page that generates the agent configuration.
|
|
66
|
+
See [Remote MCP server over HTTP](https://mosquito.github.io/backlog-mcp/http.html).
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
backlog mcp --protocol=http --auth-basic=alice:secret
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Command line.** The `backlog` command works with a local database or with a remote server.
|
|
73
|
+
See [Command line](https://mosquito.github.io/backlog-mcp/cli.html). To make every command use
|
|
74
|
+
the remote server, put `url` and the credentials into `~/.config/backlog-mcp/config.toml`; see
|
|
75
|
+
[Always use a remote server](https://mosquito.github.io/backlog-mcp/cli.html#always-use-a-remote-server).
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
backlog task add "Fix the login form"
|
|
79
|
+
backlog --url https://backlog.example/mcp --user alice --password secret task list
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## License
|
|
83
|
+
|
|
84
|
+
MIT
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# backlog-mcp
|
|
2
|
+
|
|
3
|
+
A task tracker and a memory for AI agents over the Model Context Protocol (MCP). People use the
|
|
4
|
+
same data from the terminal and from a browser.
|
|
5
|
+
|
|
6
|
+
A project has many participants, and each of them works with agents. backlog-mcp keeps what
|
|
7
|
+
the agents did and why in one place, and its semantic search gives it to every agent of every
|
|
8
|
+
participant: an agent asks a question in its own words and gets the tasks that answer it.
|
|
9
|
+
|
|
10
|
+
```text
|
|
11
|
+
Anna: Why are the sign-in rate limits kept in a database table?
|
|
12
|
+
Redis is the usual choice.
|
|
13
|
+
|
|
14
|
+
Agent: Michael built it this way in task #42. Redis was considered and
|
|
15
|
+
rejected: the team does not run Redis in production and did not
|
|
16
|
+
want to add a service for one feature.
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Anna's agent never saw this code or Michael's conversation. It made one semantic search in the
|
|
20
|
+
backlog; the search matches meaning, not words, and runs on a model that ships with the package.
|
|
21
|
+
[How it works](https://mosquito.github.io/backlog-mcp/#how-it-works).
|
|
22
|
+
|
|
23
|
+
Documentation: https://mosquito.github.io/backlog-mcp/
|
|
24
|
+
|
|
25
|
+
## Install
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
uv tool install backlog-tiny-mcp
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The package on PyPI is `backlog-tiny-mcp`; it installs two commands: `backlog` and
|
|
32
|
+
`backlog-mcp`. To run the server in Docker or Kubernetes, see
|
|
33
|
+
[Installation](https://mosquito.github.io/backlog-mcp/install.html).
|
|
34
|
+
|
|
35
|
+
## Choose how to run it
|
|
36
|
+
|
|
37
|
+
**Local MCP server over stdio.** An agent on your computer starts the server itself. The data
|
|
38
|
+
stays in a local SQLite file. `backlog install` registers the server with Claude Code and Codex.
|
|
39
|
+
See [Local MCP server over stdio](https://mosquito.github.io/backlog-mcp/stdio.html).
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
backlog mcp
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
**Remote MCP server over HTTP.** One server for several computers, agents and people, with Basic
|
|
46
|
+
or JWT authentication, a browser interface and a page that generates the agent configuration.
|
|
47
|
+
See [Remote MCP server over HTTP](https://mosquito.github.io/backlog-mcp/http.html).
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
backlog mcp --protocol=http --auth-basic=alice:secret
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**Command line.** The `backlog` command works with a local database or with a remote server.
|
|
54
|
+
See [Command line](https://mosquito.github.io/backlog-mcp/cli.html). To make every command use
|
|
55
|
+
the remote server, put `url` and the credentials into `~/.config/backlog-mcp/config.toml`; see
|
|
56
|
+
[Always use a remote server](https://mosquito.github.io/backlog-mcp/cli.html#always-use-a-remote-server).
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
backlog task add "Fix the login form"
|
|
60
|
+
backlog --url https://backlog.example/mcp --user alice --password secret task list
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## License
|
|
64
|
+
|
|
65
|
+
MIT
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "backlog-tiny-mcp"
|
|
3
|
+
version = "0.35.0"
|
|
4
|
+
description = "A project backlog over MCP: projects scoped to directories, tasks scoped to projects"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.14"
|
|
7
|
+
dependencies = [
|
|
8
|
+
"aiohttp-tiny-mcp[jwt,skills]~=0.10.1",
|
|
9
|
+
"aiosql>=15.0",
|
|
10
|
+
"aiosqlite>=0.21.0",
|
|
11
|
+
"argclass>=1.11.0",
|
|
12
|
+
"bcrypt>=5.0.0",
|
|
13
|
+
"model2vec>=0.9.0",
|
|
14
|
+
"numpy>=2.0",
|
|
15
|
+
"rich>=15.0.0",
|
|
16
|
+
"rtoml>=0.13.0",
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
[[project.authors]]
|
|
20
|
+
name = "Dmitry Orlov"
|
|
21
|
+
email = "orlovdl@gmail.com"
|
|
22
|
+
|
|
23
|
+
[project.urls]
|
|
24
|
+
Documentation = "https://mosquito.github.io/backlog-mcp/"
|
|
25
|
+
|
|
26
|
+
[project.scripts]
|
|
27
|
+
backlog = "backlog_mcp.cli:main"
|
|
28
|
+
backlog-mcp = "backlog_mcp.cli:server_main"
|
|
29
|
+
|
|
30
|
+
[build-system]
|
|
31
|
+
requires = ["uv_build>=0.12.9,<0.13.0"]
|
|
32
|
+
build-backend = "uv_build"
|
|
33
|
+
|
|
34
|
+
[tool.uv.build-backend]
|
|
35
|
+
module-name = "backlog_mcp"
|
|
36
|
+
|
|
37
|
+
[tool.ruff]
|
|
38
|
+
line-length = 100
|
|
39
|
+
target-version = "py314"
|
|
40
|
+
|
|
41
|
+
[tool.ruff.lint]
|
|
42
|
+
select = [
|
|
43
|
+
"E",
|
|
44
|
+
"F",
|
|
45
|
+
"I",
|
|
46
|
+
"W",
|
|
47
|
+
"UP",
|
|
48
|
+
"B",
|
|
49
|
+
"C4",
|
|
50
|
+
"RET",
|
|
51
|
+
"SIM",
|
|
52
|
+
"TID",
|
|
53
|
+
]
|
|
54
|
+
|
|
55
|
+
[tool.ruff.lint.per-file-ignores]
|
|
56
|
+
"benchmarks/**" = ["E501"]
|
|
57
|
+
|
|
58
|
+
[tool.mypy]
|
|
59
|
+
python_version = "3.14"
|
|
60
|
+
strict = true
|
|
61
|
+
warn_unused_ignores = true
|
|
62
|
+
disallow_untyped_defs = true
|
|
63
|
+
disallow_untyped_decorators = false
|
|
64
|
+
|
|
65
|
+
[[tool.mypy.overrides]]
|
|
66
|
+
module = ["argclass"]
|
|
67
|
+
ignore_missing_imports = true
|
|
68
|
+
|
|
69
|
+
[tool.pytest.ini_options]
|
|
70
|
+
asyncio_mode = "auto"
|
|
71
|
+
addopts = "-q"
|
|
72
|
+
testpaths = ["tests"]
|
|
73
|
+
|
|
74
|
+
[tool.coverage.report]
|
|
75
|
+
exclude_also = [
|
|
76
|
+
"if TYPE_CHECKING:",
|
|
77
|
+
"raise NotImplementedError",
|
|
78
|
+
]
|
|
79
|
+
|
|
80
|
+
[dependency-groups]
|
|
81
|
+
dev = [
|
|
82
|
+
"markdown-pytest>=0.6.6",
|
|
83
|
+
"mypy>=1.14",
|
|
84
|
+
"pytest>=8.3",
|
|
85
|
+
"pytest-asyncio>=0.25",
|
|
86
|
+
"pytest-cov>=6.0",
|
|
87
|
+
"ruff>=0.9",
|
|
88
|
+
]
|
|
89
|
+
docs = [
|
|
90
|
+
"furo>=2025.12.19",
|
|
91
|
+
"myst-parser>=4.0.1",
|
|
92
|
+
"sphinx>=8.1.3",
|
|
93
|
+
]
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "backlog-tiny-mcp"
|
|
3
|
+
version = "0.35.0"
|
|
4
|
+
description = "A project backlog over MCP: projects scoped to directories, tasks scoped to projects"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
authors = [
|
|
7
|
+
{ name = "Dmitry Orlov", email = "orlovdl@gmail.com" }
|
|
8
|
+
]
|
|
9
|
+
requires-python = ">=3.14"
|
|
10
|
+
dependencies = [
|
|
11
|
+
"aiohttp-tiny-mcp[jwt,skills]~=0.10.1",
|
|
12
|
+
"aiosql>=15.0",
|
|
13
|
+
"aiosqlite>=0.21.0",
|
|
14
|
+
"argclass>=1.11.0",
|
|
15
|
+
"bcrypt>=5.0.0",
|
|
16
|
+
"model2vec>=0.9.0",
|
|
17
|
+
"numpy>=2.0",
|
|
18
|
+
"rich>=15.0.0",
|
|
19
|
+
"rtoml>=0.13.0",
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
[project.urls]
|
|
23
|
+
Documentation = "https://mosquito.github.io/backlog-mcp/"
|
|
24
|
+
|
|
25
|
+
[project.scripts]
|
|
26
|
+
backlog = "backlog_mcp.cli:main"
|
|
27
|
+
backlog-mcp = "backlog_mcp.cli:server_main"
|
|
28
|
+
|
|
29
|
+
[build-system]
|
|
30
|
+
requires = ["uv_build>=0.12.9,<0.13.0"]
|
|
31
|
+
build-backend = "uv_build"
|
|
32
|
+
|
|
33
|
+
# The PyPI name differs from the import package: `backlog-mcp` on PyPI is another project.
|
|
34
|
+
[tool.uv.build-backend]
|
|
35
|
+
module-name = "backlog_mcp"
|
|
36
|
+
|
|
37
|
+
[dependency-groups]
|
|
38
|
+
dev = [
|
|
39
|
+
"markdown-pytest>=0.6.6",
|
|
40
|
+
"mypy>=1.14",
|
|
41
|
+
"pytest>=8.3",
|
|
42
|
+
"pytest-asyncio>=0.25",
|
|
43
|
+
"pytest-cov>=6.0",
|
|
44
|
+
"ruff>=0.9",
|
|
45
|
+
]
|
|
46
|
+
docs = [
|
|
47
|
+
"furo>=2025.12.19",
|
|
48
|
+
"myst-parser>=4.0.1",
|
|
49
|
+
"sphinx>=8.1.3",
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
[tool.ruff]
|
|
53
|
+
line-length = 100
|
|
54
|
+
target-version = "py314"
|
|
55
|
+
|
|
56
|
+
[tool.ruff.lint]
|
|
57
|
+
select = ["E", "F", "I", "W", "UP", "B", "C4", "RET", "SIM", "TID"]
|
|
58
|
+
|
|
59
|
+
[tool.ruff.lint.per-file-ignores]
|
|
60
|
+
# Benchmark data: long literal rows and model identifiers.
|
|
61
|
+
"benchmarks/**" = ["E501"]
|
|
62
|
+
|
|
63
|
+
[tool.mypy]
|
|
64
|
+
python_version = "3.14"
|
|
65
|
+
strict = true
|
|
66
|
+
warn_unused_ignores = true
|
|
67
|
+
disallow_untyped_defs = true
|
|
68
|
+
# The registry decorators in aiohttp-tiny-mcp are unannotated; the handlers below them are not.
|
|
69
|
+
disallow_untyped_decorators = false
|
|
70
|
+
|
|
71
|
+
[[tool.mypy.overrides]]
|
|
72
|
+
module = ["argclass"]
|
|
73
|
+
ignore_missing_imports = true
|
|
74
|
+
|
|
75
|
+
[tool.pytest.ini_options]
|
|
76
|
+
asyncio_mode = "auto"
|
|
77
|
+
addopts = "-q"
|
|
78
|
+
testpaths = ["tests"]
|
|
79
|
+
|
|
80
|
+
[tool.coverage.report]
|
|
81
|
+
exclude_also = ["if TYPE_CHECKING:", "raise NotImplementedError"]
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"""backlog-mcp: a project backlog on the command line and over MCP, on stdio or over HTTP.
|
|
2
|
+
|
|
3
|
+
Tasks belong to projects, and a project is a directory tree. The working directory therefore
|
|
4
|
+
decides which backlog a command works on, with nothing to pass. `backlog mcp` serves the same
|
|
5
|
+
data over MCP: on stdio by default, or over HTTP behind Basic auth with `--protocol=http`.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from .backlog import Backlog, UnknownProject
|
|
11
|
+
from .cli import CLI, build, main, server_main
|
|
12
|
+
from .database import Database
|
|
13
|
+
from .models import Priority, Status
|
|
14
|
+
from .server import VERSION, registry, use
|
|
15
|
+
|
|
16
|
+
__all__ = [
|
|
17
|
+
"CLI",
|
|
18
|
+
"VERSION",
|
|
19
|
+
"Backlog",
|
|
20
|
+
"Priority",
|
|
21
|
+
"Status",
|
|
22
|
+
"Database",
|
|
23
|
+
"UnknownProject",
|
|
24
|
+
"build",
|
|
25
|
+
"main",
|
|
26
|
+
"registry",
|
|
27
|
+
"server_main",
|
|
28
|
+
"use",
|
|
29
|
+
]
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
"""Basic and JWT credentials verified against trusted server configuration."""
|
|
2
|
+
|
|
3
|
+
import asyncio
|
|
4
|
+
import re
|
|
5
|
+
from base64 import b64decode
|
|
6
|
+
from collections.abc import Sequence
|
|
7
|
+
from concurrent.futures import ThreadPoolExecutor
|
|
8
|
+
from dataclasses import replace
|
|
9
|
+
from functools import partial
|
|
10
|
+
|
|
11
|
+
import bcrypt
|
|
12
|
+
from aiohttp import web
|
|
13
|
+
from aiohttp_tiny_mcp import Authentication, BasicAuth, Principal, Unauthorized
|
|
14
|
+
from aiohttp_tiny_mcp.auth import TokenVerifier
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def decode_pair(token: str) -> tuple[str, str] | None:
|
|
18
|
+
"""`user:password` from base64, standard or URL-safe alphabet, or `None` when malformed."""
|
|
19
|
+
stripped = token.strip()
|
|
20
|
+
padded = stripped + "=" * (-len(stripped) % 4)
|
|
21
|
+
for altchars in (None, b"-_"):
|
|
22
|
+
try:
|
|
23
|
+
decoded = b64decode(padded, altchars=altchars, validate=True).decode("utf-8")
|
|
24
|
+
except ValueError, UnicodeDecodeError:
|
|
25
|
+
continue
|
|
26
|
+
user, separator, password = decoded.partition(":")
|
|
27
|
+
return (user, password) if separator else None
|
|
28
|
+
return None
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
REALM = "backlog-mcp"
|
|
32
|
+
BCRYPT_COST = 10
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def user_identity(username: str) -> str:
|
|
36
|
+
"""A username identifies one account across supported authentication methods."""
|
|
37
|
+
if (
|
|
38
|
+
not username
|
|
39
|
+
or username != username.strip()
|
|
40
|
+
or any(ord(c) < 32 or ord(c) == 127 for c in username)
|
|
41
|
+
):
|
|
42
|
+
raise ValueError("principal must be a non-empty username without control characters")
|
|
43
|
+
return username
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
# Trusted request-local result from the pre-dispatch authentication middleware.
|
|
47
|
+
VERIFIED: web.RequestKey[dict[Authentication, Principal | None]] = web.RequestKey(
|
|
48
|
+
"backlog_verified_principals", dict
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def request_token(request: web.Request, *, scheme: str, query_parameter: str) -> str:
|
|
53
|
+
"""Read query credentials only when no Authorization header is present."""
|
|
54
|
+
if "Authorization" in request.headers:
|
|
55
|
+
parts = request.headers["Authorization"].split()
|
|
56
|
+
return parts[1] if len(parts) == 2 and parts[0].lower() == scheme.lower() else ""
|
|
57
|
+
token = request.query.get(query_parameter, "")
|
|
58
|
+
return token.replace(" ", "+") if scheme == "Basic" else token
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def credentials(request: web.Request) -> tuple[str, str] | None:
|
|
62
|
+
"""Decode Basic credentials from the header or the auth query parameter."""
|
|
63
|
+
return decode_pair(request_token(request, scheme="Basic", query_parameter="auth"))
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def validate_account(username: str, password: str) -> None:
|
|
67
|
+
"""Reject values that cannot be represented by HTTP Basic credentials."""
|
|
68
|
+
user_identity(username)
|
|
69
|
+
if (
|
|
70
|
+
not password
|
|
71
|
+
or ":" in username
|
|
72
|
+
or any(ord(char) < 32 or ord(char) == 127 for char in password)
|
|
73
|
+
):
|
|
74
|
+
raise ValueError(
|
|
75
|
+
"Basic accounts need a non-empty password without controls "
|
|
76
|
+
"and a username without a colon"
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def validate_bcrypt_cost(value: int | str) -> int:
|
|
81
|
+
"""Accept the bcrypt work-factor range."""
|
|
82
|
+
if isinstance(value, bool) or not isinstance(value, (int, str)):
|
|
83
|
+
raise ValueError("Bcrypt cost must be an integer between 4 and 31")
|
|
84
|
+
cost = int(value)
|
|
85
|
+
if not 4 <= cost <= 31:
|
|
86
|
+
raise ValueError("Bcrypt cost must be between 4 and 31")
|
|
87
|
+
return cost
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def bcrypt_account(value: str, cost: int = BCRYPT_COST) -> str:
|
|
91
|
+
"""Convert one plaintext entry or validate an existing bcrypt entry."""
|
|
92
|
+
cost = validate_bcrypt_cost(cost)
|
|
93
|
+
if value.startswith("bcrypt|") and ":" not in value:
|
|
94
|
+
username, separator, hashed = value.removeprefix("bcrypt|").rpartition("|")
|
|
95
|
+
if not separator or not re.fullmatch(
|
|
96
|
+
r"\$2[aby]\$(?:0[4-9]|[12][0-9]|3[01])\$[./A-Za-z0-9]{53}", hashed
|
|
97
|
+
):
|
|
98
|
+
raise ValueError("Use bcrypt|username|<hash> with a valid bcrypt hash")
|
|
99
|
+
validate_account(username, hashed)
|
|
100
|
+
return value
|
|
101
|
+
username, separator, password = value.partition(":")
|
|
102
|
+
if not separator:
|
|
103
|
+
raise ValueError("Use username:password or bcrypt|username|<hash> for Basic accounts")
|
|
104
|
+
validate_account(username, password)
|
|
105
|
+
encoded = password.encode("utf-8")
|
|
106
|
+
if len(encoded) > 72:
|
|
107
|
+
raise ValueError("Bcrypt passwords must not exceed 72 UTF-8 bytes")
|
|
108
|
+
hashed = bcrypt.hashpw(encoded, bcrypt.gensalt(rounds=cost)).decode("ascii")
|
|
109
|
+
return f"bcrypt|{username}|{hashed}"
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def normalize_accounts(values: Sequence[str], cost: int = BCRYPT_COST) -> list[str]:
|
|
113
|
+
"""Hash configuration values in a worker while keeping existing hashes unchanged."""
|
|
114
|
+
cost = validate_bcrypt_cost(cost)
|
|
115
|
+
if not values:
|
|
116
|
+
return []
|
|
117
|
+
with ThreadPoolExecutor(max_workers=1) as executor:
|
|
118
|
+
return list(executor.map(partial(bcrypt_account, cost=cost), values))
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
class BasicAuthentication(BasicAuth):
|
|
122
|
+
"""Verify bcrypt passwords over Basic headers and query credentials."""
|
|
123
|
+
|
|
124
|
+
def __init__(
|
|
125
|
+
self,
|
|
126
|
+
*accounts: tuple[str, str],
|
|
127
|
+
hashed_accounts: Sequence[tuple[str, str]] = (),
|
|
128
|
+
cost: int = BCRYPT_COST,
|
|
129
|
+
) -> None:
|
|
130
|
+
super().__init__(realm=REALM)
|
|
131
|
+
if not accounts and not hashed_accounts:
|
|
132
|
+
raise ValueError("At least one Basic account is required")
|
|
133
|
+
for username, password in (*accounts, *hashed_accounts):
|
|
134
|
+
validate_account(username, password)
|
|
135
|
+
normalized = normalize_accounts(
|
|
136
|
+
[f"{username}:{password}" for username, password in accounts]
|
|
137
|
+
+ [f"bcrypt|{username}|{hashed}" for username, hashed in hashed_accounts],
|
|
138
|
+
cost=cost,
|
|
139
|
+
)
|
|
140
|
+
self.password_hashes: dict[str, bytes] = {}
|
|
141
|
+
for value in normalized:
|
|
142
|
+
username, hashed = value.removeprefix("bcrypt|").rsplit("|", 1)
|
|
143
|
+
if username in self.password_hashes:
|
|
144
|
+
raise ValueError("Basic account usernames must be unique")
|
|
145
|
+
self.password_hashes[username] = hashed.encode("ascii")
|
|
146
|
+
|
|
147
|
+
async def verify(self, username: str, password: str) -> Principal | None:
|
|
148
|
+
hashed = self.password_hashes.get(username)
|
|
149
|
+
expected = hashed if hashed is not None else next(iter(self.password_hashes.values()))
|
|
150
|
+
encoded = password.encode("utf-8")
|
|
151
|
+
if len(encoded) > 72:
|
|
152
|
+
return None
|
|
153
|
+
try:
|
|
154
|
+
matched = await asyncio.to_thread(bcrypt.checkpw, encoded, expected)
|
|
155
|
+
except ValueError:
|
|
156
|
+
return None
|
|
157
|
+
return Principal(subject=username) if hashed is not None and matched else None
|
|
158
|
+
|
|
159
|
+
async def authenticate(self, request: web.Request) -> Principal | None:
|
|
160
|
+
verified: dict[Authentication, Principal | None] = request.setdefault(VERIFIED, {})
|
|
161
|
+
if self in verified:
|
|
162
|
+
return verified[self]
|
|
163
|
+
given = credentials(request)
|
|
164
|
+
if given is None or any(ord(char) < 32 or ord(char) == 127 for char in "".join(given)):
|
|
165
|
+
verified[self] = None
|
|
166
|
+
return None
|
|
167
|
+
principal = await self.verify(*given)
|
|
168
|
+
verified[self] = (
|
|
169
|
+
replace(principal, namespace=user_identity(given[0])) if principal else None
|
|
170
|
+
)
|
|
171
|
+
return verified[self]
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
class JWTAuthentication(Authentication):
|
|
175
|
+
"""Authenticate externally issued JWTs without advertising an OAuth server."""
|
|
176
|
+
|
|
177
|
+
def __init__(self, verifier: TokenVerifier) -> None:
|
|
178
|
+
super().__init__()
|
|
179
|
+
self.verifier = verifier
|
|
180
|
+
|
|
181
|
+
async def authenticate(self, request: web.Request) -> Principal | None:
|
|
182
|
+
verified: dict[Authentication, Principal | None] = request.setdefault(VERIFIED, {})
|
|
183
|
+
if self in verified:
|
|
184
|
+
return verified[self]
|
|
185
|
+
token = request_token(request, scheme="Bearer", query_parameter="token")
|
|
186
|
+
principal = await self.verifier.verify(token) if token else None
|
|
187
|
+
if principal and principal.subject:
|
|
188
|
+
try:
|
|
189
|
+
identity = user_identity(principal.subject)
|
|
190
|
+
except ValueError:
|
|
191
|
+
verified[self] = None
|
|
192
|
+
else:
|
|
193
|
+
verified[self] = replace(principal, namespace=identity)
|
|
194
|
+
else:
|
|
195
|
+
verified[self] = None
|
|
196
|
+
return verified[self]
|
|
197
|
+
|
|
198
|
+
def challenge(self, refusal: Unauthorized) -> str:
|
|
199
|
+
return f'Bearer realm="{REALM}"'
|