meebly-onboarding-mcp-server 0.0.1

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/package.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "meebly-onboarding-mcp-server",
3
+ "version": "0.0.1",
4
+ "type": "module",
5
+ "main": "dist/index.js",
6
+ "scripts": {
7
+ "build": "tsc",
8
+ "start": "node dist/index.js"
9
+ },
10
+ "dependencies": {
11
+ "@modelcontextprotocol/sdk": "^1.0.0",
12
+ "zod": "^4.2.1",
13
+ "zod-to-json-schema": "^3.25.1"
14
+ }
15
+ }
@@ -0,0 +1,17 @@
1
+ import axios from 'axios';
2
+
3
+ // For development, it can read from env var to point to local server
4
+ // In production, it will point to the deployed Meebly Backend because the env var will be undefined
5
+ const baseUrl =
6
+ (process.env.MEEBLY_BACKEND_URL || 'https://api.meebly.ai') + '/v1';
7
+
8
+ // Client will set
9
+ const apiKey = process.env.MEEBLY_API_KEY || '';
10
+
11
+ export const httpClient = axios.create({
12
+ baseURL: baseUrl,
13
+ validateStatus: () => true, // never throw when not 2XX
14
+ headers: {
15
+ 'X-API-Key': apiKey,
16
+ },
17
+ });
@@ -0,0 +1,40 @@
1
+ import { AxiosResponse } from 'axios';
2
+
3
+ /**
4
+ * Helper function to maintain consistent tool return structure for success, failure, and error cases.
5
+ */
6
+ export function toolSuccess(
7
+ response: AxiosResponse,
8
+ structuredContent?: Record<string, unknown>
9
+ ) {
10
+ return toolReturn(
11
+ `Operation performed successfully.\n${JSON.stringify(response.data, null, 2)}`,
12
+ structuredContent
13
+ );
14
+ }
15
+
16
+ export function toolFailure(response: AxiosResponse) {
17
+ return toolReturn(
18
+ `Operation failed. Status: ${response.status}\nResponse: ${JSON.stringify(response.data, null, 2)}`
19
+ );
20
+ }
21
+
22
+ export function toolError(error: unknown) {
23
+ return toolReturn(`Error occurred while performing operation: ${error}`);
24
+ }
25
+
26
+ // Helper function to format tool return messages in proper structure
27
+ function toolReturn(
28
+ message: string,
29
+ structuredContent?: Record<string, unknown>
30
+ ) {
31
+ return {
32
+ content: [
33
+ {
34
+ type: 'text' as const,
35
+ text: message,
36
+ },
37
+ ],
38
+ structuredContent: structuredContent,
39
+ };
40
+ }
package/src/index.ts ADDED
@@ -0,0 +1,42 @@
1
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
2
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
+
4
+ // Import all tools and resources
5
+ import * as tools from './tools/index.js';
6
+ import * as resources from './resources/index.js';
7
+
8
+ // Create the MCP server instance
9
+ const server: McpServer = new McpServer({
10
+ name: 'meebly-onboarding-mcp-server',
11
+ version: '0.0.1',
12
+ });
13
+
14
+ // Register the tools
15
+ Object.values(tools).forEach((tool) => {
16
+ server.registerTool(
17
+ tool.name,
18
+ {
19
+ description: tool.description,
20
+ inputSchema: tool.inputSchema,
21
+ outputSchema: tool.outputSchema,
22
+ },
23
+ tool.handler
24
+ );
25
+ });
26
+
27
+ // Register the resources
28
+ Object.values(resources).forEach((resource) => {
29
+ server.registerResource(
30
+ resource.name,
31
+ resource.uri,
32
+ resource.metadata,
33
+ resource.read
34
+ );
35
+ });
36
+
37
+ // Start listening over stdio
38
+ const transport = new StdioServerTransport();
39
+ await server.connect(transport);
40
+
41
+ // Keep process alive
42
+ process.stdin.resume();
@@ -0,0 +1,51 @@
1
+ import { V1ActionDataSchema } from '../../../src/utils/validation.js';
2
+ import { zodToJsonSchema } from 'zod-to-json-schema';
3
+
4
+ const actionJsonSchema = zodToJsonSchema(
5
+ V1ActionDataSchema as any,
6
+ 'V1ActionDataSchema'
7
+ );
8
+ const responseSchema = {
9
+ type: 'object',
10
+ properties: {
11
+ status: {
12
+ type: 'string',
13
+ description: 'Result status',
14
+ },
15
+ agent: actionJsonSchema,
16
+ },
17
+ required: ['status', 'agent'],
18
+ };
19
+
20
+ /**
21
+ * Resource describing the createAgent POST endpoint
22
+ */
23
+ export const createActionEndpointResource = {
24
+ name: 'createActionEndpoint',
25
+ uri: 'api://meebly/action/create',
26
+ metadata: {
27
+ description:
28
+ 'Describes the POST /action endpoint used to create new actions',
29
+ title: 'Create Action Endpoint',
30
+ },
31
+ read: async () => {
32
+ return {
33
+ contents: [
34
+ {
35
+ uri: 'api://meebly/action/create',
36
+ text: `
37
+ POST /action
38
+
39
+ Creates a new action.
40
+
41
+ Request body schema (JSON Schema):
42
+ ${JSON.stringify(actionJsonSchema, null, 2)}
43
+
44
+ Response schema (JSON Schema):
45
+ ${JSON.stringify(responseSchema, null, 2)}
46
+ `.trim(),
47
+ },
48
+ ],
49
+ };
50
+ },
51
+ } as const;
@@ -0,0 +1,50 @@
1
+ import { AgentDataSchema } from '../../../src/utils/validation.js';
2
+ import { zodToJsonSchema } from 'zod-to-json-schema';
3
+
4
+ const agentJsonSchema = zodToJsonSchema(
5
+ AgentDataSchema as any,
6
+ 'AgentDataSchema'
7
+ );
8
+ const responseSchema = {
9
+ type: 'object',
10
+ properties: {
11
+ status: {
12
+ type: 'string',
13
+ description: 'Result status',
14
+ },
15
+ agent: agentJsonSchema,
16
+ },
17
+ required: ['status', 'agent'],
18
+ };
19
+
20
+ /**
21
+ * Resource describing the createAgent POST endpoint
22
+ */
23
+ export const createAgentEndpointResource = {
24
+ name: 'createAgentEndpoint',
25
+ uri: 'api://meebly/agent/create',
26
+ metadata: {
27
+ description: 'Describes the POST /agent endpoint used to create new agents',
28
+ title: 'Create Agent Endpoint',
29
+ },
30
+ read: async () => {
31
+ return {
32
+ contents: [
33
+ {
34
+ uri: 'api://meebly/agent/create',
35
+ text: `
36
+ POST /agent
37
+
38
+ Creates a new agent.
39
+
40
+ Request body schema (JSON Schema):
41
+ ${JSON.stringify(agentJsonSchema, null, 2)}
42
+
43
+ Response schema (JSON Schema):
44
+ ${JSON.stringify(responseSchema, null, 2)}
45
+ `.trim(),
46
+ },
47
+ ],
48
+ };
49
+ },
50
+ } as const;
@@ -0,0 +1,3 @@
1
+ export { createActionEndpointResource } from './createActionEndpoint.js';
2
+ export { createAgentEndpointResource } from './createAgentEndpoint.js';
3
+ // add new resources here as you create them
@@ -0,0 +1,36 @@
1
+ import { AnySchema } from '@modelcontextprotocol/sdk/server/zod-compat.js';
2
+ import { V1ActionDataSchema } from '../../../src/utils/validation.js';
3
+ import { httpClient } from '../helpers/httpClient.js';
4
+ import { toolSuccess, toolFailure, toolError } from '../helpers/toolHelper.js';
5
+ import { z } from 'zod';
6
+
7
+ const CreateActionOutputSchema = z.object({
8
+ id: z.string().describe('The unique identifier of the created action'),
9
+ name: z.string().describe('The name of the created action'),
10
+ });
11
+
12
+ export const CreateActionTool = {
13
+ name: 'create_action',
14
+ description: 'Create a new action using the POST /action endpoint',
15
+ inputSchema: V1ActionDataSchema as unknown as AnySchema,
16
+ outputSchema: CreateActionOutputSchema as unknown as AnySchema,
17
+ handler: async (actionData: any) => {
18
+ const createData = V1ActionDataSchema.parse(actionData);
19
+
20
+ try {
21
+ const response = await httpClient.post('/action', createData);
22
+ if (response.status !== 201) {
23
+ return toolFailure(response);
24
+ }
25
+
26
+ const outputData = {
27
+ id: response.data.id,
28
+ name: response.data.operationName,
29
+ };
30
+
31
+ return toolSuccess(response, outputData);
32
+ } catch (error) {
33
+ return toolError(error);
34
+ }
35
+ },
36
+ };
@@ -0,0 +1,36 @@
1
+ import { AnySchema } from '@modelcontextprotocol/sdk/server/zod-compat.js';
2
+ import { AgentDataSchema } from '../../../src/utils/validation.js';
3
+ import { httpClient } from '../helpers/httpClient.js';
4
+ import { toolSuccess, toolFailure, toolError } from '../helpers/toolHelper.js';
5
+ import { z } from 'zod';
6
+
7
+ const CreateAgentOutputSchema = z.object({
8
+ id: z.string().describe('The unique identifier of the created agent'),
9
+ name: z.string().describe('The name of the created agent'),
10
+ });
11
+
12
+ export const CreateAgentTool = {
13
+ name: 'create_agent',
14
+ description: 'Create a new agent using the POST /agent endpoint',
15
+ inputSchema: AgentDataSchema as unknown as AnySchema,
16
+ outputSchema: CreateAgentOutputSchema as unknown as AnySchema,
17
+ handler: async (agentData: any) => {
18
+ const createData = AgentDataSchema.parse(agentData);
19
+
20
+ try {
21
+ const response = await httpClient.post('/agent', createData);
22
+ if (response.status !== 201) {
23
+ return toolFailure(response);
24
+ }
25
+
26
+ const outputData = {
27
+ id: response.data.id,
28
+ name: response.data.name,
29
+ };
30
+
31
+ return toolSuccess(response, outputData);
32
+ } catch (error) {
33
+ return toolError(error);
34
+ }
35
+ },
36
+ };
@@ -0,0 +1,3 @@
1
+ export { CreateAgentTool } from './createAgent.js';
2
+ export { CreateActionTool } from './createAction.js';
3
+ // add new tools here as you create them
package/tsconfig.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "NodeNext",
5
+ "moduleResolution": "NodeNext",
6
+ "outDir": "dist",
7
+ "strict": true,
8
+ "esModuleInterop": true,
9
+ "skipLibCheck": true
10
+ },
11
+ "include": ["src"]
12
+ }