mcp-software-design 0.1.0

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Muzaffar Qosimov
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.
package/README.md ADDED
@@ -0,0 +1,111 @@
1
+ # mcp-software-design
2
+
3
+ An [MCP](https://modelcontextprotocol.io) server that teaches and helps apply
4
+ **software-design guidance** — the SOLID principles, the OOP pillars, DRY /
5
+ KISS / YAGNI, and the 23 Gang-of-Four design patterns — plus pattern
6
+ scaffolding and heuristic code-smell detection.
7
+
8
+ It's the companion to
9
+ [`mcp-udacity-commit`](../mcp-udacity-commit): same stack (TypeScript, the MCP
10
+ SDK, stdio transport), same shape (pure logic modules + thin server wiring).
11
+
12
+ ## Why this exists — and its one honest caveat
13
+
14
+ The commit server can *lint*: "subject ≤ 50 chars" is objectively checkable.
15
+ **Design principles and patterns are not like that** — "does this violate
16
+ SRP?" or "should this be a Factory?" are judgment calls, not lint rules.
17
+
18
+ So this server does **not** pretend to grade your architecture pass/fail.
19
+ Instead it does the parts that are genuinely reliable, and hands the judgment
20
+ to the model:
21
+
22
+ | Capability | Primitive | What it gives you |
23
+ |---|---|---|
24
+ | **Reference** | resources + `explain_concept` | Authoritative, consistent definitions so the model cites the same thing every time. |
25
+ | **Scaffolding** | `scaffold_pattern` | A language-agnostic skeleton of a pattern's participants. |
26
+ | **Smell heuristics** | `check_smells` | A few genuinely-checkable proxies (long method, deep nesting, …) — **hints, never verdicts**. |
27
+ | **Explain / apply** | `review_design`, `apply_pattern` prompts | Prime the model to review or refactor, grounded in the tools + resources above. |
28
+
29
+ Design analysis is a judgment call, so the "explain/apply helper" is exposed
30
+ as MCP **prompts** (which drive the client's model) rather than server code
31
+ pretending to understand your snippet.
32
+
33
+ ## Tools
34
+
35
+ - **`list_catalog`** `{ kind? }` — list concepts, optionally filtered
36
+ (`principle` | `pattern` | `creational` | `structural` | `behavioral`).
37
+ - **`explain_concept`** `{ name }` — full guidance for one principle or
38
+ pattern (intent, when-to-use, trade-offs, participants). Accepts a slug,
39
+ name, or alias (`"SRP"`, `"open-closed"`, `"pubsub"`).
40
+ - **`scaffold_pattern`** `{ pattern, names? }` — pseudo-code skeleton for a GoF
41
+ pattern; `names` optionally renames roles to your domain
42
+ (`{ "Product": "Notification" }`).
43
+ - **`check_smells`** `{ code, …thresholds? }` — heuristic scan for long
44
+ method, large class, long parameter list, deep nesting, duplication, and
45
+ large file. Each finding names the principle it hints at plus a suggested
46
+ refactor. All thresholds are overridable per call.
47
+
48
+ ## Resources
49
+
50
+ - **`design://principles`** — SOLID, OOP pillars, DRY, KISS, YAGNI, and more.
51
+ - **`design://patterns`** — the 23 GoF patterns, grouped creational /
52
+ structural / behavioral.
53
+ - **`design://smells`** — what `check_smells` detects, its thresholds, and its
54
+ caveats.
55
+
56
+ ## Prompts
57
+
58
+ - **`review_design`** `{ code, focus? }` — review a snippet against the
59
+ principles/patterns, grounded in `check_smells` + the resources.
60
+ - **`apply_pattern`** `{ pattern, code }` — refactor a snippet to apply a named
61
+ pattern (and first judge whether it even fits).
62
+
63
+ ## Install & run
64
+
65
+ ```bash
66
+ npm install
67
+ npm run build # compiles src → build
68
+ npm start # runs the stdio server
69
+ npm test # builds, then runs the unit tests
70
+ npm run test:client # end-to-end check against the built server
71
+ ```
72
+
73
+ ### Register with Claude Code
74
+
75
+ ```bash
76
+ claude mcp add software-design -- node /absolute/path/to/mcp-software-design/build/index.js
77
+ ```
78
+
79
+ Or in an MCP client config:
80
+
81
+ ```json
82
+ {
83
+ "mcpServers": {
84
+ "software-design": {
85
+ "command": "node",
86
+ "args": ["/absolute/path/to/mcp-software-design/build/index.js"]
87
+ }
88
+ }
89
+ }
90
+ ```
91
+
92
+ ## Layout
93
+
94
+ ```
95
+ src/
96
+ catalog.ts # principles + 23 GoF patterns (data + lookup + markdown)
97
+ smells.ts # pure, testable code-smell heuristics
98
+ scaffold.ts # renders a pattern's participants into a skeleton
99
+ index.ts # MCP wiring: resources, tools, prompts
100
+ test/
101
+ catalog.test.mjs # catalog lookup + scaffolder
102
+ smells.test.mjs # smell detectors (incl. string/comment edge cases)
103
+ ```
104
+
105
+ The `src/*.ts` logic modules are pure and side-effect-free, so they're unit
106
+ tested directly against the compiled output — the server (`index.ts`) is only
107
+ thin wiring on top.
108
+
109
+ ## License
110
+
111
+ MIT