Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
mcp.json
node_modules/
dist/
.smithery/
.yarn/*
!.yarn/patches
!.yarn/plugins
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ yarn build
"servers": {
"plainly": {
"command": "node",
"args": ["<FULL PATH TO dist/index.js>"],
"args": ["<FULL PATH TO dist/cli.js>"],
Copy link
Copy Markdown
Contributor

@ivansenic ivansenic Sep 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs updating help center once this is published.. do we really needed this? it's a breaking change imo, so if we keep the change, let's release 1.1.0 pls

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do you mean? this is for local dev only, npx command is still the same

"env": {
"PLAINLY_API_KEY": "<PLAINLY_API_KEY>"
}
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"typescript"
],
"type": "module",
"bin": "dist/index.js",
"module": "src/smithery.ts",
"bin": "dist/cli.js",
"files": [
"dist"
],
Expand All @@ -42,11 +43,12 @@
},
"packageManager": "yarn@4.9.2",
"dependencies": {
"@modelcontextprotocol/sdk": "^1.0.4",
"@modelcontextprotocol/sdk": "^1.18.2",
"axios": "^1.12.2",
"zod": "^3.25.76"
},
"devDependencies": {
"@smithery/sdk": "^1.6.4",
"@types/node": "^22.10.6",
"typescript": "^5.7.3",
"vite": "^6.3.6"
Expand Down
1 change: 1 addition & 0 deletions smithery.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
runtime: "typescript"
2 changes: 1 addition & 1 deletion src/index.ts → src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ const apiClient = createApiClient({
apiKey: env.PLAINLY_API_KEY,
});
const server = new PlainlyMcpServer(apiClient);
await server.start();
await server.startStdio();
19 changes: 9 additions & 10 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,25 @@ import { AxiosInstance } from "axios";
import createPlainlyClient, { PlainlySdk } from "./sdk";

export class PlainlyMcpServer {
server: McpServer;
transport: StdioServerTransport;
mcpServer: McpServer;

constructor(private readonly apiClient: AxiosInstance) {
this.server = new McpServer({
this.mcpServer = new McpServer({
name: PACKAGE_NAME,
version: PACKAGE_VERSION,
});
this.transport = new StdioServerTransport();
const plainlySdk: PlainlySdk = createPlainlyClient(this.apiClient);

// Register tools
registerListRenderableItems(plainlySdk, this.server);
registerGetRenderableItemDetails(plainlySdk, this.server);
registerRenderItem(plainlySdk, this.server);
registerCheckRenderStatus(plainlySdk, this.server);
registerListRenderableItems(plainlySdk, this.mcpServer);
registerGetRenderableItemDetails(plainlySdk, this.mcpServer);
registerRenderItem(plainlySdk, this.mcpServer);
registerCheckRenderStatus(plainlySdk, this.mcpServer);
}

async start() {
async startStdio() {
// Start the stdio server
await this.server.connect(this.transport);
const transport = new StdioServerTransport();
await this.mcpServer.connect(transport);
}
}
21 changes: 21 additions & 0 deletions src/smithery.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { z } from "zod";
import { PlainlyMcpServer } from "./server";
import env from "./env";
import { createApiClient } from "./axiosConfig";

export default function createServer({
config,
}: {
config: z.infer<typeof configSchema>;
}) {
const apiClient = createApiClient({
baseUrl: env.PLAINLY_API_URL,
apiKey: config.apiKey,
});
const plainlyServer = new PlainlyMcpServer(apiClient);
return plainlyServer.mcpServer.server;
}

export const configSchema = z.object({
apiKey: z.string().describe("Your Plainly API key."),
});
9 changes: 8 additions & 1 deletion src/tools/getRenderableItemDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function registerGetRenderableItemDetails(
.describe(
"Template/variant identifier (the renderable leaf under the parent)."
),
videoUrl: z
exampleVideoUrl: z
.string()
.url()
.optional()
Expand Down Expand Up @@ -81,6 +81,13 @@ export function registerGetRenderableItemDetails(
.describe(
"UI label for the parameter, used when description is missing or brief."
),
defaultValue: z
.any()
.nullable()
.optional()
.describe(
"Default value to use if none is provided. May be null or missing."
),
})
)
.describe(
Expand Down
6 changes: 3 additions & 3 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ export default defineConfig({
build: {
target: "node18",
lib: {
entry: resolve(__dirname, "src/index.ts"),
entry: resolve(__dirname, "src/cli.ts"),
formats: ["es"],
fileName: "index",
fileName: "cli",
},
rollupOptions: {
external: [
Expand All @@ -21,7 +21,7 @@ export default defineConfig({
output: {
format: "es",
preserveModules: false,
entryFileNames: "index.js",
entryFileNames: "cli.js",
},
},
outDir: "dist",
Expand Down
69 changes: 62 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,9 @@ __metadata:
languageName: node
linkType: hard

"@modelcontextprotocol/sdk@npm:^1.0.4":
version: 1.18.1
resolution: "@modelcontextprotocol/sdk@npm:1.18.1"
"@modelcontextprotocol/sdk@npm:^1.18.0, @modelcontextprotocol/sdk@npm:^1.18.2":
version: 1.18.2
resolution: "@modelcontextprotocol/sdk@npm:1.18.2"
dependencies:
ajv: "npm:^6.12.6"
content-type: "npm:^1.0.5"
Expand All @@ -226,7 +226,7 @@ __metadata:
raw-body: "npm:^3.0.0"
zod: "npm:^3.23.8"
zod-to-json-schema: "npm:^3.24.1"
checksum: 10c0/86849684f31932d4f1424f7e86dda6d0a3b308ad828790c0c052f381c57622829f8b86ad5cc0786d80c834ea113d7033398660e7327585db095fcaf6c4bc2ce0
checksum: 10c0/f0cb7a97ff264cbd389753b038c7dd197f359445324a7d4eb1d8e9be2cfb1e19d6375a12098cdd71c06847e9978c976950fc17f8d4f5e7778dd99d6f9416a48e
languageName: node
linkType: hard

Expand Down Expand Up @@ -263,14 +263,15 @@ __metadata:
version: 0.0.0-use.local
resolution: "@plainly-videos/mcp-server@workspace:."
dependencies:
"@modelcontextprotocol/sdk": "npm:^1.0.4"
"@modelcontextprotocol/sdk": "npm:^1.18.2"
"@smithery/sdk": "npm:^1.6.4"
"@types/node": "npm:^22.10.6"
axios: "npm:^1.12.2"
typescript: "npm:^5.7.3"
vite: "npm:^6.3.6"
zod: "npm:^3.25.76"
bin:
mcp-server: dist/index.js
mcp-server: dist/cli.js
languageName: unknown
linkType: soft

Expand Down Expand Up @@ -421,6 +422,23 @@ __metadata:
languageName: node
linkType: hard

"@smithery/sdk@npm:^1.6.4":
version: 1.6.4
resolution: "@smithery/sdk@npm:1.6.4"
dependencies:
"@modelcontextprotocol/sdk": "npm:^1.18.0"
express: "npm:^5.1.0"
jose: "npm:^6.1.0"
json-schema: "npm:^0.4.0"
lodash: "npm:^4.17.21"
okay-error: "npm:^1.0.3"
uuid: "npm:^11.0.3"
zod: "npm:^3.23.8"
zod-to-json-schema: "npm:^3.24.1"
checksum: 10c0/2fb8b698b6b6c7626511b7487bf4f9e0c4a594317fb7f10170d8f498441d8586aacbcd68771db17f11a7262c507388c52248b9ada1944a81b98e5e2121f659e3
languageName: node
linkType: hard

"@types/estree@npm:1.0.8":
version: 1.0.8
resolution: "@types/estree@npm:1.0.8"
Expand Down Expand Up @@ -949,7 +967,7 @@ __metadata:
languageName: node
linkType: hard

"express@npm:^5.0.1":
"express@npm:^5.0.1, express@npm:^5.1.0":
version: 5.1.0
resolution: "express@npm:5.1.0"
dependencies:
Expand Down Expand Up @@ -1316,13 +1334,34 @@ __metadata:
languageName: node
linkType: hard

"jose@npm:^6.1.0":
version: 6.1.0
resolution: "jose@npm:6.1.0"
checksum: 10c0/f4518579e907317e144facd15c7627acd06097bbea17735097437217498aa419564c039dd4020f6af5f2d024a7cee6b7be4648ccbbdc238aedb80a47c061217d
languageName: node
linkType: hard

"json-schema-traverse@npm:^0.4.1":
version: 0.4.1
resolution: "json-schema-traverse@npm:0.4.1"
checksum: 10c0/108fa90d4cc6f08243aedc6da16c408daf81793bf903e9fd5ab21983cda433d5d2da49e40711da016289465ec2e62e0324dcdfbc06275a607fe3233fde4942ce
languageName: node
linkType: hard

"json-schema@npm:^0.4.0":
version: 0.4.0
resolution: "json-schema@npm:0.4.0"
checksum: 10c0/d4a637ec1d83544857c1c163232f3da46912e971d5bf054ba44fdb88f07d8d359a462b4aec46f2745efbc57053365608d88bc1d7b1729f7b4fc3369765639ed3
languageName: node
linkType: hard

"lodash@npm:^4.17.21":
version: 4.17.21
resolution: "lodash@npm:4.17.21"
checksum: 10c0/d8cbea072bb08655bb4c989da418994b073a608dffa608b09ac04b43a791b12aeae7cd7ad919aa4c925f33b48490b5cfe6c1f71d827956071dae2e7bb3a6b74c
languageName: node
linkType: hard

"lru-cache@npm:^10.0.1, lru-cache@npm:^10.2.0":
version: 10.4.3
resolution: "lru-cache@npm:10.4.3"
Expand Down Expand Up @@ -1564,6 +1603,13 @@ __metadata:
languageName: node
linkType: hard

"okay-error@npm:^1.0.3":
version: 1.0.3
resolution: "okay-error@npm:1.0.3"
checksum: 10c0/5cae30c7b62822ee2ca2307da321f68ba92085b1a5fb5dc21f16cce9987b724da7a1562bb24cef44e58b6c1155b3d1abfcaba6c6d06f47a2170a43e7fd07c4d8
languageName: node
linkType: hard

"on-finished@npm:^2.4.1":
version: 2.4.1
resolution: "on-finished@npm:2.4.1"
Expand Down Expand Up @@ -2159,6 +2205,15 @@ __metadata:
languageName: node
linkType: hard

"uuid@npm:^11.0.3":
version: 11.1.0
resolution: "uuid@npm:11.1.0"
bin:
uuid: dist/esm/bin/uuid
checksum: 10c0/34aa51b9874ae398c2b799c88a127701408cd581ee89ec3baa53509dd8728cbb25826f2a038f9465f8b7be446f0fbf11558862965b18d21c993684297628d4d3
languageName: node
linkType: hard

"vary@npm:^1, vary@npm:^1.1.2":
version: 1.1.2
resolution: "vary@npm:1.1.2"
Expand Down