@stellisoft/stellify-mcp 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,231 @@
1
+ # Stellify MCP Server
2
+
3
+ Model Context Protocol (MCP) server for Stellify - the AI-native code generation platform.
4
+
5
+ ## What is This?
6
+
7
+ This MCP server lets AI assistants (like Claude) interact with your Stellify projects to build Laravel applications incrementally. Instead of generating full code files at once, AI can:
8
+
9
+ 1. Create file structures (classes, controllers, models)
10
+ 2. Add method signatures
11
+ 3. Parse method bodies statement-by-statement
12
+ 4. Search existing code
13
+
14
+ ## Installation
15
+
16
+ ### Prerequisites
17
+
18
+ - Node.js 18 or higher
19
+ - A Stellify account with API access
20
+ - Claude Desktop (or another MCP-compatible client)
21
+
22
+ ### Setup
23
+
24
+ 1. **Install dependencies:**
25
+ ```bash
26
+ cd /Users/matthewanderson/stellify-mcp
27
+ npm install
28
+ ```
29
+
30
+ 2. **Build the TypeScript:**
31
+ ```bash
32
+ npm run build
33
+ ```
34
+
35
+ 3. **Create environment file:**
36
+ ```bash
37
+ cp .env.example .env
38
+ ```
39
+
40
+ 4. **Get your Stellify API token:**
41
+ - Log into Stellify web interface
42
+ - Go to Settings → API Tokens
43
+ - Create a new token
44
+ - Copy the token
45
+
46
+ 5. **Configure the .env file:**
47
+ ```bash
48
+ # Edit .env
49
+ STELLIFY_API_URL=https://stellisoft.com/api/v1
50
+ STELLIFY_API_TOKEN=your-token-here
51
+ ```
52
+
53
+ ## Configure Claude Desktop
54
+
55
+ Add this to your Claude Desktop config file:
56
+
57
+ **Location:** `~/.config/claude/config.json` (Linux/Mac) or `%APPDATA%\Claude\config.json` (Windows)
58
+
59
+ ```json
60
+ {
61
+ "mcpServers": {
62
+ "stellify": {
63
+ "command": "node",
64
+ "args": ["/Users/matthewanderson/stellify-mcp/dist/index.js"],
65
+ "env": {
66
+ "STELLIFY_API_URL": "https://stellisoft.com/api/v1",
67
+ "STELLIFY_API_TOKEN": "your-token-here"
68
+ }
69
+ }
70
+ }
71
+ }
72
+ ```
73
+
74
+ **Important:** Replace `/Users/matthewanderson/stellify-mcp` with the actual path and `your-token-here` with your real token.
75
+
76
+ ## Restart Claude Desktop
77
+
78
+ After adding the configuration, restart Claude Desktop for the changes to take effect.
79
+
80
+ ## Available Tools
81
+
82
+ ### `create_file`
83
+ Create a new file (class, controller, model, middleware) in a Stellify project.
84
+
85
+ **Parameters:**
86
+ - `project_id` (required): Stellify project UUID
87
+ - `name` (required): File name (e.g., "Calculator", "UserController")
88
+ - `type` (required): File type - "class", "model", "controller", or "middleware"
89
+ - `namespace` (optional): PHP namespace (e.g., "App\\Services\\")
90
+
91
+ **Example:**
92
+ ```
93
+ Create a Calculator class in my Stellify project abc-123
94
+ ```
95
+
96
+ ### `create_method`
97
+ Create a method signature in a file (without implementation).
98
+
99
+ **Parameters:**
100
+ - `file_uuid` (required): UUID of the file
101
+ - `name` (required): Method name (e.g., "add", "store")
102
+ - `visibility` (optional): "public", "protected", or "private" (default: "public")
103
+ - `is_static` (optional): boolean (default: false)
104
+ - `return_type` (optional): Return type (e.g., "int", "JsonResponse")
105
+ - `parameters` (optional): Array of `{name, type}` objects
106
+
107
+ **Example:**
108
+ ```
109
+ Add a public method called "add" that takes two integers and returns an integer
110
+ ```
111
+
112
+ ### `add_method_body`
113
+ Parse and add PHP code to a method body.
114
+
115
+ **Parameters:**
116
+ - `file_uuid` (required): UUID of the file
117
+ - `method_uuid` (required): UUID of the method
118
+ - `code` (required): PHP code (just the body, no function declaration)
119
+
120
+ **Example:**
121
+ ```
122
+ Add this implementation to the add method: return $a + $b;
123
+ ```
124
+
125
+ ### `search_methods`
126
+ Search for methods in the project.
127
+
128
+ **Parameters:**
129
+ - `name` (optional): Method name to search for
130
+ - `file_uuid` (optional): Filter to specific file
131
+
132
+ ### `search_files`
133
+ Search for files in the project.
134
+
135
+ **Parameters:**
136
+ - `name` (optional): File name pattern
137
+ - `type` (optional): File type filter
138
+
139
+ ## Usage Example
140
+
141
+ Once configured, you can talk to Claude naturally:
142
+
143
+ ```
144
+ User: "Create a Calculator service in my Stellify project abc-123"
145
+
146
+ Claude will:
147
+ 1. Call create_file to create Calculator.php
148
+ 2. Call create_method to add an "add" method
149
+ 3. Call add_method_body to implement "return $a + $b;"
150
+ ```
151
+
152
+ ## The Incremental Workflow
153
+
154
+ Stellify works incrementally, not by parsing entire files at once:
155
+
156
+ 1. **Create Structure** → File skeleton with no methods
157
+ 2. **Add Signatures** → Method declarations without bodies
158
+ 3. **Parse Bodies** → Statement-by-statement implementation
159
+ 4. **Assemble** → Stellify converts structured data back to PHP
160
+
161
+ This gives AI surgical control over your code.
162
+
163
+ ## Development
164
+
165
+ ### Watch mode (auto-rebuild on changes):
166
+ ```bash
167
+ npm run watch
168
+ ```
169
+
170
+ ### Manual build:
171
+ ```bash
172
+ npm run build
173
+ ```
174
+
175
+ ## Troubleshooting
176
+
177
+ ### "STELLIFY_API_TOKEN environment variable is required"
178
+ Make sure your `.env` file exists and contains your API token.
179
+
180
+ ### "Connection refused" or API errors
181
+ - Verify your API token is valid
182
+ - Check that `STELLIFY_API_URL` is correct
183
+ - Test the API directly: `curl -H "Authorization: Bearer YOUR_TOKEN" https://stellisoft.com/api/v1/file/search`
184
+
185
+ ### Claude Desktop doesn't see the tools
186
+ - Verify the path in `config.json` is absolute and correct
187
+ - Restart Claude Desktop
188
+ - Check Claude Desktop logs for errors
189
+
190
+ ### TypeScript errors during build
191
+ ```bash
192
+ rm -rf node_modules package-lock.json
193
+ npm install
194
+ npm run build
195
+ ```
196
+
197
+ ## Architecture
198
+
199
+ ```
200
+ Claude Desktop (AI)
201
+ ↓ (stdio)
202
+ Stellify MCP Server (Node.js)
203
+ ↓ (HTTPS)
204
+ Stellify API (Laravel)
205
+
206
+ Database (Structured Code)
207
+ ```
208
+
209
+ The MCP server is a thin client that:
210
+ 1. Exposes tools to Claude
211
+ 2. Translates tool calls to API requests
212
+ 3. Returns formatted responses
213
+
214
+ ## Next Steps
215
+
216
+ After Phase 1 works, we'll add:
217
+ - Global method library (reference battle-tested code)
218
+ - Contribute methods to global library
219
+ - Rich metadata extraction
220
+ - Usage statistics
221
+
222
+ ## Support
223
+
224
+ For issues or questions:
225
+ - GitHub: https://github.com/stellisoft/stellify-mcp
226
+ - Email: support@stellisoft.com
227
+ - Docs: https://stellisoft.com/docs/mcp
228
+
229
+ ## License
230
+
231
+ MIT
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,280 @@
1
+ #!/usr/bin/env node
2
+ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
3
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
4
+ import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
5
+ import { StellifyClient } from './stellify-client.js';
6
+ import dotenv from 'dotenv';
7
+ // Load environment variables
8
+ dotenv.config();
9
+ const API_URL = process.env.STELLIFY_API_URL || 'https://stellisoft.com/api/v1';
10
+ const API_TOKEN = process.env.STELLIFY_API_TOKEN;
11
+ if (!API_TOKEN) {
12
+ console.error('Error: STELLIFY_API_TOKEN environment variable is required');
13
+ process.exit(1);
14
+ }
15
+ // Initialize Stellify API client
16
+ const stellify = new StellifyClient({
17
+ apiUrl: API_URL,
18
+ apiToken: API_TOKEN,
19
+ });
20
+ // Define MCP tools
21
+ const tools = [
22
+ {
23
+ name: 'create_file',
24
+ description: 'Create a new file (class, model, controller, middleware) in a Stellify project. This creates the file structure but no methods yet.',
25
+ inputSchema: {
26
+ type: 'object',
27
+ properties: {
28
+ project_id: {
29
+ type: 'string',
30
+ description: 'The UUID of the Stellify project',
31
+ },
32
+ name: {
33
+ type: 'string',
34
+ description: 'File name (e.g., "Calculator", "UserController")',
35
+ },
36
+ type: {
37
+ type: 'string',
38
+ enum: ['class', 'model', 'controller', 'middleware'],
39
+ description: 'Type of file to create',
40
+ },
41
+ namespace: {
42
+ type: 'string',
43
+ description: 'PHP namespace (e.g., "App\\Services\\", "App\\Http\\Controllers\\")',
44
+ },
45
+ },
46
+ required: ['project_id', 'name', 'type'],
47
+ },
48
+ },
49
+ {
50
+ name: 'create_method',
51
+ description: 'Create a method signature in a file. This only creates the method declaration, not the body. Use add_method_body to add implementation.',
52
+ inputSchema: {
53
+ type: 'object',
54
+ properties: {
55
+ file_uuid: {
56
+ type: 'string',
57
+ description: 'UUID of the file to add the method to',
58
+ },
59
+ name: {
60
+ type: 'string',
61
+ description: 'Method name (e.g., "add", "store", "index")',
62
+ },
63
+ visibility: {
64
+ type: 'string',
65
+ enum: ['public', 'protected', 'private'],
66
+ description: 'Method visibility',
67
+ default: 'public',
68
+ },
69
+ is_static: {
70
+ type: 'boolean',
71
+ description: 'Whether the method is static',
72
+ default: false,
73
+ },
74
+ return_type: {
75
+ type: 'string',
76
+ description: 'Return type (e.g., "int", "string", "JsonResponse", "void")',
77
+ },
78
+ parameters: {
79
+ type: 'array',
80
+ description: 'Array of method parameters',
81
+ items: {
82
+ type: 'object',
83
+ properties: {
84
+ name: {
85
+ type: 'string',
86
+ description: 'Parameter name (without $)',
87
+ },
88
+ type: {
89
+ type: 'string',
90
+ description: 'Parameter type (e.g., "int", "string", "Request")',
91
+ },
92
+ },
93
+ required: ['name', 'type'],
94
+ },
95
+ },
96
+ },
97
+ required: ['file_uuid', 'name'],
98
+ },
99
+ },
100
+ {
101
+ name: 'add_method_body',
102
+ description: 'Parse and add PHP code to a method body. Provide the method implementation code (without the function declaration). Stellify will parse it into structured statements.',
103
+ inputSchema: {
104
+ type: 'object',
105
+ properties: {
106
+ file_uuid: {
107
+ type: 'string',
108
+ description: 'UUID of the file containing the method',
109
+ },
110
+ method_uuid: {
111
+ type: 'string',
112
+ description: 'UUID of the method to add code to',
113
+ },
114
+ code: {
115
+ type: 'string',
116
+ description: 'PHP code for the method body (just the statements, no function declaration). Example: "return $a + $b;"',
117
+ },
118
+ },
119
+ required: ['file_uuid', 'method_uuid', 'code'],
120
+ },
121
+ },
122
+ {
123
+ name: 'search_methods',
124
+ description: 'Search for methods in the project by name or within a specific file',
125
+ inputSchema: {
126
+ type: 'object',
127
+ properties: {
128
+ name: {
129
+ type: 'string',
130
+ description: 'Method name to search for (supports wildcards)',
131
+ },
132
+ file_uuid: {
133
+ type: 'string',
134
+ description: 'Optional: filter results to a specific file',
135
+ },
136
+ },
137
+ },
138
+ },
139
+ {
140
+ name: 'search_files',
141
+ description: 'Search for files in the project by name or type',
142
+ inputSchema: {
143
+ type: 'object',
144
+ properties: {
145
+ name: {
146
+ type: 'string',
147
+ description: 'File name pattern to search for',
148
+ },
149
+ type: {
150
+ type: 'string',
151
+ description: 'File type to filter by (class, model, controller, middleware)',
152
+ },
153
+ },
154
+ },
155
+ },
156
+ ];
157
+ // Create MCP server
158
+ const server = new Server({
159
+ name: 'stellify-mcp',
160
+ version: '0.1.0',
161
+ }, {
162
+ capabilities: {
163
+ tools: {},
164
+ },
165
+ });
166
+ // Handle tool list requests
167
+ server.setRequestHandler(ListToolsRequestSchema, async () => {
168
+ return { tools };
169
+ });
170
+ // Handle tool execution
171
+ server.setRequestHandler(CallToolRequestSchema, async (request) => {
172
+ const { name, arguments: args } = request.params;
173
+ if (!args) {
174
+ throw new Error('Arguments are required');
175
+ }
176
+ try {
177
+ switch (name) {
178
+ case 'create_file': {
179
+ const result = await stellify.createFile(args);
180
+ return {
181
+ content: [
182
+ {
183
+ type: 'text',
184
+ text: JSON.stringify({
185
+ success: true,
186
+ message: `Created file "${args.name}" (${result.uuid})`,
187
+ file: result,
188
+ }, null, 2),
189
+ },
190
+ ],
191
+ };
192
+ }
193
+ case 'create_method': {
194
+ const result = await stellify.createMethod(args);
195
+ return {
196
+ content: [
197
+ {
198
+ type: 'text',
199
+ text: JSON.stringify({
200
+ success: true,
201
+ message: `Created method "${args.name}" (${result.uuid})`,
202
+ method: result,
203
+ }, null, 2),
204
+ },
205
+ ],
206
+ };
207
+ }
208
+ case 'add_method_body': {
209
+ const result = await stellify.addMethodBody(args);
210
+ return {
211
+ content: [
212
+ {
213
+ type: 'text',
214
+ text: JSON.stringify({
215
+ success: true,
216
+ message: 'Method body parsed and saved successfully',
217
+ data: result,
218
+ }, null, 2),
219
+ },
220
+ ],
221
+ };
222
+ }
223
+ case 'search_methods': {
224
+ const result = await stellify.searchMethods(args);
225
+ return {
226
+ content: [
227
+ {
228
+ type: 'text',
229
+ text: JSON.stringify({
230
+ success: true,
231
+ results: result,
232
+ }, null, 2),
233
+ },
234
+ ],
235
+ };
236
+ }
237
+ case 'search_files': {
238
+ const result = await stellify.searchFiles(args);
239
+ return {
240
+ content: [
241
+ {
242
+ type: 'text',
243
+ text: JSON.stringify({
244
+ success: true,
245
+ results: result,
246
+ }, null, 2),
247
+ },
248
+ ],
249
+ };
250
+ }
251
+ default:
252
+ throw new Error(`Unknown tool: ${name}`);
253
+ }
254
+ }
255
+ catch (error) {
256
+ return {
257
+ content: [
258
+ {
259
+ type: 'text',
260
+ text: JSON.stringify({
261
+ success: false,
262
+ error: error.message,
263
+ details: error.response?.data || error.toString(),
264
+ }, null, 2),
265
+ },
266
+ ],
267
+ isError: true,
268
+ };
269
+ }
270
+ });
271
+ // Start server
272
+ async function main() {
273
+ const transport = new StdioServerTransport();
274
+ await server.connect(transport);
275
+ console.error('Stellify MCP server running on stdio');
276
+ }
277
+ main().catch((error) => {
278
+ console.error('Server error:', error);
279
+ process.exit(1);
280
+ });
@@ -0,0 +1,55 @@
1
+ export interface StellifyConfig {
2
+ apiUrl: string;
3
+ apiToken: string;
4
+ }
5
+ export interface CreateFileParams {
6
+ directory?: string;
7
+ name: string;
8
+ type: 'class' | 'model' | 'controller' | 'middleware';
9
+ namespace?: string;
10
+ }
11
+ export interface CreateMethodParams {
12
+ file: string;
13
+ name: string;
14
+ visibility?: 'public' | 'protected' | 'private';
15
+ is_static?: boolean;
16
+ returnType?: string;
17
+ parameters?: Array<{
18
+ name: string;
19
+ type: string;
20
+ }>;
21
+ }
22
+ export interface AddMethodBodyParams {
23
+ file_uuid: string;
24
+ method_uuid: string;
25
+ code: string;
26
+ }
27
+ export interface SearchMethodsParams {
28
+ name?: string;
29
+ file_uuid?: string;
30
+ }
31
+ export interface SearchFilesParams {
32
+ query: string;
33
+ type?: string;
34
+ project?: boolean;
35
+ includes?: boolean;
36
+ include_metadata?: boolean;
37
+ per_page?: number;
38
+ category?: string;
39
+ min_rating?: number;
40
+ tags?: string[];
41
+ user?: string;
42
+ sort?: 'created_at' | 'name' | 'type' | 'ai_rating' | 'usage_rating' | 'system_rating' | 'user_name';
43
+ direction?: 'asc' | 'desc';
44
+ }
45
+ export declare class StellifyClient {
46
+ private client;
47
+ constructor(config: StellifyConfig);
48
+ createFile(params: CreateFileParams): Promise<any>;
49
+ createMethod(params: CreateMethodParams): Promise<any>;
50
+ addMethodBody(params: AddMethodBodyParams): Promise<any>;
51
+ searchMethods(params: SearchMethodsParams): Promise<any>;
52
+ searchFiles(params: SearchFilesParams): Promise<any>;
53
+ getFile(uuid: string): Promise<any>;
54
+ getMethod(uuid: string): Promise<any>;
55
+ }
@@ -0,0 +1,42 @@
1
+ import axios from 'axios';
2
+ export class StellifyClient {
3
+ client;
4
+ constructor(config) {
5
+ this.client = axios.create({
6
+ baseURL: config.apiUrl,
7
+ headers: {
8
+ 'Authorization': `Bearer ${config.apiToken}`,
9
+ 'Content-Type': 'application/json',
10
+ 'Accept': 'application/json',
11
+ },
12
+ });
13
+ }
14
+ async createFile(params) {
15
+ const response = await this.client.post('/file', params);
16
+ return response.data;
17
+ }
18
+ async createMethod(params) {
19
+ const response = await this.client.post('/method', params);
20
+ return response.data;
21
+ }
22
+ async addMethodBody(params) {
23
+ const response = await this.client.post('/code', params);
24
+ return response.data;
25
+ }
26
+ async searchMethods(params) {
27
+ const response = await this.client.get('/method/search', { params });
28
+ return response.data;
29
+ }
30
+ async searchFiles(params) {
31
+ const response = await this.client.get('/file/search', { params });
32
+ return response.data;
33
+ }
34
+ async getFile(uuid) {
35
+ const response = await this.client.get(`/file/${uuid}`);
36
+ return response.data;
37
+ }
38
+ async getMethod(uuid) {
39
+ const response = await this.client.get(`/method/${uuid}`);
40
+ return response.data;
41
+ }
42
+ }
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@stellisoft/stellify-mcp",
3
+ "version": "0.1.0",
4
+ "description": "MCP server for Stellify - AI-native code generation platform",
5
+ "main": "dist/index.js",
6
+ "type": "module",
7
+ "bin": {
8
+ "stellify-mcp": "./dist/index.js"
9
+ },
10
+ "scripts": {
11
+ "build": "tsc",
12
+ "watch": "tsc --watch",
13
+ "prepare": "npm run build"
14
+ },
15
+ "keywords": [
16
+ "mcp",
17
+ "stellify",
18
+ "ai",
19
+ "code-generation",
20
+ "laravel"
21
+ ],
22
+ "author": "Stellisoft",
23
+ "license": "MIT",
24
+ "dependencies": {
25
+ "@modelcontextprotocol/sdk": "^1.0.4",
26
+ "axios": "^1.7.9",
27
+ "dotenv": "^16.4.7"
28
+ },
29
+ "devDependencies": {
30
+ "@types/node": "^22.10.5",
31
+ "typescript": "^5.7.2"
32
+ },
33
+ "engines": {
34
+ "node": ">=18.0.0"
35
+ }
36
+ }