@maka/maka-cli 5.2.11 → 5.3.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/.github/workflows/npm-publish.yml +21 -2
- package/eslint.config.js +10 -1
- package/package.json +19 -32
- package/tsconfig.json +2 -0
- package/docs/MCP_SERVER.md +0 -396
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
# This workflow
|
|
1
|
+
# This workflow runs tests on every push to master, when a GitHub Release is
|
|
2
|
+
# created, or manually via workflow_dispatch, and publishes to npm only when
|
|
3
|
+
# package.json's version differs from what's currently live on the registry.
|
|
2
4
|
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
|
|
3
5
|
|
|
4
6
|
name: Node.js Package
|
|
5
7
|
|
|
6
8
|
on:
|
|
9
|
+
push:
|
|
10
|
+
branches: [master]
|
|
7
11
|
release:
|
|
8
12
|
types: [created]
|
|
13
|
+
workflow_dispatch:
|
|
9
14
|
|
|
10
15
|
jobs:
|
|
11
16
|
build:
|
|
@@ -32,4 +37,18 @@ jobs:
|
|
|
32
37
|
registry-url: https://registry.npmjs.org/
|
|
33
38
|
- run: npm ci
|
|
34
39
|
- run: npm install -g npm@latest # trusted publishing needs npm >=11.5.1
|
|
35
|
-
-
|
|
40
|
+
- name: Check if version changed
|
|
41
|
+
id: version-check
|
|
42
|
+
run: |
|
|
43
|
+
LOCAL_VERSION=$(node -p "require('./package.json').version")
|
|
44
|
+
PUBLISHED_VERSION=$(npm view "$(node -p "require('./package.json').name")" version 2>/dev/null || echo "none")
|
|
45
|
+
echo "Local version: $LOCAL_VERSION"
|
|
46
|
+
echo "Published version: $PUBLISHED_VERSION"
|
|
47
|
+
if [ "$LOCAL_VERSION" != "$PUBLISHED_VERSION" ]; then
|
|
48
|
+
echo "should_publish=true" >> "$GITHUB_OUTPUT"
|
|
49
|
+
else
|
|
50
|
+
echo "should_publish=false" >> "$GITHUB_OUTPUT"
|
|
51
|
+
fi
|
|
52
|
+
- name: Publish to npm
|
|
53
|
+
if: steps.version-check.outputs.should_publish == 'true'
|
|
54
|
+
run: npm publish --access public
|
package/eslint.config.js
CHANGED
|
@@ -5,12 +5,21 @@ import tseslint from "typescript-eslint";
|
|
|
5
5
|
|
|
6
6
|
export default [
|
|
7
7
|
{files: ["**/*.{js,mjs,cjs,ts}"]},
|
|
8
|
-
{languageOptions: { globals: globals.browser }},
|
|
8
|
+
{languageOptions: { globals: globals.browser, parserOptions: { project: "./tsconfig.json" } }},
|
|
9
9
|
pluginJs.configs.recommended,
|
|
10
10
|
...tseslint.configs.recommended,
|
|
11
11
|
{
|
|
12
12
|
rules: {
|
|
13
13
|
"@typescript-eslint/no-explicit-any": "off",
|
|
14
|
+
"@typescript-eslint/no-floating-promises": "error",
|
|
15
|
+
"@typescript-eslint/no-misused-promises": "error",
|
|
16
|
+
"@typescript-eslint/prefer-promise-reject-errors": "error",
|
|
17
|
+
"@typescript-eslint/only-throw-error": "error",
|
|
18
|
+
"@typescript-eslint/no-unused-vars": ["error", {
|
|
19
|
+
argsIgnorePattern: "^_",
|
|
20
|
+
varsIgnorePattern: "^_",
|
|
21
|
+
destructuredArrayIgnorePattern: "^_",
|
|
22
|
+
}],
|
|
14
23
|
},
|
|
15
24
|
},
|
|
16
25
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maka/maka-cli",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"summary": "A command line tool for scaffolding Meteor 2.x applications using either React.",
|
|
6
6
|
"description": "A command line tool for scaffolding Meteor 2.x applications using React.",
|
|
@@ -33,80 +33,67 @@
|
|
|
33
33
|
"author": "Maka <maka@maka-cli.com>",
|
|
34
34
|
"license": "MIT",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@aws-sdk/client-ec2": "^3.
|
|
37
|
-
"@aws-sdk/client-ecr": "^3.
|
|
38
|
-
"@aws-sdk/client-route-53": "^3.
|
|
39
|
-
"@aws-sdk/client-route-53-domains": "^3.
|
|
36
|
+
"@aws-sdk/client-ec2": "^3.1111.0",
|
|
37
|
+
"@aws-sdk/client-ecr": "^3.1111.0",
|
|
38
|
+
"@aws-sdk/client-route-53": "^3.1111.0",
|
|
39
|
+
"@aws-sdk/client-route-53-domains": "^3.1111.0",
|
|
40
40
|
"@babel/eslint-parser": "^7.25.9",
|
|
41
|
-
"@inquirer/prompts": "^
|
|
41
|
+
"@inquirer/prompts": "^8.5.2",
|
|
42
42
|
"@maka/tar": "^6.2.2",
|
|
43
|
-
"@modelcontextprotocol/sdk": "^1.20.0",
|
|
44
43
|
"blessed": "^0.1.81",
|
|
45
44
|
"change-case": "^5.4.4",
|
|
46
45
|
"cli-color": "^2.0.4",
|
|
47
46
|
"cli-cursor": "^5.0.0",
|
|
48
47
|
"cli-table": "^0.3.11",
|
|
49
|
-
"cors": "^2.8.5",
|
|
50
48
|
"date-fns": "^4.1.0",
|
|
51
49
|
"delete": "github:maka-io/delete",
|
|
52
|
-
"dotenv": "^
|
|
53
|
-
"ejs": "^
|
|
50
|
+
"dotenv": "^17.4.2",
|
|
51
|
+
"ejs": "^6.0.1",
|
|
54
52
|
"elegant-spinner": "^3.0.0",
|
|
55
53
|
"eslint": "^9.13.0",
|
|
56
|
-
"express": "^5.1.0",
|
|
57
54
|
"http-proxy": "^1.18.1",
|
|
58
55
|
"humps": "^2.0.1",
|
|
59
56
|
"husky": "^9.1.6",
|
|
60
|
-
"jest": "^
|
|
57
|
+
"jest": "^30.4.2",
|
|
61
58
|
"latest-version": "^9.0.0",
|
|
62
59
|
"minimist": "^1.2.8",
|
|
63
60
|
"node-forge": "^1.3.1",
|
|
64
|
-
"open": "^10.1.0",
|
|
65
61
|
"rimraf": "^6.0.1",
|
|
66
62
|
"semver": "^7.6.3",
|
|
67
63
|
"single-line-log2": "^1.1.3",
|
|
68
64
|
"slash": "^5.1.0",
|
|
69
65
|
"spawn-args": "0.2.0",
|
|
70
66
|
"tar": "^7.4.3",
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"xtend": "^4.0.2",
|
|
74
|
-
"zod": "^3.24.1"
|
|
67
|
+
"uuid": "^14.0.1",
|
|
68
|
+
"xtend": "^4.0.2"
|
|
75
69
|
},
|
|
76
70
|
"devDependencies": {
|
|
77
|
-
"@aws-sdk/types": "^3.
|
|
71
|
+
"@aws-sdk/types": "^3.974.4",
|
|
78
72
|
"@eslint/js": "^9.13.0",
|
|
79
73
|
"@types/blessed": "^0.1.25",
|
|
80
|
-
"@types/chai": "^5.0.1",
|
|
81
74
|
"@types/cli-color": "^2.0.6",
|
|
82
75
|
"@types/cli-table": "^0.3.4",
|
|
83
|
-
"@types/cors": "^2.8.17",
|
|
84
76
|
"@types/ejs": "^3.1.5",
|
|
85
|
-
"@types/express": "^5.0.0",
|
|
86
77
|
"@types/fibers": "^3.1.4",
|
|
87
78
|
"@types/http-proxy": "^1.17.15",
|
|
88
79
|
"@types/humps": "^2.0.6",
|
|
89
80
|
"@types/inquirer": "^9.0.7",
|
|
90
|
-
"@types/jest": "^
|
|
81
|
+
"@types/jest": "^30.0.0",
|
|
91
82
|
"@types/jsonwebtoken": "^9.0.7",
|
|
92
83
|
"@types/meteor": "^2.9.8",
|
|
93
84
|
"@types/minimist": "^1.2.5",
|
|
94
85
|
"@types/node": "^22.8.5",
|
|
95
|
-
"@types/react": "^18.3.12",
|
|
96
|
-
"@types/react-dom": "^18.3.1",
|
|
97
86
|
"@types/uuid": "^10.0.0",
|
|
98
|
-
"aws-sdk": "^2.1691.0",
|
|
99
|
-
"chai": "^5.1.2",
|
|
100
87
|
"chdir": "^0.0.0",
|
|
101
88
|
"concat-stream": "^2.0.0",
|
|
102
|
-
"concurrently": "^
|
|
103
|
-
"esbuild": "^0.
|
|
104
|
-
"globals": "^
|
|
89
|
+
"concurrently": "^10.0.5",
|
|
90
|
+
"esbuild": "^0.28.2",
|
|
91
|
+
"globals": "^17.11.0",
|
|
105
92
|
"mkdirp": "^3.0.1",
|
|
106
93
|
"ts-jest": "^29.2.5",
|
|
107
|
-
"typescript": "^
|
|
108
|
-
"typescript-eslint": "^8.
|
|
109
|
-
"wait-on": "^
|
|
94
|
+
"typescript": "^6.0.3",
|
|
95
|
+
"typescript-eslint": "^8.67.0",
|
|
96
|
+
"wait-on": "^9.1.0"
|
|
110
97
|
},
|
|
111
98
|
"engines": {
|
|
112
99
|
"node": ">=22.17.0",
|
package/tsconfig.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
+
"ignoreDeprecations": "6.0",
|
|
3
4
|
"esModuleInterop": true,
|
|
4
5
|
"target": "esnext",
|
|
5
6
|
"module": "esnext",
|
|
@@ -11,6 +12,7 @@
|
|
|
11
12
|
"forceConsistentCasingInFileNames": true,
|
|
12
13
|
"declaration": true,
|
|
13
14
|
"strictNullChecks": true,
|
|
15
|
+
"strictPropertyInitialization": true,
|
|
14
16
|
"resolveJsonModule": true,
|
|
15
17
|
"moduleResolution": "node",
|
|
16
18
|
"sourceMap": true,
|
package/docs/MCP_SERVER.md
DELETED
|
@@ -1,396 +0,0 @@
|
|
|
1
|
-
# Maka CLI MCP Server
|
|
2
|
-
|
|
3
|
-
The Maka CLI includes an enhanced Model Context Protocol (MCP) server that exposes **all maka-cli capabilities** to AI agents like Claude. This allows AI assistants to discover, understand, and help you use any maka-cli command.
|
|
4
|
-
|
|
5
|
-
## Quick Start
|
|
6
|
-
|
|
7
|
-
Start the MCP server:
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
maka ai:mcp
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
The server starts on `http://localhost:3000` by default and automatically discovers all available maka-cli commands.
|
|
14
|
-
|
|
15
|
-
## Options
|
|
16
|
-
|
|
17
|
-
- `--port` - Port to listen on (default: 3000)
|
|
18
|
-
- `--host` - Host to bind to (default: localhost)
|
|
19
|
-
|
|
20
|
-
### Examples
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
# Start on default port
|
|
24
|
-
maka ai:mcp
|
|
25
|
-
|
|
26
|
-
# Custom port
|
|
27
|
-
maka ai:mcp --port=8080
|
|
28
|
-
|
|
29
|
-
# Bind to all network interfaces
|
|
30
|
-
maka ai:mcp --host=0.0.0.0 --port=3001
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## Server Features
|
|
34
|
-
|
|
35
|
-
### Tools
|
|
36
|
-
|
|
37
|
-
The MCP server provides these tools for AI agents:
|
|
38
|
-
|
|
39
|
-
#### 1. `list-maka-commands`
|
|
40
|
-
List all available Maka CLI commands with descriptions and usage.
|
|
41
|
-
|
|
42
|
-
**Parameters:**
|
|
43
|
-
- `filter` (optional): Filter commands by name or category (e.g., "aws", "generate", "deploy")
|
|
44
|
-
|
|
45
|
-
**Example Usage:**
|
|
46
|
-
```json
|
|
47
|
-
{
|
|
48
|
-
"name": "list-maka-commands",
|
|
49
|
-
"arguments": {
|
|
50
|
-
"filter": "generate"
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
#### 2. `get-command-info`
|
|
56
|
-
Get detailed information about a specific command including usage, options, examples, and description.
|
|
57
|
-
|
|
58
|
-
**Parameters:**
|
|
59
|
-
- `command` (required): Command name (e.g., "create", "generate:component", "aws:create-instance")
|
|
60
|
-
|
|
61
|
-
**Example Usage:**
|
|
62
|
-
```json
|
|
63
|
-
{
|
|
64
|
-
"name": "get-command-info",
|
|
65
|
-
"arguments": {
|
|
66
|
-
"command": "generate:component"
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
#### 3. `execute-maka-command`
|
|
72
|
-
Execute Maka CLI commands with safety restrictions to prevent destructive operations.
|
|
73
|
-
|
|
74
|
-
**Parameters:**
|
|
75
|
-
- `command` (required): Full command to execute (e.g., "maka --help")
|
|
76
|
-
- `workingDirectory` (optional): Working directory for the command
|
|
77
|
-
|
|
78
|
-
**Safety Features:**
|
|
79
|
-
- Blocks destructive commands (murder, uninstall, rm, delete)
|
|
80
|
-
- 30-second timeout
|
|
81
|
-
- 10MB output buffer limit
|
|
82
|
-
|
|
83
|
-
**Example Usage:**
|
|
84
|
-
```json
|
|
85
|
-
{
|
|
86
|
-
"name": "execute-maka-command",
|
|
87
|
-
"arguments": {
|
|
88
|
-
"command": "maka --help"
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
#### 4. `get-project-info`
|
|
94
|
-
Get information about the current Maka project including configuration.
|
|
95
|
-
|
|
96
|
-
**Example Usage:**
|
|
97
|
-
```json
|
|
98
|
-
{
|
|
99
|
-
"name": "get-project-info",
|
|
100
|
-
"arguments": {}
|
|
101
|
-
}
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
### Resources
|
|
105
|
-
|
|
106
|
-
#### 1. `maka://commands/all`
|
|
107
|
-
Complete reference of all Maka CLI commands in JSON format.
|
|
108
|
-
|
|
109
|
-
**Format:**
|
|
110
|
-
```json
|
|
111
|
-
[
|
|
112
|
-
{
|
|
113
|
-
"name": "create",
|
|
114
|
-
"aliases": "None",
|
|
115
|
-
"shortDesc": "Create a new Meteor application",
|
|
116
|
-
"description": "...",
|
|
117
|
-
"usage": "maka create <app-name>",
|
|
118
|
-
"examples": ["maka create MyApp"],
|
|
119
|
-
"validOpts": ["..."],
|
|
120
|
-
"requiredOpts": [],
|
|
121
|
-
"experimental": false
|
|
122
|
-
}
|
|
123
|
-
]
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
#### 2. `maka://project/config`
|
|
127
|
-
Current project configuration and metadata.
|
|
128
|
-
|
|
129
|
-
#### 3. `maka://info`
|
|
130
|
-
Maka CLI version, platform, and system information.
|
|
131
|
-
|
|
132
|
-
### Prompts
|
|
133
|
-
|
|
134
|
-
Interactive conversation starters for common workflows:
|
|
135
|
-
|
|
136
|
-
#### 1. `create-component`
|
|
137
|
-
Component creation wizard with examples and best practices.
|
|
138
|
-
|
|
139
|
-
**Parameters:**
|
|
140
|
-
- `componentName` (required): Name of the component
|
|
141
|
-
- `componentType` (optional): Type (component, page, layout, template)
|
|
142
|
-
|
|
143
|
-
#### 2. `deploy-help`
|
|
144
|
-
Deployment guide for different platforms and environments.
|
|
145
|
-
|
|
146
|
-
**Parameters:**
|
|
147
|
-
- `environment` (optional): Target environment (dev, staging, production)
|
|
148
|
-
- `platform` (optional): Deployment platform (aws, docker, custom)
|
|
149
|
-
|
|
150
|
-
#### 3. `project-setup`
|
|
151
|
-
Interactive guide for setting up a new Maka project.
|
|
152
|
-
|
|
153
|
-
**Parameters:**
|
|
154
|
-
- `projectType` (optional): Project type (basic, full-stack, api)
|
|
155
|
-
|
|
156
|
-
## Protocol
|
|
157
|
-
|
|
158
|
-
The server implements the [Model Context Protocol](https://modelcontextprotocol.io) specification:
|
|
159
|
-
|
|
160
|
-
- **Transport**: Streamable HTTP (stateless mode)
|
|
161
|
-
- **Format**: Server-Sent Events (SSE)
|
|
162
|
-
- **Message Protocol**: JSON-RPC 2.0
|
|
163
|
-
- **Protocol Version**: 2024-11-05
|
|
164
|
-
|
|
165
|
-
## Endpoints
|
|
166
|
-
|
|
167
|
-
- `POST /mcp` - MCP protocol endpoint (Server-Sent Events)
|
|
168
|
-
- `GET /health` - Health check endpoint
|
|
169
|
-
|
|
170
|
-
## Testing
|
|
171
|
-
|
|
172
|
-
### Health Check
|
|
173
|
-
```bash
|
|
174
|
-
curl http://localhost:3000/health
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
### List Available Tools
|
|
178
|
-
```bash
|
|
179
|
-
curl -X POST http://localhost:3000/mcp \
|
|
180
|
-
-H "Content-Type: application/json" \
|
|
181
|
-
-H "Accept: application/json, text/event-stream" \
|
|
182
|
-
-d '{
|
|
183
|
-
"jsonrpc": "2.0",
|
|
184
|
-
"id": 1,
|
|
185
|
-
"method": "tools/list",
|
|
186
|
-
"params": {}
|
|
187
|
-
}'
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
### Call a Tool
|
|
191
|
-
```bash
|
|
192
|
-
curl -X POST http://localhost:3000/mcp \
|
|
193
|
-
-H "Content-Type: application/json" \
|
|
194
|
-
-H "Accept: application/json, text/event-stream" \
|
|
195
|
-
-d '{
|
|
196
|
-
"jsonrpc": "2.0",
|
|
197
|
-
"id": 2,
|
|
198
|
-
"method": "tools/call",
|
|
199
|
-
"params": {
|
|
200
|
-
"name": "list-maka-commands",
|
|
201
|
-
"arguments": {
|
|
202
|
-
"filter": "aws"
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
}'
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
## Integrating with Claude Desktop
|
|
209
|
-
|
|
210
|
-
Add this configuration to your Claude Desktop MCP settings:
|
|
211
|
-
|
|
212
|
-
```json
|
|
213
|
-
{
|
|
214
|
-
"mcpServers": {
|
|
215
|
-
"maka-cli": {
|
|
216
|
-
"command": "maka",
|
|
217
|
-
"args": ["ai:mcp", "--port=3000"],
|
|
218
|
-
"transport": "http",
|
|
219
|
-
"url": "http://localhost:3000/mcp"
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
```
|
|
224
|
-
|
|
225
|
-
Alternatively, run the server manually and configure Claude Desktop to connect to the HTTP endpoint:
|
|
226
|
-
|
|
227
|
-
```json
|
|
228
|
-
{
|
|
229
|
-
"mcpServers": {
|
|
230
|
-
"maka-cli": {
|
|
231
|
-
"transport": "http",
|
|
232
|
-
"url": "http://localhost:3000/mcp"
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
## How It Works
|
|
239
|
-
|
|
240
|
-
### Command Discovery
|
|
241
|
-
|
|
242
|
-
The MCP server automatically discovers all commands by traversing the Maka CLI command tree:
|
|
243
|
-
|
|
244
|
-
1. Starts at the root `Maka` command
|
|
245
|
-
2. Recursively explores all subcommands
|
|
246
|
-
3. Extracts metadata (name, description, usage, options, examples)
|
|
247
|
-
4. Filters out internal/hidden commands
|
|
248
|
-
5. Builds a complete command registry
|
|
249
|
-
|
|
250
|
-
This means **any new command added to maka-cli is automatically exposed** through the MCP server.
|
|
251
|
-
|
|
252
|
-
### Project Detection
|
|
253
|
-
|
|
254
|
-
The server detects if you're in a Maka project by looking for `.maka/config.json`. Project-specific information is exposed through the `get-project-info` tool and `maka://project/config` resource.
|
|
255
|
-
|
|
256
|
-
## Use Cases for AI Agents
|
|
257
|
-
|
|
258
|
-
With this MCP server, AI agents like Claude can:
|
|
259
|
-
|
|
260
|
-
1. **Discover Commands**: "What commands are available in maka-cli?"
|
|
261
|
-
2. **Get Help**: "How do I create a new component?"
|
|
262
|
-
3. **Learn Usage**: "Show me examples of the deploy command"
|
|
263
|
-
4. **Execute Commands**: "Run maka --version for me"
|
|
264
|
-
5. **Guide Workflows**: "Walk me through deploying to AWS"
|
|
265
|
-
6. **Project Context**: "What's configured in my current project?"
|
|
266
|
-
|
|
267
|
-
## Customization
|
|
268
|
-
|
|
269
|
-
### Adding Custom Tools
|
|
270
|
-
|
|
271
|
-
Edit `src/commands/ai/mcp.sub.cmd.ts` and add new tools:
|
|
272
|
-
|
|
273
|
-
```typescript
|
|
274
|
-
server.tool(
|
|
275
|
-
'my-custom-tool',
|
|
276
|
-
'Description of what my tool does',
|
|
277
|
-
{
|
|
278
|
-
param1: z.string().describe('Description of parameter')
|
|
279
|
-
},
|
|
280
|
-
async ({ param1 }) => {
|
|
281
|
-
// Your tool logic here
|
|
282
|
-
return {
|
|
283
|
-
content: [
|
|
284
|
-
{
|
|
285
|
-
type: 'text',
|
|
286
|
-
text: `Result: ${param1}`
|
|
287
|
-
}
|
|
288
|
-
]
|
|
289
|
-
};
|
|
290
|
-
}
|
|
291
|
-
);
|
|
292
|
-
```
|
|
293
|
-
|
|
294
|
-
### Adding Custom Resources
|
|
295
|
-
|
|
296
|
-
```typescript
|
|
297
|
-
server.resource(
|
|
298
|
-
'my-resource',
|
|
299
|
-
'maka://custom/resource',
|
|
300
|
-
{
|
|
301
|
-
mimeType: 'application/json',
|
|
302
|
-
description: 'My custom resource'
|
|
303
|
-
},
|
|
304
|
-
async () => {
|
|
305
|
-
return {
|
|
306
|
-
contents: [
|
|
307
|
-
{
|
|
308
|
-
uri: 'maka://custom/resource',
|
|
309
|
-
mimeType: 'application/json',
|
|
310
|
-
text: JSON.stringify({ data: 'value' }, null, 2)
|
|
311
|
-
}
|
|
312
|
-
]
|
|
313
|
-
};
|
|
314
|
-
}
|
|
315
|
-
);
|
|
316
|
-
```
|
|
317
|
-
|
|
318
|
-
### Adding Custom Prompts
|
|
319
|
-
|
|
320
|
-
```typescript
|
|
321
|
-
server.prompt(
|
|
322
|
-
'my-workflow',
|
|
323
|
-
'Guided workflow for a specific task',
|
|
324
|
-
{
|
|
325
|
-
taskType: z.enum(['option1', 'option2']).describe('Type of task')
|
|
326
|
-
},
|
|
327
|
-
async ({ taskType }) => {
|
|
328
|
-
return {
|
|
329
|
-
messages: [
|
|
330
|
-
{
|
|
331
|
-
role: 'user',
|
|
332
|
-
content: {
|
|
333
|
-
type: 'text',
|
|
334
|
-
text: `Help me with ${taskType}`
|
|
335
|
-
}
|
|
336
|
-
},
|
|
337
|
-
{
|
|
338
|
-
role: 'assistant',
|
|
339
|
-
content: {
|
|
340
|
-
type: 'text',
|
|
341
|
-
text: `Here's how to handle ${taskType}...`
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
]
|
|
345
|
-
};
|
|
346
|
-
}
|
|
347
|
-
);
|
|
348
|
-
```
|
|
349
|
-
|
|
350
|
-
## CORS Configuration
|
|
351
|
-
|
|
352
|
-
The server is configured with CORS enabled for all origins by default. For production:
|
|
353
|
-
|
|
354
|
-
```typescript
|
|
355
|
-
app.use(cors({
|
|
356
|
-
origin: 'https://yourdomain.com', // Restrict to specific origin
|
|
357
|
-
exposedHeaders: ['Mcp-Session-Id']
|
|
358
|
-
}));
|
|
359
|
-
```
|
|
360
|
-
|
|
361
|
-
## Dependencies
|
|
362
|
-
|
|
363
|
-
- `@modelcontextprotocol/sdk` - MCP SDK
|
|
364
|
-
- `express` - HTTP server
|
|
365
|
-
- `cors` - CORS middleware
|
|
366
|
-
- `zod` - Schema validation
|
|
367
|
-
|
|
368
|
-
## Architecture
|
|
369
|
-
|
|
370
|
-
```
|
|
371
|
-
┌─────────────────┐
|
|
372
|
-
│ AI Agent │
|
|
373
|
-
│ (e.g. Claude) │
|
|
374
|
-
└────────┬────────┘
|
|
375
|
-
│ MCP over HTTP
|
|
376
|
-
│
|
|
377
|
-
┌────────▼────────┐
|
|
378
|
-
│ MCP Server │
|
|
379
|
-
│ (ai:mcp cmd) │
|
|
380
|
-
├─────────────────┤
|
|
381
|
-
│ • Tools │
|
|
382
|
-
│ • Resources │
|
|
383
|
-
│ • Prompts │
|
|
384
|
-
└────────┬────────┘
|
|
385
|
-
│
|
|
386
|
-
├─► Command Discovery (Maka._commands)
|
|
387
|
-
├─► Project Detection (.maka/config.json)
|
|
388
|
-
└─► Command Execution (execSync with safety)
|
|
389
|
-
```
|
|
390
|
-
|
|
391
|
-
## Resources
|
|
392
|
-
|
|
393
|
-
- [Model Context Protocol Documentation](https://modelcontextprotocol.io)
|
|
394
|
-
- [MCP SDK on GitHub](https://github.com/modelcontextprotocol/typescript-sdk)
|
|
395
|
-
- [Claude Desktop MCP Integration](https://docs.anthropic.com/claude/docs/model-context-protocol)
|
|
396
|
-
- [Maka CLI Documentation](https://www.maka-cli.com)
|