suparank 1.2.5 → 1.2.7
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/bin/suparank.js +85 -536
- package/credentials.example.json +36 -18
- package/mcp-client/config.js +37 -0
- package/mcp-client/handlers/action.js +33 -0
- package/mcp-client/handlers/backend.js +43 -0
- package/mcp-client/handlers/index.js +9 -0
- package/mcp-client/handlers/orchestrator.js +850 -0
- package/mcp-client/index.js +33 -0
- package/mcp-client/publishers/ghost.js +105 -0
- package/mcp-client/publishers/image.js +306 -0
- package/mcp-client/publishers/index.js +20 -0
- package/mcp-client/publishers/webhook.js +76 -0
- package/mcp-client/publishers/wordpress.js +220 -0
- package/mcp-client/server.js +220 -0
- package/mcp-client/services/api.js +101 -0
- package/mcp-client/services/credentials.js +149 -0
- package/mcp-client/services/index.js +11 -0
- package/mcp-client/services/project.js +40 -0
- package/mcp-client/services/session-state.js +201 -0
- package/mcp-client/services/stats.js +50 -0
- package/mcp-client/tools/definitions.js +679 -0
- package/mcp-client/tools/discovery.js +132 -0
- package/mcp-client/tools/index.js +22 -0
- package/mcp-client/utils/content.js +126 -0
- package/mcp-client/utils/formatting.js +71 -0
- package/mcp-client/utils/index.js +10 -0
- package/mcp-client/utils/logging.js +38 -0
- package/mcp-client/utils/paths.js +134 -0
- package/mcp-client/workflow/index.js +10 -0
- package/mcp-client/workflow/planner.js +513 -0
- package/package.json +8 -19
- package/mcp-client.js +0 -3693
package/credentials.example.json
CHANGED
|
@@ -1,8 +1,24 @@
|
|
|
1
1
|
{
|
|
2
|
+
"wordpress": {
|
|
3
|
+
"site_url": "https://your-site.com",
|
|
4
|
+
"secret_key": "YOUR_KEY_FROM_SUPARANK_CONNECTOR_PLUGIN"
|
|
5
|
+
},
|
|
6
|
+
|
|
7
|
+
"ghost": {
|
|
8
|
+
"api_url": "https://your-site.ghost.io",
|
|
9
|
+
"admin_api_key": "your-key-id:your-secret-in-hex"
|
|
10
|
+
},
|
|
11
|
+
|
|
2
12
|
"image_provider": "fal",
|
|
3
13
|
|
|
4
14
|
"fal": {
|
|
5
|
-
"api_key": "your-fal-api-key"
|
|
15
|
+
"api_key": "your-fal-api-key",
|
|
16
|
+
"model": "fal-ai/flux-pro/v1.1"
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
"gemini": {
|
|
20
|
+
"api_key": "your-google-api-key",
|
|
21
|
+
"model": "gemini-2.0-flash-preview-image-generation"
|
|
6
22
|
},
|
|
7
23
|
|
|
8
24
|
"wiro": {
|
|
@@ -11,24 +27,26 @@
|
|
|
11
27
|
"model": "google/nano-banana-pro"
|
|
12
28
|
},
|
|
13
29
|
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
"secret_key": "from-suparank-connector-plugin"
|
|
30
|
+
"webhooks": {
|
|
31
|
+
"default_url": "https://your-default-webhook.com/endpoint",
|
|
32
|
+
"make_url": "https://hook.eu1.make.com/xxxxx",
|
|
33
|
+
"n8n_url": "https://your-n8n.com/webhook/xxxxx",
|
|
34
|
+
"zapier_url": "https://hooks.zapier.com/hooks/catch/xxxxx",
|
|
35
|
+
"slack_url": "https://hooks.slack.com/services/T00/B00/xxxxx"
|
|
21
36
|
},
|
|
22
37
|
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
38
|
+
"external_mcps": [
|
|
39
|
+
{
|
|
40
|
+
"name": "seo-research-mcp",
|
|
41
|
+
"description": "Provides real keyword data from SEO APIs",
|
|
42
|
+
"available_tools": ["get_keyword_data", "analyze_serp", "get_backlinks"]
|
|
43
|
+
}
|
|
44
|
+
],
|
|
27
45
|
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
46
|
+
"tool_instructions": [
|
|
47
|
+
{
|
|
48
|
+
"tool_name": "keyword_research",
|
|
49
|
+
"composition_hints": "For accurate search volume data, use seo-research-mcp's get_keyword_data tool."
|
|
50
|
+
}
|
|
51
|
+
]
|
|
34
52
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Suparank MCP - Configuration
|
|
3
|
+
*
|
|
4
|
+
* Centralized configuration and constants
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// Parse command line arguments
|
|
8
|
+
export const projectSlug = process.argv[2]
|
|
9
|
+
export const apiKey = process.argv[3]
|
|
10
|
+
export const apiUrl = process.env.SUPARANK_API_URL || 'https://api.suparank.io'
|
|
11
|
+
|
|
12
|
+
// External API endpoints - configurable via environment variables
|
|
13
|
+
export const API_ENDPOINTS = {
|
|
14
|
+
fal: process.env.FAL_API_URL || 'https://fal.run/fal-ai/nano-banana-pro',
|
|
15
|
+
gemini: process.env.GEMINI_API_URL || 'https://generativelanguage.googleapis.com/v1beta/models',
|
|
16
|
+
wiro: process.env.WIRO_API_URL || 'https://api.wiro.ai/v1',
|
|
17
|
+
wiroTaskDetail: process.env.WIRO_TASK_URL || 'https://api.wiro.ai/v1/Task/Detail'
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Session expiration (24 hours)
|
|
21
|
+
export const SESSION_EXPIRY_MS = 24 * 60 * 60 * 1000
|
|
22
|
+
|
|
23
|
+
// Tools that are visible in the MCP tool list
|
|
24
|
+
export const VISIBLE_TOOLS = [
|
|
25
|
+
// Essential (5) - Main workflow
|
|
26
|
+
'create_content', 'keyword_research', 'generate_image', 'publish_content', 'get_session',
|
|
27
|
+
// Session Management (5) - Content lifecycle
|
|
28
|
+
'save_content', 'list_content', 'load_content', 'remove_article', 'clear_session'
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
// Default stats object
|
|
32
|
+
export const DEFAULT_STATS = {
|
|
33
|
+
tool_calls: 0,
|
|
34
|
+
images_generated: 0,
|
|
35
|
+
articles_created: 0,
|
|
36
|
+
words_written: 0
|
|
37
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Suparank MCP - Action Tool Handler
|
|
3
|
+
*
|
|
4
|
+
* Dispatches action tools that run locally using credentials
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
executeImageGeneration,
|
|
9
|
+
executeWordPressPublish,
|
|
10
|
+
executeGhostPublish,
|
|
11
|
+
executeSendWebhook
|
|
12
|
+
} from '../publishers/index.js'
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Execute an action tool locally using credentials
|
|
16
|
+
* @param {string} toolName - Name of the action tool
|
|
17
|
+
* @param {object} args - Tool arguments
|
|
18
|
+
* @returns {Promise<object>} MCP response
|
|
19
|
+
*/
|
|
20
|
+
export async function executeActionTool(toolName, args) {
|
|
21
|
+
switch (toolName) {
|
|
22
|
+
case 'generate_image':
|
|
23
|
+
return await executeImageGeneration(args)
|
|
24
|
+
case 'publish_wordpress':
|
|
25
|
+
return await executeWordPressPublish(args)
|
|
26
|
+
case 'publish_ghost':
|
|
27
|
+
return await executeGhostPublish(args)
|
|
28
|
+
case 'send_webhook':
|
|
29
|
+
return await executeSendWebhook(args)
|
|
30
|
+
default:
|
|
31
|
+
throw new Error(`Unknown action tool: ${toolName}`)
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Suparank MCP - Backend Tool Handler
|
|
3
|
+
*
|
|
4
|
+
* Executes tools via the Suparank API backend
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { log } from '../utils/logging.js'
|
|
8
|
+
import { apiUrl, apiKey, projectSlug } from '../config.js'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Call a tool on the Suparank backend API
|
|
12
|
+
* @param {string} toolName - Name of the tool to execute
|
|
13
|
+
* @param {object} args - Tool arguments
|
|
14
|
+
* @returns {Promise<object>} Tool result from backend
|
|
15
|
+
*/
|
|
16
|
+
export async function callBackendTool(toolName, args) {
|
|
17
|
+
try {
|
|
18
|
+
const response = await fetch(`${apiUrl}/tools/${projectSlug}/${toolName}`, {
|
|
19
|
+
method: 'POST',
|
|
20
|
+
headers: {
|
|
21
|
+
'Authorization': `Bearer ${apiKey}`,
|
|
22
|
+
'Content-Type': 'application/json'
|
|
23
|
+
},
|
|
24
|
+
body: JSON.stringify({ arguments: args })
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
if (!response.ok) {
|
|
28
|
+
const error = await response.text()
|
|
29
|
+
|
|
30
|
+
if (response.status === 401) {
|
|
31
|
+
throw new Error(`Invalid or expired API key. Please create a new one in the dashboard.`)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
throw new Error(`Tool execution failed: ${error}`)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const result = await response.json()
|
|
38
|
+
return result
|
|
39
|
+
} catch (error) {
|
|
40
|
+
log('Error calling tool:', error.message)
|
|
41
|
+
throw error
|
|
42
|
+
}
|
|
43
|
+
}
|