mirror of
https://github.com/hanzoai/social.git
synced 2026-11-23 02:56:09 +00:00
POST /v1/social/mcp speaks the same social tool as the Hanzo MCP: one op, arguments in input. It carries the account and post records plus channels, schedule, settings, audiences, provider actions, media, image, video, and clipping. App secrets stay off the tool. Co-authored-by: Cursor Agent <[email protected]> Co-authored-by: z <[email protected]>
34 lines
1.3 KiB
JavaScript
34 lines
1.3 KiB
JavaScript
import assert from 'node:assert/strict'
|
|
import test from 'node:test'
|
|
|
|
import { handleEdgeRequest } from './edge.mjs'
|
|
|
|
test('the edge answers Postiz with JSON instead of the SPA', async () => {
|
|
const response = await handleEdgeRequest(
|
|
new Request('https://social.hanzo.ai/mcp', {
|
|
method: 'POST',
|
|
headers: { 'content-type': 'application/json', accept: 'application/json, text/event-stream' },
|
|
body: JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'tools/list' }),
|
|
}),
|
|
)
|
|
assert.equal(response.status, 401)
|
|
assert.match(response.headers.get('content-type'), /application\/json/)
|
|
const body = await response.json()
|
|
assert.match(body.message, /rejected this API key/)
|
|
})
|
|
|
|
test('the edge lists native agent operations without a key', async () => {
|
|
const response = await handleEdgeRequest(
|
|
new Request('https://social.hanzo.ai/v1/social/mcp', {
|
|
method: 'POST',
|
|
headers: { 'content-type': 'application/json' },
|
|
body: JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'tools/list' }),
|
|
}),
|
|
)
|
|
assert.equal(response.status, 200)
|
|
const body = await response.json()
|
|
const social = body.result.tools.find((tool) => tool.name === 'social')
|
|
assert.ok(social.inputSchema.properties.op.enum.includes('generate_social_image'))
|
|
assert.ok(social.inputSchema.properties.op.enum.includes('clip_social_video'))
|
|
})
|