mcp-react-toolkit 1.0.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.
Files changed (228) hide show
  1. package/CONTRIBUTING.md +157 -0
  2. package/HOW_IT_WORKS.md +270 -0
  3. package/README.md +259 -0
  4. package/demo/legacy-app/src/App.jsx +12 -0
  5. package/demo/legacy-app/src/components/Dashboard.jsx +51 -0
  6. package/demo/legacy-app/src/components/UserCard.jsx +32 -0
  7. package/demo/legacy-app/src/hooks/useUsers.js +38 -0
  8. package/demo/legacy-app/src/utils/api.js +30 -0
  9. package/glama.json +4 -0
  10. package/package.json +39 -0
  11. package/tools/accessibility-checker/build/index.d.ts +3 -0
  12. package/tools/accessibility-checker/build/index.d.ts.map +1 -0
  13. package/tools/accessibility-checker/build/index.js +112 -0
  14. package/tools/accessibility-checker/build/index.js.map +1 -0
  15. package/tools/accessibility-checker/build/rules.d.ts +22 -0
  16. package/tools/accessibility-checker/build/rules.d.ts.map +1 -0
  17. package/tools/accessibility-checker/build/rules.js +244 -0
  18. package/tools/accessibility-checker/build/rules.js.map +1 -0
  19. package/tools/accessibility-checker/build/rules.test.d.ts +2 -0
  20. package/tools/accessibility-checker/build/rules.test.d.ts.map +1 -0
  21. package/tools/accessibility-checker/build/rules.test.js.map +1 -0
  22. package/tools/accessibility-checker/package.json +20 -0
  23. package/tools/code-modernizer/build/index.d.ts +3 -0
  24. package/tools/code-modernizer/build/index.d.ts.map +1 -0
  25. package/tools/code-modernizer/build/index.js +58 -0
  26. package/tools/code-modernizer/build/index.js.map +1 -0
  27. package/tools/code-modernizer/build/tools/01-convert-to-typescript.d.ts +3 -0
  28. package/tools/code-modernizer/build/tools/01-convert-to-typescript.d.ts.map +1 -0
  29. package/tools/code-modernizer/build/tools/01-convert-to-typescript.js +110 -0
  30. package/tools/code-modernizer/build/tools/01-convert-to-typescript.js.map +1 -0
  31. package/tools/code-modernizer/build/types.d.ts +57 -0
  32. package/tools/code-modernizer/build/types.d.ts.map +1 -0
  33. package/tools/code-modernizer/build/types.js +5 -0
  34. package/tools/code-modernizer/build/types.js.map +1 -0
  35. package/tools/code-modernizer/build/utils/ast-parser.d.ts +6 -0
  36. package/tools/code-modernizer/build/utils/ast-parser.d.ts.map +1 -0
  37. package/tools/code-modernizer/build/utils/ast-parser.js +177 -0
  38. package/tools/code-modernizer/build/utils/ast-parser.js.map +1 -0
  39. package/tools/code-modernizer/build/utils/file-ops.d.ts +8 -0
  40. package/tools/code-modernizer/build/utils/file-ops.d.ts.map +1 -0
  41. package/tools/code-modernizer/build/utils/file-ops.js +63 -0
  42. package/tools/code-modernizer/build/utils/file-ops.js.map +1 -0
  43. package/tools/code-modernizer/build/utils/file-ops.test.d.ts +2 -0
  44. package/tools/code-modernizer/build/utils/file-ops.test.d.ts.map +1 -0
  45. package/tools/code-modernizer/build/utils/file-ops.test.js.map +1 -0
  46. package/tools/code-modernizer/build/utils/type-generator.d.ts +4 -0
  47. package/tools/code-modernizer/build/utils/type-generator.d.ts.map +1 -0
  48. package/tools/code-modernizer/build/utils/type-generator.js +37 -0
  49. package/tools/code-modernizer/build/utils/type-generator.js.map +1 -0
  50. package/tools/code-modernizer/package.json +23 -0
  51. package/tools/component-factory/build/index.d.ts +3 -0
  52. package/tools/component-factory/build/index.d.ts.map +1 -0
  53. package/tools/component-factory/build/index.js +534 -0
  54. package/tools/component-factory/build/index.js.map +1 -0
  55. package/tools/component-factory/build/utils.d.ts +6 -0
  56. package/tools/component-factory/build/utils.d.ts.map +1 -0
  57. package/tools/component-factory/build/utils.js +11 -0
  58. package/tools/component-factory/build/utils.js.map +1 -0
  59. package/tools/component-factory/build/utils.test.d.ts +2 -0
  60. package/tools/component-factory/build/utils.test.d.ts.map +1 -0
  61. package/tools/component-factory/build/utils.test.js.map +1 -0
  62. package/tools/component-factory/package.json +20 -0
  63. package/tools/component-factory/templates/accordion.tsx +57 -0
  64. package/tools/component-factory/templates/alert.tsx +59 -0
  65. package/tools/component-factory/templates/aspect-ratio.tsx +8 -0
  66. package/tools/component-factory/templates/avatar.tsx +51 -0
  67. package/tools/component-factory/templates/badge.tsx +37 -0
  68. package/tools/component-factory/templates/breadcrumb.tsx +116 -0
  69. package/tools/component-factory/templates/button.tsx +57 -0
  70. package/tools/component-factory/templates/calendar.tsx +66 -0
  71. package/tools/component-factory/templates/card.tsx +80 -0
  72. package/tools/component-factory/templates/checkbox.tsx +31 -0
  73. package/tools/component-factory/templates/collapsible.tsx +11 -0
  74. package/tools/component-factory/templates/command.tsx +150 -0
  75. package/tools/component-factory/templates/context-menu.tsx +199 -0
  76. package/tools/component-factory/templates/dialog.tsx +123 -0
  77. package/tools/component-factory/templates/drawer.tsx +118 -0
  78. package/tools/component-factory/templates/dropdown-menu.tsx +201 -0
  79. package/tools/component-factory/templates/form.tsx +178 -0
  80. package/tools/component-factory/templates/hover-card.tsx +29 -0
  81. package/tools/component-factory/templates/input-otp.tsx +71 -0
  82. package/tools/component-factory/templates/input.tsx +23 -0
  83. package/tools/component-factory/templates/label.tsx +27 -0
  84. package/tools/component-factory/templates/menubar.tsx +236 -0
  85. package/tools/component-factory/templates/navigation-menu.tsx +128 -0
  86. package/tools/component-factory/templates/pagination.tsx +120 -0
  87. package/tools/component-factory/templates/popover.tsx +31 -0
  88. package/tools/component-factory/templates/progress.tsx +28 -0
  89. package/tools/component-factory/templates/radio-group.tsx +44 -0
  90. package/tools/component-factory/templates/scroll-area.tsx +48 -0
  91. package/tools/component-factory/templates/select.tsx +159 -0
  92. package/tools/component-factory/templates/separator.tsx +32 -0
  93. package/tools/component-factory/templates/sheet.tsx +140 -0
  94. package/tools/component-factory/templates/skeleton.tsx +15 -0
  95. package/tools/component-factory/templates/slider.tsx +28 -0
  96. package/tools/component-factory/templates/sonner.tsx +31 -0
  97. package/tools/component-factory/templates/switch.tsx +29 -0
  98. package/tools/component-factory/templates/table.tsx +117 -0
  99. package/tools/component-factory/templates/tabs.tsx +56 -0
  100. package/tools/component-factory/templates/textarea.tsx +22 -0
  101. package/tools/component-factory/templates/toggle-group.tsx +61 -0
  102. package/tools/component-factory/templates/toggle.tsx +45 -0
  103. package/tools/component-factory/templates/tooltip.tsx +30 -0
  104. package/tools/dep-auditor/build/index.d.ts +18 -0
  105. package/tools/dep-auditor/build/index.d.ts.map +1 -0
  106. package/tools/dep-auditor/build/index.js +247 -0
  107. package/tools/dep-auditor/build/index.js.map +1 -0
  108. package/tools/dep-auditor/build/index.test.d.ts +2 -0
  109. package/tools/dep-auditor/build/index.test.d.ts.map +1 -0
  110. package/tools/dep-auditor/build/index.test.js.map +1 -0
  111. package/tools/dep-auditor/package.json +20 -0
  112. package/tools/generate-tests/build/analyzer.d.ts +31 -0
  113. package/tools/generate-tests/build/analyzer.d.ts.map +1 -0
  114. package/tools/generate-tests/build/analyzer.js +105 -0
  115. package/tools/generate-tests/build/analyzer.js.map +1 -0
  116. package/tools/generate-tests/build/analyzer.test.d.ts +2 -0
  117. package/tools/generate-tests/build/analyzer.test.d.ts.map +1 -0
  118. package/tools/generate-tests/build/analyzer.test.js.map +1 -0
  119. package/tools/generate-tests/build/generators.d.ts +6 -0
  120. package/tools/generate-tests/build/generators.d.ts.map +1 -0
  121. package/tools/generate-tests/build/generators.js +161 -0
  122. package/tools/generate-tests/build/generators.js.map +1 -0
  123. package/tools/generate-tests/build/index.d.ts +3 -0
  124. package/tools/generate-tests/build/index.d.ts.map +1 -0
  125. package/tools/generate-tests/build/index.js +148 -0
  126. package/tools/generate-tests/build/index.js.map +1 -0
  127. package/tools/generate-tests/package.json +20 -0
  128. package/tools/json-viewer/build/index.d.ts +3 -0
  129. package/tools/json-viewer/build/index.d.ts.map +1 -0
  130. package/tools/json-viewer/build/index.js +282 -0
  131. package/tools/json-viewer/build/index.js.map +1 -0
  132. package/tools/json-viewer/build/utils.d.ts +5 -0
  133. package/tools/json-viewer/build/utils.d.ts.map +1 -0
  134. package/tools/json-viewer/build/utils.js +40 -0
  135. package/tools/json-viewer/build/utils.js.map +1 -0
  136. package/tools/json-viewer/build/utils.test.d.ts +2 -0
  137. package/tools/json-viewer/build/utils.test.d.ts.map +1 -0
  138. package/tools/json-viewer/build/utils.test.js.map +1 -0
  139. package/tools/json-viewer/package.json +20 -0
  140. package/tools/monorepo-manager/build/index.d.ts +3 -0
  141. package/tools/monorepo-manager/build/index.d.ts.map +1 -0
  142. package/tools/monorepo-manager/build/index.js +318 -0
  143. package/tools/monorepo-manager/build/index.js.map +1 -0
  144. package/tools/monorepo-manager/build/types.d.ts +17 -0
  145. package/tools/monorepo-manager/build/types.d.ts.map +1 -0
  146. package/tools/monorepo-manager/build/types.js +2 -0
  147. package/tools/monorepo-manager/build/types.js.map +1 -0
  148. package/tools/monorepo-manager/build/utils.d.ts +9 -0
  149. package/tools/monorepo-manager/build/utils.d.ts.map +1 -0
  150. package/tools/monorepo-manager/build/utils.js +135 -0
  151. package/tools/monorepo-manager/build/utils.js.map +1 -0
  152. package/tools/monorepo-manager/build/utils.test.d.ts +2 -0
  153. package/tools/monorepo-manager/build/utils.test.d.ts.map +1 -0
  154. package/tools/monorepo-manager/build/utils.test.js.map +1 -0
  155. package/tools/monorepo-manager/package.json +20 -0
  156. package/tools/quality-pipeline/build/index.d.ts +3 -0
  157. package/tools/quality-pipeline/build/index.d.ts.map +1 -0
  158. package/tools/quality-pipeline/build/index.js +538 -0
  159. package/tools/quality-pipeline/build/index.js.map +1 -0
  160. package/tools/quality-pipeline/build/utils.d.ts +9 -0
  161. package/tools/quality-pipeline/build/utils.d.ts.map +1 -0
  162. package/tools/quality-pipeline/build/utils.js +15 -0
  163. package/tools/quality-pipeline/build/utils.js.map +1 -0
  164. package/tools/quality-pipeline/build/utils.test.d.ts +2 -0
  165. package/tools/quality-pipeline/build/utils.test.d.ts.map +1 -0
  166. package/tools/quality-pipeline/build/utils.test.js.map +1 -0
  167. package/tools/quality-pipeline/package.json +20 -0
  168. package/tools/shared/build/McpServerBase.d.ts +18 -0
  169. package/tools/shared/build/McpServerBase.d.ts.map +1 -0
  170. package/tools/shared/build/McpServerBase.js +74 -0
  171. package/tools/shared/build/McpServerBase.js.map +1 -0
  172. package/tools/shared/build/ToolRegistry.d.ts +9 -0
  173. package/tools/shared/build/ToolRegistry.d.ts.map +1 -0
  174. package/tools/shared/build/ToolRegistry.js +22 -0
  175. package/tools/shared/build/ToolRegistry.js.map +1 -0
  176. package/tools/shared/build/index.d.ts +4 -0
  177. package/tools/shared/build/index.d.ts.map +1 -0
  178. package/tools/shared/build/index.js +4 -0
  179. package/tools/shared/build/index.js.map +1 -0
  180. package/tools/shared/build/types.d.ts +36 -0
  181. package/tools/shared/build/types.d.ts.map +1 -0
  182. package/tools/shared/build/types.js +5 -0
  183. package/tools/shared/build/types.js.map +1 -0
  184. package/tools/shared/package.json +23 -0
  185. package/tools/typescript-enforcer/build/index.d.ts +3 -0
  186. package/tools/typescript-enforcer/build/index.d.ts.map +1 -0
  187. package/tools/typescript-enforcer/build/index.js +155 -0
  188. package/tools/typescript-enforcer/build/index.js.map +1 -0
  189. package/tools/typescript-enforcer/build/rules/branded-types.d.ts +3 -0
  190. package/tools/typescript-enforcer/build/rules/branded-types.d.ts.map +1 -0
  191. package/tools/typescript-enforcer/build/rules/branded-types.js +4 -0
  192. package/tools/typescript-enforcer/build/rules/branded-types.js.map +1 -0
  193. package/tools/typescript-enforcer/build/rules/discriminated-unions.d.ts +3 -0
  194. package/tools/typescript-enforcer/build/rules/discriminated-unions.d.ts.map +1 -0
  195. package/tools/typescript-enforcer/build/rules/discriminated-unions.js +4 -0
  196. package/tools/typescript-enforcer/build/rules/discriminated-unions.js.map +1 -0
  197. package/tools/typescript-enforcer/build/rules/generics.d.ts +3 -0
  198. package/tools/typescript-enforcer/build/rules/generics.d.ts.map +1 -0
  199. package/tools/typescript-enforcer/build/rules/generics.js +182 -0
  200. package/tools/typescript-enforcer/build/rules/generics.js.map +1 -0
  201. package/tools/typescript-enforcer/build/rules/modifiers.d.ts +3 -0
  202. package/tools/typescript-enforcer/build/rules/modifiers.d.ts.map +1 -0
  203. package/tools/typescript-enforcer/build/rules/modifiers.js +214 -0
  204. package/tools/typescript-enforcer/build/rules/modifiers.js.map +1 -0
  205. package/tools/typescript-enforcer/build/rules/no-any.d.ts +3 -0
  206. package/tools/typescript-enforcer/build/rules/no-any.d.ts.map +1 -0
  207. package/tools/typescript-enforcer/build/rules/no-any.js +138 -0
  208. package/tools/typescript-enforcer/build/rules/no-any.js.map +1 -0
  209. package/tools/typescript-enforcer/build/rules/type-guards.d.ts +3 -0
  210. package/tools/typescript-enforcer/build/rules/type-guards.d.ts.map +1 -0
  211. package/tools/typescript-enforcer/build/rules/type-guards.js +176 -0
  212. package/tools/typescript-enforcer/build/rules/type-guards.js.map +1 -0
  213. package/tools/typescript-enforcer/build/rules/utility-types.d.ts +3 -0
  214. package/tools/typescript-enforcer/build/rules/utility-types.d.ts.map +1 -0
  215. package/tools/typescript-enforcer/build/rules/utility-types.js +101 -0
  216. package/tools/typescript-enforcer/build/rules/utility-types.js.map +1 -0
  217. package/tools/typescript-enforcer/build/scanner.d.ts +4 -0
  218. package/tools/typescript-enforcer/build/scanner.d.ts.map +1 -0
  219. package/tools/typescript-enforcer/build/scanner.js +114 -0
  220. package/tools/typescript-enforcer/build/scanner.js.map +1 -0
  221. package/tools/typescript-enforcer/build/scanner.test.d.ts +2 -0
  222. package/tools/typescript-enforcer/build/scanner.test.d.ts.map +1 -0
  223. package/tools/typescript-enforcer/build/scanner.test.js.map +1 -0
  224. package/tools/typescript-enforcer/build/types.d.ts +55 -0
  225. package/tools/typescript-enforcer/build/types.d.ts.map +1 -0
  226. package/tools/typescript-enforcer/build/types.js +2 -0
  227. package/tools/typescript-enforcer/build/types.js.map +1 -0
  228. package/tools/typescript-enforcer/package.json +20 -0
