@manfred-kunze-dev/backbone-mcp-server 2.6.0-dev.4

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.
@@ -0,0 +1,138 @@
1
+ import { z } from "zod";
2
+ import { formatErrorForMcp } from "../errors.js";
3
+ export function register(server, client) {
4
+ // ── list_schemas ────────────────────────────────────────────────────────
5
+ server.tool("backbone_list_schemas", "List schemas within a project with optional search and pagination.", {
6
+ projectId: z.string().describe("The project ID"),
7
+ search: z.string().optional().describe("Filter schemas by name"),
8
+ page: z.number().optional().default(0).describe("Page number (0-based)"),
9
+ size: z.number().optional().default(20).describe("Page size"),
10
+ sort: z.string().optional().describe("Sort field and direction"),
11
+ }, async ({ projectId, search, page, size, sort }) => {
12
+ try {
13
+ const { data } = await client.GET("/v1/projects/{projectId}/schemas", {
14
+ params: {
15
+ path: { projectId },
16
+ query: {
17
+ search,
18
+ page,
19
+ size,
20
+ sort: sort ? [sort] : undefined,
21
+ },
22
+ },
23
+ });
24
+ const result = data;
25
+ const lines = (result.content ?? []).map((s) => `- ${s.name} (id: ${s.id})${s.description ? ` — ${s.description}` : ""}`);
26
+ return {
27
+ content: [
28
+ {
29
+ type: "text",
30
+ text: `Schemas (${result.totalElements} total, page ${(result.number ?? 0) + 1}/${result.totalPages}):\n${lines.join("\n") || "(none)"}`,
31
+ },
32
+ ],
33
+ };
34
+ }
35
+ catch (error) {
36
+ return {
37
+ content: [{ type: "text", text: formatErrorForMcp(error) }],
38
+ isError: true,
39
+ };
40
+ }
41
+ });
42
+ // ── get_schema ──────────────────────────────────────────────────────────
43
+ server.tool("backbone_get_schema", "Get a schema by its ID.", {
44
+ projectId: z.string().describe("The project ID"),
45
+ schemaId: z.string().describe("The schema ID"),
46
+ }, async ({ projectId, schemaId }) => {
47
+ try {
48
+ const { data } = await client.GET("/v1/projects/{projectId}/schemas/{id}", {
49
+ params: { path: { projectId, id: schemaId } },
50
+ });
51
+ return {
52
+ content: [{ type: "text", text: JSON.stringify(data, null, 2) }],
53
+ };
54
+ }
55
+ catch (error) {
56
+ return {
57
+ content: [{ type: "text", text: formatErrorForMcp(error) }],
58
+ isError: true,
59
+ };
60
+ }
61
+ });
62
+ // ── create_schema ───────────────────────────────────────────────────────
63
+ server.tool("backbone_create_schema", "Create a new schema within a project.", {
64
+ projectId: z.string().describe("The project ID"),
65
+ name: z.string().min(1).describe("Schema name"),
66
+ description: z.string().optional().describe("Schema description"),
67
+ }, async ({ projectId, name, description }) => {
68
+ try {
69
+ const { data } = await client.POST("/v1/projects/{projectId}/schemas", {
70
+ params: { path: { projectId } },
71
+ body: {
72
+ name,
73
+ ...(description !== undefined && { description }),
74
+ },
75
+ });
76
+ return {
77
+ content: [{ type: "text", text: JSON.stringify(data, null, 2) }],
78
+ };
79
+ }
80
+ catch (error) {
81
+ return {
82
+ content: [{ type: "text", text: formatErrorForMcp(error) }],
83
+ isError: true,
84
+ };
85
+ }
86
+ });
87
+ // ── update_schema ───────────────────────────────────────────────────────
88
+ server.tool("backbone_update_schema", "Update an existing schema.", {
89
+ projectId: z.string().describe("The project ID"),
90
+ schemaId: z.string().describe("The schema ID"),
91
+ name: z.string().optional().describe("New schema name"),
92
+ description: z.string().optional().describe("New schema description"),
93
+ }, async ({ projectId, schemaId, name, description }) => {
94
+ try {
95
+ const body = {};
96
+ if (name !== undefined)
97
+ body.name = name;
98
+ if (description !== undefined)
99
+ body.description = description;
100
+ const { data } = await client.PUT("/v1/projects/{projectId}/schemas/{id}", {
101
+ params: { path: { projectId, id: schemaId } },
102
+ body: body,
103
+ });
104
+ return {
105
+ content: [{ type: "text", text: JSON.stringify(data, null, 2) }],
106
+ };
107
+ }
108
+ catch (error) {
109
+ return {
110
+ content: [{ type: "text", text: formatErrorForMcp(error) }],
111
+ isError: true,
112
+ };
113
+ }
114
+ });
115
+ // ── delete_schema ───────────────────────────────────────────────────────
116
+ server.tool("backbone_delete_schema", "Delete a schema and all its versions. This action is irreversible.", {
117
+ projectId: z.string().describe("The project ID"),
118
+ schemaId: z.string().describe("The schema ID to delete"),
119
+ }, async ({ projectId, schemaId }) => {
120
+ try {
121
+ await client.DELETE("/v1/projects/{projectId}/schemas/{id}", {
122
+ params: { path: { projectId, id: schemaId } },
123
+ });
124
+ return {
125
+ content: [
126
+ { type: "text", text: `Schema ${schemaId} deleted successfully.` },
127
+ ],
128
+ };
129
+ }
130
+ catch (error) {
131
+ return {
132
+ content: [{ type: "text", text: formatErrorForMcp(error) }],
133
+ isError: true,
134
+ };
135
+ }
136
+ });
137
+ }
138
+ //# sourceMappingURL=schemas.js.map
@@ -0,0 +1,4 @@
1
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import type { ApiClient } from "../client.js";
3
+ export declare function register(server: McpServer, client: ApiClient): void;
4
+ //# sourceMappingURL=transcription.d.ts.map
@@ -0,0 +1,76 @@
1
+ import { z } from "zod";
2
+ import { readFile } from "node:fs/promises";
3
+ import { basename } from "node:path";
4
+ import { formatErrorForMcp } from "../errors.js";
5
+ import { getMimeType } from "../mime.js";
6
+ export function register(server, client) {
7
+ server.tool("backbone_transcribe_audio", "Transcribe an audio file using Backbone's transcription API. Supports flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, webm. Reads local files automatically.", {
8
+ filePath: z.string().describe("Local path to the audio file"),
9
+ model: z
10
+ .string()
11
+ .describe("Transcription model in 'provider/model' format (e.g. 'openai/whisper-1')"),
12
+ language: z
13
+ .string()
14
+ .optional()
15
+ .describe("ISO-639-1 language code (e.g. 'en', 'de')"),
16
+ prompt: z
17
+ .string()
18
+ .optional()
19
+ .describe("Text to guide the transcription style/context"),
20
+ responseFormat: z
21
+ .enum(["json", "text", "srt", "verbose_json", "vtt"])
22
+ .optional()
23
+ .describe("Response format (default: json)"),
24
+ temperature: z
25
+ .number()
26
+ .min(0)
27
+ .max(1)
28
+ .optional()
29
+ .describe("Sampling temperature (0-1)"),
30
+ }, async ({ filePath, model, language, prompt, responseFormat, temperature }) => {
31
+ try {
32
+ const fileBuffer = await readFile(filePath);
33
+ const filename = basename(filePath);
34
+ const mimeType = getMimeType(filename);
35
+ const formData = new FormData();
36
+ formData.append("file", new Blob([fileBuffer], { type: mimeType }), filename);
37
+ formData.append("model", model);
38
+ if (language)
39
+ formData.append("language", language);
40
+ if (prompt)
41
+ formData.append("prompt", prompt);
42
+ if (responseFormat)
43
+ formData.append("response_format", responseFormat);
44
+ if (temperature !== undefined)
45
+ formData.append("temperature", String(temperature));
46
+ const { data } = await client.POST("/v1/audio/transcriptions", {
47
+ // Provide placeholder body for type checking; actual payload comes from bodySerializer
48
+ body: { file: "", model },
49
+ bodySerializer: () => formData,
50
+ });
51
+ const result = data;
52
+ const parts = [];
53
+ parts.push({ type: "text", text: result.text });
54
+ if (result.language) {
55
+ parts.push({
56
+ type: "text",
57
+ text: `[Language: ${result.language}]`,
58
+ });
59
+ }
60
+ if (result.duration !== undefined) {
61
+ parts.push({
62
+ type: "text",
63
+ text: `[Duration: ${result.duration}s]`,
64
+ });
65
+ }
66
+ return { content: parts };
67
+ }
68
+ catch (error) {
69
+ return {
70
+ content: [{ type: "text", text: formatErrorForMcp(error) }],
71
+ isError: true,
72
+ };
73
+ }
74
+ });
75
+ }
76
+ //# sourceMappingURL=transcription.js.map
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@manfred-kunze-dev/backbone-mcp-server",
3
+ "version": "2.6.0-dev.4",
4
+ "description": "MCP server for the Backbone AI platform",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "bin": {
8
+ "backbone-mcp": "dist/index.js"
9
+ },
10
+ "scripts": {
11
+ "build": "tsc",
12
+ "dev": "tsc --watch",
13
+ "start": "node dist/index.js",
14
+ "inspect": "npx @modelcontextprotocol/inspector -- node dist/index.js",
15
+ "generate:spec": "tsx --env-file=.env openapi/scripts/fetch-spec.ts",
16
+ "generate:types": "openapi-typescript openapi/openapi.json -o src/generated/openapi.d.ts",
17
+ "generate": "npm run generate:spec && npm run generate:types",
18
+ "check:spec": "tsx --env-file=.env openapi/scripts/check-drift.ts",
19
+ "typecheck": "tsc --noEmit"
20
+ },
21
+ "dependencies": {
22
+ "@modelcontextprotocol/sdk": "^1.27.0",
23
+ "openapi-fetch": "^0.13.5"
24
+ },
25
+ "devDependencies": {
26
+ "@types/node": "^22.13.4",
27
+ "openapi-typescript": "^7.6.1",
28
+ "tsx": "^4.19.3",
29
+ "typescript": "^5.9.3"
30
+ },
31
+ "engines": {
32
+ "node": ">=18.20.8"
33
+ },
34
+ "license": "SEE LICENSE IN LICENSE",
35
+ "publishConfig": {
36
+ "registry": "https://registry.npmjs.org",
37
+ "access": "public"
38
+ },
39
+ "repository": {
40
+ "type": "git",
41
+ "url": "https://gitlab.com/manfred-kunze-dev/backbone.git",
42
+ "directory": "mcp"
43
+ },
44
+ "files": [
45
+ "dist/**/*.js",
46
+ "dist/**/*.d.ts"
47
+ ]
48
+ }