mcp-architector 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.
- package/README.md +317 -0
- package/cursor-config-example.json +12 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +572 -0
- package/dist/index.js.map +1 -0
- package/dist/storage.d.ts +62 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +182 -0
- package/dist/storage.js.map +1 -0
- package/dist/types.d.ts +60 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/package.json +35 -0
- package/src/index.ts +689 -0
- package/src/storage.ts +203 -0
- package/src/types.ts +66 -0
- package/tsconfig.json +21 -0
package/README.md
ADDED
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
# MCP Architector
|
|
2
|
+
|
|
3
|
+
Model Context Protocol (MCP) server for architecture and system design.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
A local-first MCP server that stores and manages project architecture information. All data is stored locally in `~/.mcp-architector` for maximum privacy and confidentiality.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- **Local Storage**: All data stored in `~/.mcp-architector` (privacy-first)
|
|
12
|
+
- **Project Architecture**: Store and retrieve overall project architecture
|
|
13
|
+
- **Module Details**: Detailed information about each module
|
|
14
|
+
- **Resources**: Access architecture data via resources
|
|
15
|
+
|
|
16
|
+
## Storage Structure
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
~/.mcp-architector/
|
|
20
|
+
└── {projectId}/
|
|
21
|
+
├── architecture.json # Overall architecture
|
|
22
|
+
├── modules/
|
|
23
|
+
│ ├── {moduleId}.json # Module details
|
|
24
|
+
│ └── ...
|
|
25
|
+
└── scripts/
|
|
26
|
+
├── {scriptId}.json # Script documentation
|
|
27
|
+
└── ...
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
|
|
32
|
+
1. Install dependencies:
|
|
33
|
+
```bash
|
|
34
|
+
npm install
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
2. Build the project:
|
|
38
|
+
```bash
|
|
39
|
+
npm run build
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Usage
|
|
43
|
+
|
|
44
|
+
### Development Mode
|
|
45
|
+
|
|
46
|
+
Run with hot reload:
|
|
47
|
+
```bash
|
|
48
|
+
npm run dev
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Production Mode
|
|
52
|
+
|
|
53
|
+
Start the server:
|
|
54
|
+
```bash
|
|
55
|
+
npm start
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### MCP Inspector
|
|
59
|
+
|
|
60
|
+
Debug and test your server with the MCP Inspector:
|
|
61
|
+
```bash
|
|
62
|
+
npm run inspector
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Integration with Cursor
|
|
66
|
+
|
|
67
|
+
### Configuration
|
|
68
|
+
|
|
69
|
+
Add this server to your Cursor MCP configuration:
|
|
70
|
+
|
|
71
|
+
1. Open Cursor Settings → Features → Model Context Protocol
|
|
72
|
+
2. Click "Edit Config" button
|
|
73
|
+
3. Add the server configuration
|
|
74
|
+
|
|
75
|
+
#### Option 1: Automatic project ID from environment
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"mcpServers": {
|
|
80
|
+
"architector": {
|
|
81
|
+
"command": "node",
|
|
82
|
+
"args": ["/absolute/path/to/mcp-architector/dist/index.js"],
|
|
83
|
+
"env": {
|
|
84
|
+
"MCP_PROJECT_ID": "${workspaceFolder}"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
**Note:** `${workspaceFolder}` will be automatically replaced by Cursor with the current workspace directory.
|
|
92
|
+
|
|
93
|
+
#### Option 2: Manually specify project ID
|
|
94
|
+
|
|
95
|
+
```json
|
|
96
|
+
{
|
|
97
|
+
"mcpServers": {
|
|
98
|
+
"architector": {
|
|
99
|
+
"command": "node",
|
|
100
|
+
"args": ["/absolute/path/to/mcp-architector/dist/index.js"],
|
|
101
|
+
"env": {
|
|
102
|
+
"MCP_PROJECT_ID": "my-project-name"
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Using Project ID in Tool Calls
|
|
110
|
+
|
|
111
|
+
When calling tools, you can:
|
|
112
|
+
|
|
113
|
+
1. **Use automatic project ID** (from environment): Just omit the `projectId` parameter
|
|
114
|
+
2. **Override per call**: Pass `projectId` explicitly in the tool call
|
|
115
|
+
3. **Use default**: If neither is provided, uses "default-project"
|
|
116
|
+
|
|
117
|
+
## Tools
|
|
118
|
+
|
|
119
|
+
### set-project-architecture
|
|
120
|
+
|
|
121
|
+
Creates or updates the overall architecture for a project.
|
|
122
|
+
|
|
123
|
+
**Input:**
|
|
124
|
+
- `projectId` (optional): Project ID (defaults to "default-project")
|
|
125
|
+
- `description`: Overall project description
|
|
126
|
+
- `modules`: Array of module objects with:
|
|
127
|
+
- `name`: Module name
|
|
128
|
+
- `description`: Brief description of the module
|
|
129
|
+
- `inputs` (optional): What this module requires to work
|
|
130
|
+
- `outputs` (optional): What this module produces or generates
|
|
131
|
+
- `dataFlow` (optional): Object describing data flow between modules:
|
|
132
|
+
- Key: module name
|
|
133
|
+
- Value: object with:
|
|
134
|
+
- `dependsOn` (optional): Array of module names this module depends on
|
|
135
|
+
- `providesTo` (optional): Array of module names that receive data from this module
|
|
136
|
+
- `dataTransformation` (optional): How data is transformed between modules
|
|
137
|
+
|
|
138
|
+
**Output:**
|
|
139
|
+
- Project ID and success message
|
|
140
|
+
|
|
141
|
+
### get-project-architecture
|
|
142
|
+
|
|
143
|
+
Retrieves the overall architecture of the project.
|
|
144
|
+
|
|
145
|
+
**Input:**
|
|
146
|
+
- `projectId` (optional): Project ID (defaults to "default-project")
|
|
147
|
+
|
|
148
|
+
**Output:**
|
|
149
|
+
- Complete project architecture
|
|
150
|
+
|
|
151
|
+
### set-module-details
|
|
152
|
+
|
|
153
|
+
Creates or updates detailed information about a module.
|
|
154
|
+
|
|
155
|
+
**Input:**
|
|
156
|
+
- `projectId` (optional): Project ID
|
|
157
|
+
- `name`: Module name
|
|
158
|
+
- `description`: Detailed description of the module
|
|
159
|
+
- `inputs`: What the module accepts as input
|
|
160
|
+
- `outputs`: What the module produces as output
|
|
161
|
+
- `dependencies` (optional): List of module dependencies
|
|
162
|
+
- `files` (optional): List of files belonging to this module
|
|
163
|
+
- `usageExamples` (optional): Array of usage examples with fields:
|
|
164
|
+
- `title`: Example title
|
|
165
|
+
- `description` (optional): Description of the example
|
|
166
|
+
- `command` (optional): Command or code snippet
|
|
167
|
+
- `input` (optional): Input data
|
|
168
|
+
- `output` (optional): Expected output
|
|
169
|
+
- `notes` (optional): Additional notes about the example
|
|
170
|
+
- `notes` (optional): Additional notes
|
|
171
|
+
|
|
172
|
+
**Output:**
|
|
173
|
+
- Module ID and success message
|
|
174
|
+
|
|
175
|
+
### get-module-details
|
|
176
|
+
|
|
177
|
+
Retrieves detailed information about a specific module.
|
|
178
|
+
|
|
179
|
+
**Input:**
|
|
180
|
+
- `projectId` (optional): Project ID
|
|
181
|
+
- `moduleName`: Name of the module to retrieve
|
|
182
|
+
|
|
183
|
+
**Output:**
|
|
184
|
+
- Complete module details
|
|
185
|
+
|
|
186
|
+
### list-modules
|
|
187
|
+
|
|
188
|
+
Lists all modules in the project architecture.
|
|
189
|
+
|
|
190
|
+
**Input:**
|
|
191
|
+
- `projectId` (optional): Project ID
|
|
192
|
+
|
|
193
|
+
**Output:**
|
|
194
|
+
- Array of module summaries
|
|
195
|
+
|
|
196
|
+
### delete-module
|
|
197
|
+
|
|
198
|
+
Deletes a module from the project architecture.
|
|
199
|
+
|
|
200
|
+
**Input:**
|
|
201
|
+
- `projectId` (optional): Project ID
|
|
202
|
+
- `moduleName`: Name of the module to delete
|
|
203
|
+
|
|
204
|
+
**Output:**
|
|
205
|
+
- Success message
|
|
206
|
+
|
|
207
|
+
### set-script-documentation
|
|
208
|
+
|
|
209
|
+
Creates or updates documentation for a script or command.
|
|
210
|
+
|
|
211
|
+
**Input:**
|
|
212
|
+
- `projectId` (optional): Project ID
|
|
213
|
+
- `scriptName`: Name of the script
|
|
214
|
+
- `description`: Description of what the script does
|
|
215
|
+
- `usage`: Usage command or syntax
|
|
216
|
+
- `examples`: Array of usage examples
|
|
217
|
+
- `parameters`: Object mapping parameter names to descriptions
|
|
218
|
+
- `notes` (optional): Additional notes
|
|
219
|
+
|
|
220
|
+
**Output:**
|
|
221
|
+
- Script ID and success message
|
|
222
|
+
|
|
223
|
+
### get-script-documentation
|
|
224
|
+
|
|
225
|
+
Retrieves documentation for a specific script.
|
|
226
|
+
|
|
227
|
+
**Input:**
|
|
228
|
+
- `projectId` (optional): Project ID
|
|
229
|
+
- `scriptName`: Name of the script to retrieve
|
|
230
|
+
|
|
231
|
+
**Output:**
|
|
232
|
+
- Script documentation
|
|
233
|
+
|
|
234
|
+
### list-scripts
|
|
235
|
+
|
|
236
|
+
Lists all documented scripts in the project.
|
|
237
|
+
|
|
238
|
+
**Input:**
|
|
239
|
+
- `projectId` (optional): Project ID
|
|
240
|
+
|
|
241
|
+
**Output:**
|
|
242
|
+
- Array of script documentations
|
|
243
|
+
|
|
244
|
+
## Resources
|
|
245
|
+
|
|
246
|
+
### architecture
|
|
247
|
+
|
|
248
|
+
Provides access to project architecture as a resource.
|
|
249
|
+
|
|
250
|
+
**Usage:**
|
|
251
|
+
Access via URI: `arch://{projectId}`
|
|
252
|
+
|
|
253
|
+
### module
|
|
254
|
+
|
|
255
|
+
Provides access to module details as a resource.
|
|
256
|
+
|
|
257
|
+
**Usage:**
|
|
258
|
+
Access via URI: `module://{projectId}/{moduleId}`
|
|
259
|
+
|
|
260
|
+
## Development
|
|
261
|
+
|
|
262
|
+
### Project Structure
|
|
263
|
+
|
|
264
|
+
```
|
|
265
|
+
mcp-architector/
|
|
266
|
+
├── src/
|
|
267
|
+
│ ├── index.ts # Main server implementation
|
|
268
|
+
│ ├── types.ts # Type definitions
|
|
269
|
+
│ └── storage.ts # Storage utilities
|
|
270
|
+
├── dist/ # Compiled output (generated)
|
|
271
|
+
├── package.json
|
|
272
|
+
├── tsconfig.json
|
|
273
|
+
└── README.md
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
## Project ID and Workdir
|
|
277
|
+
|
|
278
|
+
The server uses `projectId` to organize data in separate directories. The priority for determining project ID is:
|
|
279
|
+
|
|
280
|
+
1. **Explicitly passed** in tool call parameters (highest priority)
|
|
281
|
+
2. **From environment variable** `MCP_PROJECT_ID` (set during initialization)
|
|
282
|
+
3. **Default fallback** "default-project" (lowest priority)
|
|
283
|
+
|
|
284
|
+
For Cursor integration, set `MCP_PROJECT_ID` to use the workspace directory automatically as the project ID.
|
|
285
|
+
|
|
286
|
+
### Extending the Server
|
|
287
|
+
|
|
288
|
+
To add new tools, resources, or prompts, edit `src/index.ts`:
|
|
289
|
+
|
|
290
|
+
```typescript
|
|
291
|
+
// Add a tool
|
|
292
|
+
server.registerTool(
|
|
293
|
+
"tool-name",
|
|
294
|
+
{ /* tool config */ },
|
|
295
|
+
async (params) => { /* handler */ }
|
|
296
|
+
);
|
|
297
|
+
|
|
298
|
+
// Add a resource
|
|
299
|
+
server.registerResource(
|
|
300
|
+
"resource-name",
|
|
301
|
+
new ResourceTemplate("uri-template", { /* options */ }),
|
|
302
|
+
{ /* resource config */ },
|
|
303
|
+
async (uri, params) => { /* handler */ }
|
|
304
|
+
);
|
|
305
|
+
|
|
306
|
+
// Add a prompt
|
|
307
|
+
server.registerPrompt(
|
|
308
|
+
"prompt-name",
|
|
309
|
+
{ /* prompt config */ },
|
|
310
|
+
(args) => { /* handler */ }
|
|
311
|
+
);
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
## License
|
|
315
|
+
|
|
316
|
+
MIT
|
|
317
|
+
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|