@@ -0,0 +1,157 @@
1
+ # Contributing to mcp-toolkit
2
+
3
+ Thanks for your interest. This project is a collection of MCP servers for React + TypeScript development automation. The fastest way to contribute is to implement one of the [planned tools](README.md#roadmap) from the roadmap.
4
+
5
+ ---
6
+
7
+ ## Quick start
8
+
9
+ ```sh
10
+ git clone https://github.com/Nishant-Chaudhary5338/mcp-toolkit.git
11
+ cd mcp-toolkit
12
+ npm install
13
+ npm run build
14
+ npm test
15
+ ```
16
+
17
+ Requires Node.js 20+.
18
+
19
+ ---
20
+
21
+ ## Adding a new MCP tool
22
+
23
+ Each tool lives in `tools/<tool-name>/` and extends the shared `McpServerBase` class.
24
+
25
+ ### 1. Scaffold the package
26
+
27
+ ```sh
28
+ mkdir -p tools/my-tool/src
29
+ ```
30
+
31
+ **`tools/my-tool/package.json`**
32
+ ```json
33
+ {
34
+ "name": "@mcp-showcase/my-tool",
35
+ "version": "1.0.0",
36
+ "type": "module",
37
+ "main": "./build/index.js",
38
+ "scripts": {
39
+ "build": "tsc && chmod +x build/index.js",
40
+ "dev": "tsc --watch",
41
+ "test": "vitest run"
42
+ },
43
+ "dependencies": {
44
+ "@mcp-showcase/shared": "*",
45
+ "@modelcontextprotocol/sdk": "^1.12.0"
46
+ },
47
+ "devDependencies": {
48
+ "@types/node": "^20.0.0",
49
+ "typescript": "^5.0.0",
50
+ "vitest": "^1.0.0"
51
+ }
52
+ }
53
+ ```
54
+
55
+ **`tools/my-tool/tsconfig.json`**
56
+ ```json
57
+ {
58
+ "extends": "../../tsconfig.base.json",
59
+ "compilerOptions": {
60
+ "outDir": "./build",
61
+ "rootDir": "./src"
62
+ },
63
+ "include": ["src"]
64
+ }
65
+ ```
66
+
67
+ ### 2. Implement the server
68
+
69
+ **`tools/my-tool/src/index.ts`**
70
+ ```typescript
71
+ #!/usr/bin/env node
72
+ import { McpServerBase } from '@mcp-showcase/shared';
73
+
74
+ class MyToolServer extends McpServerBase {
75
+ constructor() {
76
+ super({ name: 'my-tool', version: '1.0.0' });
77
+ }
78
+
79
+ protected registerTools(): void {
80
+ this.addTool(
81
+ 'my_action',
82
+ 'Describe what this tool does in one sentence.',
83
+ {
84
+ type: 'object',
85
+ properties: {
86
+ path: { type: 'string', description: 'Absolute path to target directory' },
87
+ },
88
+ required: ['path'],
89
+ },
90
+ async (args) => {
91
+ const { path } = args as { path: string };
92
+ // your logic here
93
+ return this.success({ result: `Processed ${path}` });
94
+ }
95
+ );
96
+ }
97
+ }
98
+
99
+ new MyToolServer().run();
100
+ ```
101
+
102
+ ### 3. Write tests
103
+
104
+ **`tools/my-tool/src/index.test.ts`**
105
+ ```typescript
106
+ import { describe, it, expect, vi } from 'vitest';
107
+
108
+ // Test the tool logic directly — bypass MCP transport entirely
109
+ describe('my-tool', () => {
110
+ it('returns success shape on valid input', async () => {
111
+ // Import your handler logic (extract it from the class if needed)
112
+ const result = { success: true, result: 'Processed /some/path' };
113
+ expect(result.success).toBe(true);
114
+ expect(result.result).toContain('/some/path');
115
+ });
116
+ });
117
+ ```
118
+
119
+ ### 4. Add to the workspace
120
+
121
+ In the root `package.json`, add `"tools/my-tool"` to the `workspaces` array and add the build step to the `build` script.
122
+
123
+ ### 5. Update the roadmap
124
+
125
+ In `README.md`, change the tool's row from `📋 Planned` to `🚧 In progress`, then to `✅ Done` once merged.
126
+
127
+ Also update `client/src/data/tools.ts` — set `available: true` for the tool's entry so the UI shows it as real.
128
+
129
+ ---
130
+
131
+ ## Standards
132
+
133
+ - **TypeScript strict** — no `any`, explicit return types on exports
134
+ - **Error handling** — use `this.error(err)` from `McpServerBase`; never let unhandled exceptions crash the server
135
+ - **Tests** — minimum 3 test cases per tool (happy path, invalid input, edge case)
136
+ - **No comments** that restate the code — comment only non-obvious constraints
137
+ - **One tool per file** for tools with complex logic (see `code-modernizer/src/tools/`)
138
+
139
+ ---
140
+
141
+ ## PR checklist
142
+
143
+ - [ ] `npm run build` passes with no TypeScript errors
144
+ - [ ] `npm test` passes
145
+ - [ ] README roadmap updated (status changed to ✅ Done)
146
+ - [ ] `client/src/data/tools.ts` entry updated (`available: true`)
147
+ - [ ] Tool tested manually with Claude Desktop or Cline
148
+
149
+ ---
150
+
151
+ ## Reporting bugs
152
+
153
+ Use [GitHub Issues](https://github.com/Nishant-Chaudhary5338/mcp-toolkit/issues/new?template=bug_report.md). Include the tool name, the input you passed, and the full error output.
154
+
155
+ ## Questions
156
+
157
+ Open a [Discussion](https://github.com/Nishant-Chaudhary5338/mcp-toolkit/discussions) — not an issue.
@@ -0,0 +1,270 @@
1
+ # How DevForge Works
2
+
3
+ > A plain-English explanation of the architecture, the protocol, and why everything runs fast.
4
+
5
+ ---
6
+
7
+ ## The 30-Second Version
8
+
9
+ When you click "Run" in the UI, this happens:
10
+
11
+ ```
12
+ Your Browser → Express Server → Node.js subprocess → your files on disk
13
+ ↑ ↓
14
+ Results ←────────────────────────────────────────────────────────
15
+ ```
16
+
17
+ No cloud. No AI model. No API keys. Everything executes locally on your machine in ~200–500ms.
18
+
19
+ ---
20
+
21
+ ## What Is MCP?
22
+
23
+ MCP stands for **Model Context Protocol**. It's a standard created by Anthropic so that AI models (like Claude) can call external tools — read files, run commands, search databases — in a safe, structured way.
24
+
25
+ Think of it like a job posting system:
26
+ - The **tool** says: "I can do these things, here's what I need as input"
27
+ - The **client** (normally an AI model, here our server) says: "Great, do this specific thing with these arguments"
28
+ - The **tool** does the work and returns a result
29
+
30
+ The protocol itself is just JSON messages sent back and forth. That's it.
31
+
32
+ ---
33
+
34
+ ## The Full Architecture
35
+
36
+ ```
37
+ ┌─────────────────────────────────────────────────────────────┐
38
+ │ Browser (React + Vite, port 5177) │
39
+ │ │
40
+ │ [Component Factory] [Code Modernizer] [Quality Pipeline] │
41
+ │ ↓ ↓ ↓ │
42
+ │ └──────────── POST /api/call ────────────┘ │
43
+ └─────────────────────────────┬───────────────────────────────┘
44
+ │ { server, tool, args }
45
+
46
+ ┌─────────────────────────────────────────────────────────────┐
47
+ │ Express Server (port 3002) server/src/index.ts │
48
+ │ │
49
+ │ Receives the request, looks up which tool to run, │
50
+ │ spawns it as a child process, speaks MCP protocol │
51
+ │ over stdin/stdout, returns the JSON result │
52
+ └─────────────────────────────┬───────────────────────────────┘
53
+ │ node tools/<name>/build/index.js
54
+
55
+ ┌─────────────────────────────────────────────────────────────┐
56
+ │ MCP Tool (Node.js subprocess) │
57
+ │ │
58
+ │ • Reads files from disk │
59
+ │ • Runs regex / AST analysis │
60
+ │ • Executes shell commands (tsc, vitest) │
61
+ │ • Returns structured JSON │
62
+ │ • Process exits when done │
63
+ └─────────────────────────────────────────────────────────────┘
64
+ ```
65
+
66
+ ---
67
+
68
+ ## Why Is It Fast?
69
+
70
+ Because **nothing leaves your machine**.
71
+
72
+ A typical AI-powered tool makes an HTTP request to a cloud API, waits for inference (500ms–3s), and returns. DevForge tools don't call any AI. They are just Node.js programs doing:
73
+
74
+ - `fs.readFileSync()` — read a file
75
+ - `RegExp.exec()` — match patterns
76
+ - `execSync('tsc --noEmit')` — run a command
77
+
78
+ Your CPU can do millions of regex matches per second. Reading 5 files off an SSD takes under 5ms. That's why the quality pipeline runs 5 checks across a project in under 500ms.
79
+
80
+ ---
81
+
82
+ ## The MCP Wire Protocol
83
+
84
+ This is what actually goes over stdin/stdout between the server and each tool. It's boring on purpose — just JSON lines.
85
+
86
+ ```
87
+ Server → Tool: { "jsonrpc": "2.0", "method": "initialize", "id": 1, "params": { ... } }
88
+ Tool → Server: { "jsonrpc": "2.0", "id": 1, "result": { "capabilities": {} } }
89
+
90
+ Server → Tool: { "jsonrpc": "2.0", "method": "initialized" }
91
+
92
+ Server → Tool: {
93
+ "jsonrpc": "2.0",
94
+ "method": "tools/call",
95
+ "id": 2,
96
+ "params": {
97
+ "name": "run_partial_pipeline",
98
+ "arguments": { "projectRoot": "/some/path", "stages": ["performance"] }
99
+ }
100
+ }
101
+
102
+ Tool → Server: {
103
+ "jsonrpc": "2.0",
104
+ "id": 2,
105
+ "result": {
106
+ "content": [{ "type": "text", "text": "{...your result as JSON string...}" }]
107
+ }
108
+ }
109
+ ```
110
+
111
+ The tool process starts, does a handshake, handles one tool call, returns the result, and exits. The server kills it. Next request = new process. Clean, isolated, no shared state.
112
+
113
+ ---
114
+
115
+ ## How Each Tool Works Internally
116
+
117
+ ### Component Factory
118
+
119
+ **What it does:** Generates production-ready React components from real shadcn/ui templates.
120
+
121
+ **How:**
122
+ 1. Reads the 41 `.tsx` template files from `tools/component-factory/templates/` at runtime
123
+ 2. Takes the template source code and transforms it — renames the component, adjusts imports, generates TypeScript prop interfaces
124
+ 3. Generates test files (Vitest) and story files (Storybook) as string templates
125
+ 4. Writes all files to the output path you specify
126
+
127
+ **The key insight:** These are real, working component files — not AI-hallucinated code. The template is already correct. The tool just adapts it and wires it together.
128
+
129
+ ```
130
+ button.tsx (template) → transform → /tmp/mcp-demo-components/Button/
131
+ Button.tsx ← the component
132
+ Button.test.tsx ← vitest tests
133
+ Button.stories.tsx ← storybook
134
+ Button.types.ts ← interfaces
135
+ ```
136
+
137
+ ---
138
+
139
+ ### Code Modernizer
140
+
141
+ **What it does:** Converts JavaScript/JSX files to TypeScript automatically.
142
+
143
+ **How:**
144
+ 1. Uses `@typescript-eslint/parser` to parse JS/JSX into an **AST** (Abstract Syntax Tree) — a structured tree representation of the code
145
+ 2. Walks the AST to find:
146
+ - Function declarations → what parameters they take
147
+ - `PropTypes` definitions → convert to TypeScript interfaces (`PropTypes.string` → `string`)
148
+ - React hooks → infer state types from initial values
149
+ 3. Rewrites the file with proper TypeScript annotations and saves it as `.ts`/`.tsx`
150
+
151
+ **Why AST instead of regex?**
152
+ Regex sees code as text. An AST sees code as structure. Regex can't tell the difference between a string `"PropTypes.string"` in a comment vs actual PropTypes usage. An AST can.
153
+
154
+ ```
155
+ // Input (JS) // Output (TS)
156
+ function UserCard(props) { interface UserCardProps {
157
+ const { name, age } = props; name: string
158
+ return <div>{name}</div> age: number
159
+ } }
160
+ UserCard.propTypes = { function UserCard({ name, age }: UserCardProps) {
161
+ name: PropTypes.string, return <div>{name}</div>
162
+ age: PropTypes.number, }
163
+ }
164
+ ```
165
+
166
+ ---
167
+
168
+ ### Quality Pipeline
169
+
170
+ **What it does:** Runs 5 automated checks on a project and gives an overall grade (A–F).
171
+
172
+ **How each stage works:**
173
+
174
+ | Stage | Mechanism |
175
+ |---|---|
176
+ | **Tests** | Runs `npx vitest --reporter=json --outputFile=/tmp/result.json`, reads the JSON file for pass/fail counts |
177
+ | **Type Safety** | Runs `tsc --noEmit`, counts lines matching `error TS` in the output |
178
+ | **Performance** | Scans import statements for known heavy libraries; scans 50 lines after each `useEffect` for missing cleanup (`removeEventListener`, `clearInterval`) |
179
+ | **Accessibility** | Runs multiline regex across full file content — catches `<img>` without alt, buttons without accessible text, inputs without labels, `onClick` without keyboard handlers |
180
+ | **Design Tokens** | Regex `/\d+px/` in style contexts catches *any* hardcoded pixel value — not a fixed list |
181
+
182
+ **Grading:**
183
+
184
+ ```
185
+ 0 fails, 0 warns → A
186
+ 0 fails, 1 warn → B
187
+ 0 fails, 2 warns → C
188
+ 1 fail → D
189
+ 2+ fails → F
190
+ ```
191
+
192
+ ---
193
+
194
+ ## The Subprocess Model (Why Tools Don't Have Ports)
195
+
196
+ Most people expect a backend service to bind to a port and stay running. MCP tools don't do that.
197
+
198
+ Each tool is just a script. The server spawns it fresh per request:
199
+
200
+ ```typescript
201
+ // server/src/mcp-client.ts
202
+ const child = spawn('node', ['tools/quality-pipeline/build/index.js'], {
203
+ stdio: ['pipe', 'pipe', 'pipe'] // control stdin/stdout/stderr
204
+ })
205
+
206
+ // Write JSON-RPC messages to stdin
207
+ child.stdin.write(JSON.stringify({ method: 'initialize', ... }) + '\n')
208
+
209
+ // Read responses from stdout
210
+ child.stdout.on('data', chunk => {
211
+ const response = JSON.parse(chunk)
212
+ // ... handle handshake, then send tool call, then resolve promise
213
+ })
214
+
215
+ // Process auto-exits after responding
216
+ // Server calls child.kill() to be safe
217
+ ```
218
+
219
+ Benefits of this model:
220
+ - **No port conflicts** — tools don't need network ports
221
+ - **Perfect isolation** — one failed request can't corrupt the next
222
+ - **Easy to add tools** — drop a new folder in `tools/`, no server config needed
223
+ - **Cheap to run** — processes live for ~200ms, not forever
224
+
225
+ ---
226
+
227
+ ## Workspace Structure
228
+
229
+ ```
230
+ mcp-showcase/
231
+ ├── tools/
232
+ │ ├── shared/ ← McpServerBase class all tools extend
233
+ │ ├── component-factory/
234
+ │ ├── code-modernizer/
235
+ │ └── quality-pipeline/
236
+ ├── server/ ← Express API bridge (port 3002)
237
+ ├── client/ ← Vite + React UI (port 5177)
238
+ └── demo/
239
+ └── legacy-app/src/ ← Sample JS project for Code Modernizer + Quality Pipeline demos
240
+ ```
241
+
242
+ It's an npm workspace. `npm install` at the root installs everything. Each package builds independently with `tsc`.
243
+
244
+ ---
245
+
246
+ ## In Production: Where the AI Fits In
247
+
248
+ DevForge demos the tools layer in isolation. But in a real MCP setup, an AI model sits between the user and the tools:
249
+
250
+ ```
251
+ User: "Review my Button component and fix any issues"
252
+
253
+ Claude (or any LLM)
254
+
255
+ Decides to call: review_component({ path: '/src/Button' })
256
+
257
+ Component Factory tool
258
+
259
+ Returns: { grade: "C", issues: ["missing displayName", "broken import"] }
260
+
261
+ Decides to call: fix_component({ path: '/src/Button' })
262
+
263
+ Component Factory tool
264
+
265
+ Returns: { fixed: true, changes: [...] }
266
+
267
+ Claude: "Done — fixed 2 issues: added displayName and corrected the import path"
268
+ ```
269
+
270
+ The AI doesn't write the code or run the analysis. It just decides *which tool to call* and *with what arguments*, based on the user's intent. The tools do the actual work — exactly as you've seen in this demo.
package/README.md ADDED
@@ -0,0 +1,259 @@
1
+ # mcp-toolkit
2
+
3
+ MCP servers for React + TypeScript development automation. Works with Claude Desktop, Cline, Cursor — and as plain CLI scripts — one protocol, zero duplication.
4
+
5
+ [![CI](https://github.com/Nishant-Chaudhary5338/mcp-toolkit/actions/workflows/ci.yml/badge.svg)](https://github.com/Nishant-Chaudhary5338/mcp-toolkit/actions/workflows/ci.yml)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
7
+ [![MCP SDK](https://img.shields.io/badge/MCP%20SDK-1.12.0-blue)](https://github.com/modelcontextprotocol/typescript-sdk)
8
+ [![Tests](https://img.shields.io/badge/tests-134%20passing-brightgreen)](#testing)
9
+
10
+ ---
11
+
12
+ ## What's here
13
+
14
+ ```
15
+ tools/ 9 MCP server packages — each independently buildable and runnable
16
+ server/ Express bridge (port 3002) — proxies calls from the UI to MCP servers
17
+ client/ React 19 showcase SPA — tool catalog, workflow demos, animated flowcharts
18
+ ```
19
+
20
+ ---
21
+
22
+ ## Tools
23
+
24
+ All 9 tools are production-ready: built, tested, and CI-verified on Node 20 + 22.
25
+
26
+ | Tool | What it does | MCP tools exposed |
27
+ |---|---|---|
28
+ | `component-factory` | Scaffold React components from 41 shadcn/ui templates — with tests + Storybook | 6 |
29
+ | `code-modernizer` | AST-based JS/JSX → TypeScript conversion, PropTypes → interfaces | 1 |
30
+ | `quality-pipeline` | 5-stage audit (tests · types · perf · a11y · design tokens) graded A–F | 2 |
31
+ | `json-viewer` | Generate an interactive HTML JSON viewer — collapsible, searchable, dark/light | 3 |
32
+ | `dep-auditor` | Unused deps, duplicate versions, circular imports, bundle impact analysis | 4 |
33
+ | `accessibility-checker` | WCAG 2.1 audit — alt text, label associations, ARIA roles, keyboard navigation | 3 |
34
+ | `generate-tests` | Analyze a TypeScript/React source file and generate a Vitest test suite | 2 |
35
+ | `typescript-enforcer` | Scan for `any` types, unsafe casts, missing modifiers — 7 rules, scored 0–10 | 4 |
36
+ | `monorepo-manager` | Workspace listing, dependency graph, health check, shared dep finder | 6 |
37
+
38
+ ### Roadmap
39
+
40
+ | Tool | Description | Status |
41
+ |---|---|---|
42
+ | `render-analyzer` | React render profiling — detect unnecessary renders, missing memo | 📋 Planned |
43
+ | `storybook-generator` | Auto-generate Storybook stories for existing components | 📋 Planned |
44
+ | `legacy-analyzer` | Tech debt detection — anti-patterns, duplication, refactor plans | 📋 Planned |
45
+ | `test-gap-analyzer` | Find unimplemented functions, uncovered branches, missing edge cases | 📋 Planned |
46
+ | `performance-audit` | Bundle size analysis, memory leaks, slow component detection | 📋 Planned |
47
+ | `lighthouse-runner` | Web Vitals / Lighthouse audit via CLI | 📋 Planned |
48
+ | `component-reviewer` | Audit TypeScript errors, test coverage gaps, a11y issues | 📋 Planned |
49
+ | `component-fixer` | Auto-fix broken imports, missing dependencies, export corrections | 📋 Planned |
50
+
51
+ Want to implement one of these? See [CONTRIBUTING.md](CONTRIBUTING.md).
52
+
53
+ ---
54
+
55
+ ## Automation workflows
56
+
57
+ ### 1 · Code Modernization
58
+ ```
59
+ legacy-analyzer → code-modernizer → typescript-enforcer → generate-tests
60
+ ```
61
+ Migrate a JS codebase to strict TypeScript with auto-generated test coverage.
62
+
63
+ ### 2 · Dependency Health
64
+ ```
65
+ dep-auditor [unused] → dep-auditor [duplicates] → dep-auditor [bundle-impact] → monorepo-manager
66
+ ```
67
+ Audit and clean up a monorepo's dependency graph end-to-end.
68
+
69
+ ### 3 · Component Pipeline
70
+ ```
71
+ component-factory → accessibility-checker → quality-pipeline
72
+ ```
73
+ Generate a production-ready component and verify it before shipping.
74
+
75
+ ### 4 · Quality Audit
76
+ ```
77
+ accessibility-checker → typescript-enforcer → quality-pipeline
78
+ ```
79
+ Full code quality check — WCAG compliance, type safety score, overall grade.
80
+
81
+ ---
82
+
83
+ ## How MCP works
84
+
85
+ ```
86
+ Claude Desktop / Cline / Cursor
87
+
88
+ │ JSON-RPC over stdio
89
+
90
+ MCP Server (e.g. typescript-enforcer)
91
+
92
+
93
+ Tool handlers (your code)
94
+ ```
95
+
96
+ Each server in this repo extends `McpServerBase` from `tools/shared/` — an abstract class that handles transport, routing, and error formatting. Adding a new tool is ~50 lines.
97
+
98
+ ```typescript
99
+ import { McpServerBase } from '@mcp-showcase/shared';
100
+
101
+ class MyTool extends McpServerBase {
102
+ constructor() {
103
+ super({ name: 'my-tool', version: '1.0.0' });
104
+ }
105
+
106
+ protected registerTools(): void {
107
+ this.addTool('do_thing', 'Does a thing', {
108
+ type: 'object',
109
+ properties: { path: { type: 'string', description: 'Target path' } },
110
+ required: ['path'],
111
+ }, async (args) => {
112
+ const { path } = args as { path: string };
113
+ return this.success({ result: `Processed ${path}` });
114
+ });
115
+ }
116
+ }
117
+
118
+ new MyTool().run();
119
+ ```
120
+
121
+ ---
122
+
123
+ ## Run locally
124
+
125
+ ```sh
126
+ git clone https://github.com/Nishant-Chaudhary5338/mcp-toolkit.git
127
+ cd mcp-toolkit
128
+ npm install
129
+ npm run build
130
+ npm test # 134 tests across all 9 tools
131
+ npm run dev # server on :3002, client on :5173
132
+ ```
133
+
134
+ ### Add to Claude Desktop
135
+
136
+ ```jsonc
137
+ // ~/Library/Application Support/Claude/claude_desktop_config.json
138
+ {
139
+ "mcpServers": {
140
+ "component-factory": {
141
+ "command": "node",
142
+ "args": ["/path/to/mcp-toolkit/tools/component-factory/build/index.js"]
143
+ },
144
+ "code-modernizer": {
145
+ "command": "node",
146
+ "args": ["/path/to/mcp-toolkit/tools/code-modernizer/build/index.js"]
147
+ },
148
+ "quality-pipeline": {
149
+ "command": "node",
150
+ "args": ["/path/to/mcp-toolkit/tools/quality-pipeline/build/index.js"]
151
+ },
152
+ "json-viewer": {
153
+ "command": "node",
154
+ "args": ["/path/to/mcp-toolkit/tools/json-viewer/build/index.js"]
155
+ },
156
+ "dep-auditor": {
157
+ "command": "node",
158
+ "args": ["/path/to/mcp-toolkit/tools/dep-auditor/build/index.js"]
159
+ },
160
+ "accessibility-checker": {
161
+ "command": "node",
162
+ "args": ["/path/to/mcp-toolkit/tools/accessibility-checker/build/index.js"]
163
+ },
164
+ "generate-tests": {
165
+ "command": "node",
166
+ "args": ["/path/to/mcp-toolkit/tools/generate-tests/build/index.js"]
167
+ },
168
+ "typescript-enforcer": {
169
+ "command": "node",
170
+ "args": ["/path/to/mcp-toolkit/tools/typescript-enforcer/build/index.js"]
171
+ },
172
+ "monorepo-manager": {
173
+ "command": "node",
174
+ "args": ["/path/to/mcp-toolkit/tools/monorepo-manager/build/index.js"]
175
+ }
176
+ }
177
+ }
178
+ ```
179
+
180
+ ### Use as a CLI / in CI
181
+
182
+ ```sh
183
+ # Scan a file for TypeScript issues
184
+ echo '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"scan_file","arguments":{"path":"src/App.tsx"}}}' \
185
+ | node tools/typescript-enforcer/build/index.js
186
+
187
+ # Run a full WCAG audit
188
+ echo '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"check_accessibility","arguments":{"path":"src/components"}}}' \
189
+ | node tools/accessibility-checker/build/index.js
190
+ ```
191
+
192
+ ---
193
+
194
+ ## Testing
195
+
196
+ Each tool has a dedicated test file covering its core logic directly — no MCP transport required.
197
+
198
+ ```sh
199
+ npm test # all tools
200
+ npm run test -w tools/typescript-enforcer # single tool
201
+ ```
202
+
203
+ | Tool | Tests |
204
+ |---|---|
205
+ | json-viewer | 16 |
206
+ | quality-pipeline | 8 |
207
+ | component-factory | 6 |
208
+ | code-modernizer | 8 |
209
+ | dep-auditor | 15 |
210
+ | accessibility-checker | 15 |
211
+ | generate-tests | 14 |
212
+ | typescript-enforcer | 22 |
213
+ | monorepo-manager | 30 |
214
+
215
+ CI runs on every push and PR against Node 20 and 22.
216
+
217
+ ---
218
+
219
+ ## Architecture
220
+
221
+ ```
222
+ tools/
223
+ shared/ McpServerBase, ToolRegistry, shared types
224
+ component-factory/ 41 shadcn/ui templates
225
+ code-modernizer/ AST-based TS conversion
226
+ quality-pipeline/ 5-stage grading system
227
+ json-viewer/ HTML generation
228
+ dep-auditor/ Dependency graph analysis
229
+ accessibility-checker/ WCAG rule engine (9 rules)
230
+ generate-tests/ Source analyzer + test generator
231
+ typescript-enforcer/ 7-rule type safety scanner
232
+ monorepo-manager/ Workspace operations
233
+
234
+ server/ Express bridge — spawns tools as child processes
235
+ client/ React 19 SPA — tool catalog and live demos
236
+ ```
237
+
238
+ ---
239
+
240
+ ## Contributing
241
+
242
+ See [CONTRIBUTING.md](CONTRIBUTING.md) — how to scaffold a new tool, write tests, and open a PR.
243
+
244
+ ---
245
+
246
+ ## Stack
247
+
248
+ TypeScript strict · Node.js · MCP SDK 1.12 · Vitest · React 19 · Vite · Tailwind CSS · Express
249
+
250
+ ---
251
+
252
+ ## Built by
253
+
254
+ **Nishant Chaudhary** — Senior Frontend Engineer
255
+ nishantchaudhary.dev@gmail.com
256
+
257
+ **Also see:** [dashcraft](https://github.com/Nishant-Chaudhary5338/dashcraft) · [react-present](https://github.com/Nishant-Chaudhary5338/react-present) · [ai-builder](https://github.com/Nishant-Chaudhary5338/ai-builder)
258
+
259
+ MIT License
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import Dashboard from './components/Dashboard';
3
+
4
+ function App() {
5
+ return (
6
+ <div className="app">
7
+ <Dashboard title="User Management" currentUser="Admin" />
8
+ </div>
9
+ );
10
+ }
11
+
12
+ export default App;