@mofaggolhoshen/dev-assist-mcp 1.0.4 → 1.0.6
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/AGENTS.md +72 -0
- package/README.md +204 -52
- package/content/concepts/circuit-breaker.md +25 -0
- package/content/setups/jwt-dotnet9.md +18 -0
- package/content/setups/jwt.md +25 -0
- package/content/templates/clean-architecture.md +25 -0
- package/dist/content/snippetSchema.js +39 -0
- package/dist/index.js +8 -0
- package/dist/schemas/markdownKnowledge.js +30 -0
- package/dist/shared/response.js +12 -0
- package/dist/storage/markdownKnowledgeStore.js +267 -0
- package/dist/tools/knowledge/explainConcept.js +46 -0
- package/dist/tools/knowledge/generateSetup.js +46 -0
- package/dist/tools/knowledge/getSnippet.js +52 -39
- package/dist/tools/knowledge/getTemplate.js +46 -0
- package/dist/tools/knowledge/index.js +4 -0
- package/dist/tools/knowledge/searchSnippet.js +56 -0
- package/examples/basic-search/README.md +13 -0
- package/examples/claude-desktop/README.md +10 -0
- package/examples/claude-desktop/claude_desktop_config.json +8 -0
- package/examples/cursor/README.md +15 -0
- package/examples/explain-mode/expected-response.md +16 -0
- package/examples/jwt-setup/expected-response.json +16 -0
- package/examples/polly-retry/expected-response.json +14 -0
- package/package.json +17 -2
- package/scripts/.gitkeep +0 -0
- package/snippets/architecture/.gitkeep +0 -0
- package/snippets/architecture/clean-architecture-api.md +25 -0
- package/snippets/architecture/cqrs-starter.md +25 -0
- package/snippets/architecture/ddd-aggregate.md +25 -0
- package/snippets/architecture/efcore-repository.md +39 -0
- package/snippets/auth/.gitkeep +0 -0
- package/snippets/auth/jwe-setup.md +28 -0
- package/snippets/auth/jwt-setup-dotnet9.md +27 -0
- package/snippets/auth/jwt-setup.md +44 -0
- package/snippets/auth/refresh-token-rotation.md +27 -0
- package/snippets/auth/role-based-authorization.md +28 -0
- package/snippets/caching/.gitkeep +0 -0
- package/snippets/caching/cache-aside-pattern.md +25 -0
- package/snippets/caching/redis-distributed-cache.md +25 -0
- package/snippets/logging/.gitkeep +0 -0
- package/snippets/logging/opentelemetry-tracing.md +25 -0
- package/snippets/logging/serilog-bootstrap.md +25 -0
- package/snippets/logging/structured-logging-guidelines.md +27 -0
- package/snippets/messaging/.gitkeep +0 -0
- package/snippets/messaging/masstransit-rabbitmq.md +25 -0
- package/snippets/messaging/outbox-pattern.md +25 -0
- package/snippets/messaging/saga-state-machine.md +25 -0
- package/snippets/resilience/.gitkeep +0 -0
- package/snippets/resilience/bulkhead-isolation.md +25 -0
- package/snippets/resilience/circuit-breaker-polly.md +25 -0
- package/snippets/resilience/fallback-policy-polly.md +25 -0
- package/snippets/resilience/polly-retry.md +31 -0
- package/snippets/resilience/timeout-policy-polly.md +25 -0
- package/snippets/efcore-repository.json +0 -7
- package/snippets/jwt-setup.json +0 -7
- package/snippets/polly-retry.json +0 -7
package/AGENTS.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
This file helps AI coding agents become productive quickly in this repository.
|
|
4
|
+
|
|
5
|
+
## Scope
|
|
6
|
+
|
|
7
|
+
- Applies to the whole repository.
|
|
8
|
+
- Prefer minimal, targeted changes over broad refactors.
|
|
9
|
+
- Keep existing public tool names and response shapes stable unless explicitly requested.
|
|
10
|
+
|
|
11
|
+
## Quick Start Commands
|
|
12
|
+
|
|
13
|
+
- Install: `npm install`
|
|
14
|
+
- Build: `npm run build`
|
|
15
|
+
- Dev server (stdio MCP): `npm run dev`
|
|
16
|
+
- Run compiled server: `npm start`
|
|
17
|
+
- Test: `npm test`
|
|
18
|
+
|
|
19
|
+
## Project Map
|
|
20
|
+
|
|
21
|
+
- `src/index.ts`: MCP server bootstrap and tool registration.
|
|
22
|
+
- `src/tools/types.ts`: shared `Tool` contract.
|
|
23
|
+
- `src/tools/registry.ts`: tool registration and lookup.
|
|
24
|
+
- `src/tools/fs/`: filesystem tools and path safety.
|
|
25
|
+
- `src/tools/knowledge/`: snippet/template/concept/setup tools.
|
|
26
|
+
- `src/tools/intelligence/`: project analysis tooling.
|
|
27
|
+
- `src/storage/markdownKnowledgeStore.ts`: markdown loading, Fuse ranking, filtering.
|
|
28
|
+
- `src/schemas/markdownKnowledge.ts`: frontmatter validation schemas.
|
|
29
|
+
- `src/shared/response.ts`: `textResponse` and `errorResponse` helpers.
|
|
30
|
+
- `snippets/`: reusable snippet knowledge content.
|
|
31
|
+
- `content/`: concepts, templates, and setup docs used by knowledge tools.
|
|
32
|
+
- `tests/`: Jest test suite.
|
|
33
|
+
|
|
34
|
+
## Coding Conventions
|
|
35
|
+
|
|
36
|
+
- Runtime source is ESM (`type: module`, `NodeNext` in tsconfig).
|
|
37
|
+
- Keep `.js` import suffixes in TypeScript source files.
|
|
38
|
+
- Tests compile as CommonJS via `tsconfig.test.json`; Jest maps local `.js` imports.
|
|
39
|
+
- Validate inputs with Zod schemas for every tool.
|
|
40
|
+
- Return MCP responses using `textResponse(...)` (or `errorResponse(...)`) from `src/shared/response.ts`.
|
|
41
|
+
- Prefer structured JSON string payloads for machine-consumable tool output.
|
|
42
|
+
|
|
43
|
+
## Safety Rules
|
|
44
|
+
|
|
45
|
+
- For filesystem access, use `resolveSafePath` from `src/tools/fs/safePath.ts`.
|
|
46
|
+
- Never bypass project-root boundary checks.
|
|
47
|
+
- Keep tool names unique in the registry.
|
|
48
|
+
|
|
49
|
+
## Common Agent Tasks
|
|
50
|
+
|
|
51
|
+
### Add a new MCP tool
|
|
52
|
+
|
|
53
|
+
1. Create `src/tools/<category>/<toolName>.ts` implementing the `Tool` interface.
|
|
54
|
+
2. Define a Zod `inputSchema` and `execute` handler.
|
|
55
|
+
3. Register the tool in `src/index.ts`.
|
|
56
|
+
4. Add tests in `tests/`.
|
|
57
|
+
5. Run `npm test` and `npm run build`.
|
|
58
|
+
|
|
59
|
+
### Add or update snippet content
|
|
60
|
+
|
|
61
|
+
1. Edit/create markdown files under `snippets/` with valid YAML frontmatter.
|
|
62
|
+
2. Follow schema expectations in `src/schemas/markdownKnowledge.ts`.
|
|
63
|
+
3. Note: frontmatter dates may be parsed as Date objects; schema normalization handles `updatedAt`.
|
|
64
|
+
4. Run `npm test`.
|
|
65
|
+
|
|
66
|
+
## Documentation Links (Read Before Large Changes)
|
|
67
|
+
|
|
68
|
+
- Project overview and examples: [README](README.md)
|
|
69
|
+
- Product requirements: [PRD v2](docs/PRD-v2.md)
|
|
70
|
+
- Implementation roadmap: [Implementation Plan](docs/Implementation-Plan.md)
|
|
71
|
+
- Publishing workflow: [Publish Guide](docs/Publish.md)
|
|
72
|
+
- Usage examples: [examples](examples/)
|
package/README.md
CHANGED
|
@@ -1,55 +1,64 @@
|
|
|
1
|
-
# DevAssist MCP
|
|
1
|
+
# DevAssist MCP
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Production-ready developer assistance through Model Context Protocol (MCP).
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
DevAssist MCP is an AI-first developer knowledge server that provides curated snippets, setup guides, architecture templates, concept explanations, and project analysis for modern engineering workflows.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Why DevAssist MCP
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
npm install
|
|
11
|
-
```
|
|
9
|
+
AI-generated code is often incomplete, outdated, or missing production context. DevAssist MCP improves output quality by returning structured, version-aware, reusable engineering knowledge instead of generic examples.
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
## Key Capabilities
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
- MCP-compatible stdio server
|
|
14
|
+
- Production-ready, curated engineering content
|
|
15
|
+
- Framework and version-aware retrieval
|
|
16
|
+
- Deterministic ranking with confidence signals
|
|
17
|
+
- Explain mode for engineering concepts
|
|
18
|
+
- Setup generation for common backend scenarios
|
|
19
|
+
- Template retrieval for architecture starters
|
|
20
|
+
- File-system and project analysis utility tools
|
|
21
|
+
- Structured responses optimized for AI clients
|
|
22
|
+
|
|
23
|
+
## Supported Domains
|
|
18
24
|
|
|
19
|
-
|
|
25
|
+
- Authentication: JWT, JWE, role-based authorization, refresh-token rotation
|
|
26
|
+
- Resilience: retry, timeout, circuit breaker, fallback, bulkhead
|
|
27
|
+
- Observability: Serilog, OpenTelemetry tracing, structured logging
|
|
28
|
+
- Architecture: Clean Architecture, CQRS, DDD, repository patterns
|
|
29
|
+
- Messaging: MassTransit, RabbitMQ, outbox, saga state machine
|
|
30
|
+
- Caching: Redis distributed cache, cache-aside
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
### npm
|
|
20
35
|
|
|
21
36
|
```bash
|
|
22
|
-
npm
|
|
37
|
+
npm install @mofaggolhoshen/dev-assist-mcp
|
|
23
38
|
```
|
|
24
39
|
|
|
25
|
-
|
|
40
|
+
### Run with npx
|
|
26
41
|
|
|
27
42
|
```bash
|
|
28
|
-
|
|
43
|
+
npx -y @mofaggolhoshen/dev-assist-mcp
|
|
29
44
|
```
|
|
30
45
|
|
|
31
|
-
##
|
|
32
|
-
|
|
33
|
-
You can run the MCP server in VS Code either from this repository or from the published npm package.
|
|
46
|
+
## MCP Client Integration
|
|
34
47
|
|
|
35
|
-
|
|
48
|
+
### Claude Desktop
|
|
36
49
|
|
|
37
50
|
```json
|
|
38
51
|
{
|
|
39
|
-
"
|
|
40
|
-
"dev-assist": {
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"args": ["dist/index.js"],
|
|
44
|
-
"cwd": "${workspaceFolder}"
|
|
52
|
+
"mcpServers": {
|
|
53
|
+
"dev-assist-mcp": {
|
|
54
|
+
"command": "npx",
|
|
55
|
+
"args": ["-y", "@mofaggolhoshen/dev-assist-mcp"]
|
|
45
56
|
}
|
|
46
57
|
}
|
|
47
58
|
}
|
|
48
59
|
```
|
|
49
60
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
Published npm package setup:
|
|
61
|
+
### VS Code MCP
|
|
53
62
|
|
|
54
63
|
```json
|
|
55
64
|
{
|
|
@@ -57,44 +66,187 @@ Published npm package setup:
|
|
|
57
66
|
"dev-assist": {
|
|
58
67
|
"type": "stdio",
|
|
59
68
|
"command": "npx",
|
|
60
|
-
"args": ["-y", "@mofaggolhoshen/dev-assist-mcp
|
|
69
|
+
"args": ["-y", "@mofaggolhoshen/dev-assist-mcp"]
|
|
61
70
|
}
|
|
62
71
|
}
|
|
63
72
|
}
|
|
64
73
|
```
|
|
65
74
|
|
|
66
|
-
|
|
75
|
+
## MCP Tools
|
|
67
76
|
|
|
68
|
-
|
|
77
|
+
### Knowledge Tools (PRD-aligned)
|
|
69
78
|
|
|
70
|
-
| Tool |
|
|
71
|
-
|
|
72
|
-
|
|
|
73
|
-
|
|
|
74
|
-
|
|
|
75
|
-
|
|
|
76
|
-
|
|
|
77
|
-
| `analyze_project` | Detects language/framework/architecture hints | `{ path?: string }` |
|
|
79
|
+
| Tool | Purpose |
|
|
80
|
+
|---|---|
|
|
81
|
+
| search_snippet | Search reusable engineering snippets with optional filters |
|
|
82
|
+
| get_snippet | Retrieve a detailed snippet by name |
|
|
83
|
+
| get_template | Return complete implementation templates |
|
|
84
|
+
| explain_concept | Explain engineering concepts with practical guidance |
|
|
85
|
+
| generate_setup | Generate production-ready setup guidance |
|
|
78
86
|
|
|
79
|
-
|
|
87
|
+
### Utility Tools
|
|
80
88
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
89
|
+
| Tool | Purpose |
|
|
90
|
+
|---|---|
|
|
91
|
+
| list_files | List files under a project path |
|
|
92
|
+
| read_file | Read a text file from project scope |
|
|
93
|
+
| search_code | Search keyword matches in project text files |
|
|
94
|
+
| analyze_project | Detect language, framework, architecture, and container hints |
|
|
85
95
|
|
|
86
|
-
##
|
|
96
|
+
## Example Prompts
|
|
87
97
|
|
|
88
|
-
|
|
98
|
+
- Give me JWT authentication setup for ASP.NET 9
|
|
99
|
+
- Show Polly retry with exponential backoff
|
|
100
|
+
- Explain circuit breaker pattern
|
|
101
|
+
- Get clean architecture template
|
|
102
|
+
- Analyze this repository structure
|
|
103
|
+
|
|
104
|
+
## Example Structured Response
|
|
89
105
|
|
|
90
106
|
```json
|
|
91
107
|
{
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
108
|
+
"query": "jwt authentication asp.net 9",
|
|
109
|
+
"filters": {
|
|
110
|
+
"framework": ".net",
|
|
111
|
+
"version": "9",
|
|
112
|
+
"category": "auth",
|
|
113
|
+
"difficulty": "medium",
|
|
114
|
+
"limit": 10
|
|
115
|
+
},
|
|
116
|
+
"total": 1,
|
|
117
|
+
"results": [
|
|
118
|
+
{
|
|
119
|
+
"id": "jwt-setup-dotnet9",
|
|
120
|
+
"title": "JWT Authentication ASP.NET 9",
|
|
121
|
+
"framework": ".net",
|
|
122
|
+
"version": "9",
|
|
123
|
+
"difficulty": "medium",
|
|
124
|
+
"confidence": "high",
|
|
125
|
+
"reasons": ["framework-match", "version-match", "tag-match"]
|
|
126
|
+
}
|
|
127
|
+
]
|
|
97
128
|
}
|
|
98
129
|
```
|
|
99
130
|
|
|
100
|
-
|
|
131
|
+
## Architecture (MVP)
|
|
132
|
+
|
|
133
|
+
```txt
|
|
134
|
+
AI Client (Copilot / Cursor / Claude)
|
|
135
|
+
|
|
|
136
|
+
v
|
|
137
|
+
DevAssist MCP Server (TypeScript MCP SDK)
|
|
138
|
+
|
|
|
139
|
+
v
|
|
140
|
+
Catalog + Ranking + Validation Layers
|
|
141
|
+
|
|
|
142
|
+
v
|
|
143
|
+
Markdown Knowledge Store (snippets, templates, concepts, setups)
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Repository Layout
|
|
147
|
+
|
|
148
|
+
```txt
|
|
149
|
+
src/
|
|
150
|
+
tools/
|
|
151
|
+
storage/
|
|
152
|
+
ranking/
|
|
153
|
+
catalog/
|
|
154
|
+
content/
|
|
155
|
+
snippets/
|
|
156
|
+
content/
|
|
157
|
+
concepts/
|
|
158
|
+
templates/
|
|
159
|
+
setups/
|
|
160
|
+
examples/
|
|
161
|
+
docs/
|
|
162
|
+
tests/
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Development
|
|
166
|
+
|
|
167
|
+
### Install dependencies
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
npm install
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Run in development
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
npm run dev
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Build
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
npm run build
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Run tests
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
npm run test
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## Content Authoring Format
|
|
192
|
+
|
|
193
|
+
Knowledge content uses Markdown with YAML frontmatter.
|
|
194
|
+
|
|
195
|
+
### Snippet frontmatter example
|
|
196
|
+
|
|
197
|
+
```yaml
|
|
198
|
+
---
|
|
199
|
+
id: jwt-setup-dotnet9
|
|
200
|
+
name: jwt-setup-dotnet9
|
|
201
|
+
title: JWT Authentication ASP.NET 9
|
|
202
|
+
summary: Production-ready JWT authentication setup for ASP.NET 9 APIs
|
|
203
|
+
framework: aspnet
|
|
204
|
+
version: .net9
|
|
205
|
+
language: csharp
|
|
206
|
+
category: auth
|
|
207
|
+
tags:
|
|
208
|
+
- jwt
|
|
209
|
+
- authentication
|
|
210
|
+
- bearer
|
|
211
|
+
difficulty: medium
|
|
212
|
+
bestPractices:
|
|
213
|
+
- Use short-lived access tokens
|
|
214
|
+
pitfalls:
|
|
215
|
+
- Do not hardcode signing keys
|
|
216
|
+
securityNotes:
|
|
217
|
+
- Store secrets in a secure secret manager
|
|
218
|
+
updatedAt: 2026-05-10
|
|
219
|
+
---
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## Non-Functional Targets
|
|
223
|
+
|
|
224
|
+
- Snippet search target: under 500ms
|
|
225
|
+
- MCP response target: under 1 second
|
|
226
|
+
- Startup target: under 5 seconds
|
|
227
|
+
|
|
228
|
+
## Roadmap Status
|
|
229
|
+
|
|
230
|
+
- Phase 1 Foundation Hardening: Completed
|
|
231
|
+
- Phase 2 PRD MVP Delivery: Completed
|
|
232
|
+
- Phase 3 Relevance and Intelligence: Completed
|
|
233
|
+
- Phase 4 Semantic Search and Platform Expansion: Not Started
|
|
234
|
+
|
|
235
|
+
## Contributing
|
|
236
|
+
|
|
237
|
+
Contributions are welcome through pull requests and issues.
|
|
238
|
+
|
|
239
|
+
## License
|
|
240
|
+
|
|
241
|
+
ISC
|
|
242
|
+
|
|
243
|
+
## Author
|
|
244
|
+
|
|
245
|
+
Mofaggol Hoshen
|
|
246
|
+
|
|
247
|
+
## Links
|
|
248
|
+
|
|
249
|
+
- Repository: https://github.com/MofaggolHoshen/dev-assist-mcp-server
|
|
250
|
+
- Package: https://www.npmjs.com/package/@mofaggolhoshen/dev-assist-mcp
|
|
251
|
+
- Product Requirements: docs/PRD-v2.md
|
|
252
|
+
- Implementation Plan: docs/Implementation-Plan.md
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: circuit-breaker
|
|
3
|
+
title: Circuit Breaker Pattern
|
|
4
|
+
summary: Protect downstream systems by stopping repeated calls during failures.
|
|
5
|
+
tags:
|
|
6
|
+
- resilience
|
|
7
|
+
- polly
|
|
8
|
+
- reliability
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Concept
|
|
12
|
+
|
|
13
|
+
A circuit breaker monitors failures and opens when a threshold is crossed. While open, calls fail fast.
|
|
14
|
+
After a delay, it enters half-open mode to test recovery.
|
|
15
|
+
|
|
16
|
+
## When to Use
|
|
17
|
+
|
|
18
|
+
- Unstable downstream API
|
|
19
|
+
- Expensive external dependency
|
|
20
|
+
- Cascading-failure protection
|
|
21
|
+
|
|
22
|
+
## Anti-Patterns
|
|
23
|
+
|
|
24
|
+
- Using retries without a breaker for persistent failures
|
|
25
|
+
- Very long open durations that block recovery
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: jwt-dotnet9
|
|
3
|
+
title: JWT Setup for .NET 9
|
|
4
|
+
summary: JWT setup guidance optimized for .NET 9 API projects.
|
|
5
|
+
framework: dotnet9
|
|
6
|
+
version: .net9
|
|
7
|
+
tags:
|
|
8
|
+
- jwt
|
|
9
|
+
- auth
|
|
10
|
+
- dotnet9
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## .NET 9 Notes
|
|
14
|
+
|
|
15
|
+
- Use current authentication middleware defaults.
|
|
16
|
+
- Keep token validation parameters explicit.
|
|
17
|
+
- Integrate structured logging around auth failures.
|
|
18
|
+
- Add health checks and startup validation for key configuration.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: jwt
|
|
3
|
+
title: JWT Setup Baseline
|
|
4
|
+
summary: Production-oriented JWT setup checklist for ASP.NET APIs.
|
|
5
|
+
framework: aspnet
|
|
6
|
+
version: .net8+
|
|
7
|
+
tags:
|
|
8
|
+
- jwt
|
|
9
|
+
- auth
|
|
10
|
+
- security
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Setup Checklist
|
|
14
|
+
|
|
15
|
+
1. Add JwtBearer package.
|
|
16
|
+
2. Configure issuer, audience, and signing key validation.
|
|
17
|
+
3. Enforce HTTPS and secure secret storage.
|
|
18
|
+
4. Add authorization policies and role checks.
|
|
19
|
+
5. Add token expiry and refresh-token strategy.
|
|
20
|
+
|
|
21
|
+
## Validation
|
|
22
|
+
|
|
23
|
+
- Reject tokens with invalid issuer or audience.
|
|
24
|
+
- Reject expired tokens.
|
|
25
|
+
- Rotate keys safely.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: clean-architecture
|
|
3
|
+
title: Clean Architecture Starter Template
|
|
4
|
+
summary: Baseline folder and project layering for a Clean Architecture solution.
|
|
5
|
+
framework: dotnet
|
|
6
|
+
version: .net8+
|
|
7
|
+
tags:
|
|
8
|
+
- clean-architecture
|
|
9
|
+
- ddd
|
|
10
|
+
- layering
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Suggested Structure
|
|
14
|
+
|
|
15
|
+
- src/Application
|
|
16
|
+
- src/Domain
|
|
17
|
+
- src/Infrastructure
|
|
18
|
+
- src/WebApi
|
|
19
|
+
|
|
20
|
+
## Core Rules
|
|
21
|
+
|
|
22
|
+
1. Domain has no dependency on infrastructure.
|
|
23
|
+
2. Application contains use cases and contracts.
|
|
24
|
+
3. Infrastructure implements contracts and adapters.
|
|
25
|
+
4. Web API composes dependencies and hosts endpoints.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Canonical schema for a DevAssist snippet file stored under snippets/.
|
|
4
|
+
*
|
|
5
|
+
* Required fields are the same as the original minimal shape.
|
|
6
|
+
* Optional fields represent Phase 1 metadata additions; all existing
|
|
7
|
+
* snippets that do not yet carry them will still parse successfully.
|
|
8
|
+
*/
|
|
9
|
+
export const snippetSchema = z.object({
|
|
10
|
+
/** Unique identifier — must match the filename without .json extension. */
|
|
11
|
+
name: z
|
|
12
|
+
.string()
|
|
13
|
+
.regex(/^[A-Za-z0-9-]+$/, "name must only contain letters, numbers, and hyphens"),
|
|
14
|
+
/** Human-friendly display title. */
|
|
15
|
+
title: z.string().min(1),
|
|
16
|
+
/** Primary programming language of the code example. */
|
|
17
|
+
language: z.string().min(1),
|
|
18
|
+
/** Short description of what the snippet does. */
|
|
19
|
+
description: z.string().min(1),
|
|
20
|
+
/** The source code or configuration example. */
|
|
21
|
+
code: z.string().min(1),
|
|
22
|
+
// ─── Phase 1 metadata additions ─────────────────────────────────────────
|
|
23
|
+
/** Top-level content category e.g. "auth", "resilience", "logging". */
|
|
24
|
+
category: z.string().optional(),
|
|
25
|
+
/** Searchable tags e.g. ["jwt", "bearer", "aspnet"]. */
|
|
26
|
+
tags: z.array(z.string()).optional(),
|
|
27
|
+
/** Target framework e.g. "aspnet", "dotnet", "nodejs". */
|
|
28
|
+
framework: z.string().optional(),
|
|
29
|
+
/** Target framework version e.g. ".net9", ".net8+", "node22". */
|
|
30
|
+
version: z.string().optional(),
|
|
31
|
+
/** Complexity level for the developer consuming the snippet. */
|
|
32
|
+
difficulty: z.enum(["beginner", "medium", "advanced"]).optional(),
|
|
33
|
+
/** Production-oriented best-practice notes. */
|
|
34
|
+
bestPractices: z.array(z.string()).optional(),
|
|
35
|
+
/** Common mistakes or anti-patterns to avoid. */
|
|
36
|
+
pitfalls: z.array(z.string()).optional(),
|
|
37
|
+
/** Security-specific guidance relevant to this snippet. */
|
|
38
|
+
securityNotes: z.array(z.string()).optional(),
|
|
39
|
+
});
|
package/dist/index.js
CHANGED
|
@@ -5,6 +5,10 @@ import { listFilesTool } from "./tools/fs/listFiles.js";
|
|
|
5
5
|
import { readFileTool } from "./tools/fs/readFile.js";
|
|
6
6
|
import { searchCodeTool } from "./tools/fs/searchCode.js";
|
|
7
7
|
import { getSnippetTool } from "./tools/knowledge/getSnippet.js";
|
|
8
|
+
import { searchSnippetTool } from "./tools/knowledge/searchSnippet.js";
|
|
9
|
+
import { getTemplateTool } from "./tools/knowledge/getTemplate.js";
|
|
10
|
+
import { explainConceptTool } from "./tools/knowledge/explainConcept.js";
|
|
11
|
+
import { generateSetupTool } from "./tools/knowledge/generateSetup.js";
|
|
8
12
|
import { analyzeProjectTool } from "./tools/intelligence/analyzeProject.js";
|
|
9
13
|
const server = new McpServer({ name: "dev-assist-mcp", version: "1.0.0" }, { capabilities: { tools: {} } });
|
|
10
14
|
const registry = new ToolRegistry();
|
|
@@ -13,6 +17,10 @@ registry.register(listFilesTool);
|
|
|
13
17
|
registry.register(readFileTool);
|
|
14
18
|
registry.register(searchCodeTool);
|
|
15
19
|
registry.register(getSnippetTool);
|
|
20
|
+
registry.register(searchSnippetTool);
|
|
21
|
+
registry.register(getTemplateTool);
|
|
22
|
+
registry.register(explainConceptTool);
|
|
23
|
+
registry.register(generateSetupTool);
|
|
16
24
|
registry.register(analyzeProjectTool);
|
|
17
25
|
for (const tool of registry.list()) {
|
|
18
26
|
server.registerTool(tool.name, {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const markdownSnippetFrontmatterSchema = z.object({
|
|
3
|
+
id: z.string().min(1),
|
|
4
|
+
name: z.string().min(1).optional(),
|
|
5
|
+
title: z.string().min(1),
|
|
6
|
+
summary: z.string().min(1),
|
|
7
|
+
updatedAt: z
|
|
8
|
+
.union([
|
|
9
|
+
z.string(),
|
|
10
|
+
z.date().transform((date) => date.toISOString()),
|
|
11
|
+
])
|
|
12
|
+
.optional(),
|
|
13
|
+
framework: z.string().optional(),
|
|
14
|
+
version: z.string().optional(),
|
|
15
|
+
language: z.string().optional(),
|
|
16
|
+
category: z.string().optional(),
|
|
17
|
+
tags: z.array(z.string()).optional(),
|
|
18
|
+
difficulty: z.enum(["beginner", "medium", "advanced"]).optional(),
|
|
19
|
+
bestPractices: z.array(z.string()).optional(),
|
|
20
|
+
pitfalls: z.array(z.string()).optional(),
|
|
21
|
+
securityNotes: z.array(z.string()).optional(),
|
|
22
|
+
});
|
|
23
|
+
export const markdownDocFrontmatterSchema = z.object({
|
|
24
|
+
id: z.string().min(1).optional(),
|
|
25
|
+
title: z.string().min(1),
|
|
26
|
+
summary: z.string().optional(),
|
|
27
|
+
framework: z.string().optional(),
|
|
28
|
+
version: z.string().optional(),
|
|
29
|
+
tags: z.array(z.string()).optional(),
|
|
30
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared MCP tool response helpers.
|
|
3
|
+
* All knowledge tools should use these helpers so output shape stays consistent.
|
|
4
|
+
*/
|
|
5
|
+
/** Wrap a plain string into a valid MCP tool content array. */
|
|
6
|
+
export function textResponse(text) {
|
|
7
|
+
return { content: [{ type: "text", text }] };
|
|
8
|
+
}
|
|
9
|
+
/** Produce a structured error message in the same envelope. */
|
|
10
|
+
export function errorResponse(message) {
|
|
11
|
+
return textResponse(`Error: ${message}`);
|
|
12
|
+
}
|