@appsai/mcp-server 1.0.8 → 1.0.9
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 +6 -7
- package/dist/tools.d.ts +11 -1
- package/dist/tools.js +17 -120
- package/dist/tools.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -37,18 +37,17 @@ Add to MCP settings with:
|
|
|
37
37
|
3. Click **Create API Key**
|
|
38
38
|
4. Copy the key (shown once)
|
|
39
39
|
|
|
40
|
-
## Tools (
|
|
40
|
+
## Tools (90+ Total)
|
|
41
41
|
|
|
42
42
|
| Category | Tools | Description |
|
|
43
43
|
|----------|-------|-------------|
|
|
44
44
|
| **Project** | 5 | Create, list, and manage projects |
|
|
45
45
|
| **Canvas** | 25 | Edit React components, styles, and assets |
|
|
46
|
-
| **Server** | 6 | Backend Parse Server
|
|
47
|
-
| **System** |
|
|
48
|
-
| **AWS** | 23 | CloudFormation, S3,
|
|
46
|
+
| **Server** | 6 | Backend Parse Server cloud functions |
|
|
47
|
+
| **System** | 7 | Deploy frontend/backend, connect apps |
|
|
48
|
+
| **AWS** | 23 | CloudFormation, S3, EC2, and more |
|
|
49
49
|
| **MongoDB** | 18 | Database and collection management |
|
|
50
|
-
| **
|
|
51
|
-
| **Shared** | 7 | Cross-AI communication |
|
|
50
|
+
| **Agents** | 9 | AI prompt management and versioning |
|
|
52
51
|
|
|
53
52
|
## Example Usage
|
|
54
53
|
|
|
@@ -57,7 +56,7 @@ Add to MCP settings with:
|
|
|
57
56
|
→ project_LIST_PROJECTS
|
|
58
57
|
|
|
59
58
|
"Create a new Next.js app"
|
|
60
|
-
→
|
|
59
|
+
→ project_CREATE_APP
|
|
61
60
|
|
|
62
61
|
"Show the file tree for project abc123"
|
|
63
62
|
→ canvas_LIST_FILES
|
package/dist/tools.d.ts
CHANGED
|
@@ -2,16 +2,26 @@
|
|
|
2
2
|
* MCP Tool Registry
|
|
3
3
|
*
|
|
4
4
|
* Converts OpenAI-style tool definitions to MCP format and routes tool calls.
|
|
5
|
+
* All tool definitions come from the backend - this file handles:
|
|
6
|
+
* - Converting to MCP format
|
|
7
|
+
* - Injecting projectId where needed
|
|
8
|
+
* - Routing tool calls to the backend
|
|
5
9
|
*/
|
|
6
10
|
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
11
|
+
/**
|
|
12
|
+
* Tool categories matching the backend.
|
|
13
|
+
* - AI Types: canvas, server, aws, mongodb, agents
|
|
14
|
+
* - Shared Tools: project, system (available to all AIs)
|
|
15
|
+
*/
|
|
7
16
|
export type ToolCategory = 'project' | 'canvas' | 'server' | 'system' | 'aws' | 'mongodb' | 'agents';
|
|
8
17
|
/**
|
|
9
18
|
* Get all MCP tools
|
|
10
|
-
* Fetches tool definitions from
|
|
19
|
+
* Fetches tool definitions from the backend
|
|
11
20
|
*/
|
|
12
21
|
export declare function getAllTools(): Promise<Tool[]>;
|
|
13
22
|
/**
|
|
14
23
|
* Execute a tool call
|
|
24
|
+
* Routes all tools through the unified executeMCPTool backend function
|
|
15
25
|
*/
|
|
16
26
|
export declare function executeToolCall(toolName: string, args: Record<string, unknown>, userId: string): Promise<{
|
|
17
27
|
content: Array<{
|
package/dist/tools.js
CHANGED
|
@@ -2,24 +2,25 @@
|
|
|
2
2
|
* MCP Tool Registry
|
|
3
3
|
*
|
|
4
4
|
* Converts OpenAI-style tool definitions to MCP format and routes tool calls.
|
|
5
|
+
* All tool definitions come from the backend - this file handles:
|
|
6
|
+
* - Converting to MCP format
|
|
7
|
+
* - Injecting projectId where needed
|
|
8
|
+
* - Routing tool calls to the backend
|
|
5
9
|
*/
|
|
6
10
|
import { runCloudFunction } from './utils/parse.js';
|
|
7
11
|
// Categories that require projectId for execution
|
|
8
12
|
const CATEGORIES_REQUIRING_PROJECT_ID = ['canvas', 'server', 'system', 'aws', 'mongodb', 'agents'];
|
|
9
13
|
/**
|
|
10
14
|
* Convert an OpenAI-style tool to MCP format
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* Also injects projectId parameter for tools that require it.
|
|
15
|
-
* This enables connected apps - AI can target different projects.
|
|
15
|
+
* - Strips additionalProperties (Claude Code MCP bug workaround)
|
|
16
|
+
* - Injects projectId parameter for categories that require it
|
|
16
17
|
*/
|
|
17
18
|
function convertToMCPTool(tool, category) {
|
|
18
19
|
// Clone and strip additionalProperties which causes Claude Code to reject tools
|
|
20
|
+
// See: https://github.com/anthropics/claude-code/issues/2682
|
|
19
21
|
const { additionalProperties, ...cleanParams } = tool.parameters;
|
|
20
22
|
// Inject projectId for categories that require it (only if not already present)
|
|
21
23
|
if (CATEGORIES_REQUIRING_PROJECT_ID.includes(category)) {
|
|
22
|
-
// Check if projectId already exists in the tool schema (backend may define it)
|
|
23
24
|
if (!cleanParams.properties.projectId) {
|
|
24
25
|
cleanParams.properties = {
|
|
25
26
|
projectId: {
|
|
@@ -29,7 +30,6 @@ function convertToMCPTool(tool, category) {
|
|
|
29
30
|
...cleanParams.properties,
|
|
30
31
|
};
|
|
31
32
|
}
|
|
32
|
-
// Add projectId to required array if not already there
|
|
33
33
|
if (!cleanParams.required.includes('projectId')) {
|
|
34
34
|
cleanParams.required = ['projectId', ...cleanParams.required];
|
|
35
35
|
}
|
|
@@ -40,101 +40,12 @@ function convertToMCPTool(tool, category) {
|
|
|
40
40
|
inputSchema: cleanParams,
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
-
// Project management tools (new for MCP)
|
|
44
|
-
// Note: Removed additionalProperties to fix Claude Code MCP tool registration bug
|
|
45
|
-
// See: https://github.com/anthropics/claude-code/issues/2682
|
|
46
|
-
const projectTools = [
|
|
47
|
-
{
|
|
48
|
-
type: 'function',
|
|
49
|
-
name: 'LIST_PROJECTS',
|
|
50
|
-
description: 'List all projects owned by or shared with the authenticated user',
|
|
51
|
-
parameters: {
|
|
52
|
-
type: 'object',
|
|
53
|
-
properties: {
|
|
54
|
-
skip: { type: 'number', description: 'Number of projects to skip (for pagination)' },
|
|
55
|
-
limit: { type: 'number', description: 'Maximum number of projects to return (default 20)' },
|
|
56
|
-
},
|
|
57
|
-
required: [],
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
type: 'function',
|
|
62
|
-
name: 'GET_TEMPLATES',
|
|
63
|
-
description: 'Get available starter templates for creating new projects',
|
|
64
|
-
parameters: {
|
|
65
|
-
type: 'object',
|
|
66
|
-
properties: {
|
|
67
|
-
_placeholder: { type: 'string', description: 'Unused parameter (no parameters required)' },
|
|
68
|
-
},
|
|
69
|
-
required: [],
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
type: 'function',
|
|
74
|
-
name: 'CREATE_PROJECT',
|
|
75
|
-
description: 'Create a new project from a starter template',
|
|
76
|
-
parameters: {
|
|
77
|
-
type: 'object',
|
|
78
|
-
properties: {
|
|
79
|
-
templateS3Key: { type: 'string', description: 'S3 key of the starter template to use' },
|
|
80
|
-
},
|
|
81
|
-
required: ['templateS3Key'],
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
type: 'function',
|
|
86
|
-
name: 'GET_PROJECT_DETAILS',
|
|
87
|
-
description: 'Get detailed information about a specific project',
|
|
88
|
-
parameters: {
|
|
89
|
-
type: 'object',
|
|
90
|
-
properties: {
|
|
91
|
-
projectId: { type: 'string', description: 'The project ID' },
|
|
92
|
-
},
|
|
93
|
-
required: ['projectId'],
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
type: 'function',
|
|
98
|
-
name: 'DELETE_PROJECT',
|
|
99
|
-
description: 'Delete a project (owner only). This action cannot be undone.',
|
|
100
|
-
parameters: {
|
|
101
|
-
type: 'object',
|
|
102
|
-
properties: {
|
|
103
|
-
projectId: { type: 'string', description: 'The project ID to delete' },
|
|
104
|
-
},
|
|
105
|
-
required: ['projectId'],
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
];
|
|
109
|
-
// Map project tool names to cloud functions
|
|
110
|
-
const projectToolToCloudFunction = {
|
|
111
|
-
LIST_PROJECTS: 'getUserProjects',
|
|
112
|
-
GET_TEMPLATES: 'getTemplates',
|
|
113
|
-
CREATE_PROJECT: 'createProject',
|
|
114
|
-
GET_PROJECT_DETAILS: 'getProjectDetails',
|
|
115
|
-
DELETE_PROJECT: 'deleteProject',
|
|
116
|
-
};
|
|
117
|
-
// Map category tools to cloud functions
|
|
118
|
-
const categoryToolToCloudFunction = {
|
|
119
|
-
project: 'executeProjectTool',
|
|
120
|
-
canvas: 'executeMCPTool',
|
|
121
|
-
server: 'executeMCPTool',
|
|
122
|
-
system: 'executeMCPTool',
|
|
123
|
-
aws: 'executeMCPTool',
|
|
124
|
-
mongodb: 'executeMCPTool',
|
|
125
|
-
agents: 'executeMCPTool',
|
|
126
|
-
};
|
|
127
43
|
/**
|
|
128
44
|
* Get all MCP tools
|
|
129
|
-
* Fetches tool definitions from
|
|
45
|
+
* Fetches tool definitions from the backend
|
|
130
46
|
*/
|
|
131
47
|
export async function getAllTools() {
|
|
132
48
|
const tools = [];
|
|
133
|
-
// Add project tools (defined locally)
|
|
134
|
-
for (const tool of projectTools) {
|
|
135
|
-
tools.push(convertToMCPTool(tool, 'project'));
|
|
136
|
-
}
|
|
137
|
-
// Fetch category tools from backend
|
|
138
49
|
try {
|
|
139
50
|
const result = await runCloudFunction('getMCPToolDefinitions', {});
|
|
140
51
|
for (const [category, categoryTools] of Object.entries(result.tools)) {
|
|
@@ -145,12 +56,13 @@ export async function getAllTools() {
|
|
|
145
56
|
}
|
|
146
57
|
catch (error) {
|
|
147
58
|
console.error('[Tools] Failed to fetch tool definitions from backend:', error);
|
|
148
|
-
//
|
|
59
|
+
// No fallback - MCP server requires backend connectivity
|
|
149
60
|
}
|
|
150
61
|
return tools;
|
|
151
62
|
}
|
|
152
63
|
/**
|
|
153
64
|
* Execute a tool call
|
|
65
|
+
* Routes all tools through the unified executeMCPTool backend function
|
|
154
66
|
*/
|
|
155
67
|
export async function executeToolCall(toolName, args, userId) {
|
|
156
68
|
// Parse tool name: category_TOOL_NAME
|
|
@@ -164,27 +76,12 @@ export async function executeToolCall(toolName, args, userId) {
|
|
|
164
76
|
const category = toolName.substring(0, underscoreIndex);
|
|
165
77
|
const name = toolName.substring(underscoreIndex + 1);
|
|
166
78
|
try {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
content: [{ type: 'text', text: `Unknown project tool: ${name}` }],
|
|
174
|
-
isError: true,
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
result = await runCloudFunction(cloudFunction, { ...args, _mcpUserId: userId });
|
|
178
|
-
}
|
|
179
|
-
else {
|
|
180
|
-
// Handle category tools via unified MCP executor
|
|
181
|
-
result = await runCloudFunction('executeMCPTool', {
|
|
182
|
-
category,
|
|
183
|
-
tool: name,
|
|
184
|
-
params: args,
|
|
185
|
-
userId,
|
|
186
|
-
});
|
|
187
|
-
}
|
|
79
|
+
const result = await runCloudFunction('executeMCPTool', {
|
|
80
|
+
category,
|
|
81
|
+
tool: name,
|
|
82
|
+
params: args,
|
|
83
|
+
userId,
|
|
84
|
+
});
|
|
188
85
|
return {
|
|
189
86
|
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
|
|
190
87
|
};
|
|
@@ -194,7 +91,7 @@ export async function executeToolCall(toolName, args, userId) {
|
|
|
194
91
|
const code = error?.code;
|
|
195
92
|
if (code === 402) {
|
|
196
93
|
return {
|
|
197
|
-
content: [{ type: 'text', text: 'Insufficient credits.
|
|
94
|
+
content: [{ type: 'text', text: 'Insufficient credits. Add funds at https://appsai.com/billing' }],
|
|
198
95
|
isError: true,
|
|
199
96
|
};
|
|
200
97
|
}
|
package/dist/tools.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAA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