Sign In

@velocms/mcp

Package Overview
Dependencies
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@velocms/mcp - npm Package Compare versions

Comparing version
0.1.1
to
0.1.2
+5
-3
dist/env.d.ts
/**
* Pure env-resolution helper — kept separate from `index.ts` (which has a
* `#!/usr/bin/env node` shebang and starts the stdio server as a side effect
* on import) so the fail-fast "missing env var" behavior is unit-testable
* without spawning a subprocess or calling `process.exit`.
* on import) so the missing-env-var handling is unit-testable without
* spawning a subprocess. Since 0.1.2 a missing variable no longer exits the
* process at startup — the server boots for introspection and the error is
* returned per tool call instead.
*/

@@ -23,3 +25,3 @@ export interface VeloCmsEnvConfig {

export declare function resolveEnvConfig(env?: NodeJS.ProcessEnv): VeloCmsEnvResolution;
/** Human-readable message for the missing-env-var fail-fast path (stderr only, never stdout). */
/** Human-readable message for the missing-env-var path (stderr warning at boot + per-tool-call error text; never stdout). */
export declare function formatMissingEnvMessage(missing: string[]): string;
/**
* Pure env-resolution helper — kept separate from `index.ts` (which has a
* `#!/usr/bin/env node` shebang and starts the stdio server as a side effect
* on import) so the fail-fast "missing env var" behavior is unit-testable
* without spawning a subprocess or calling `process.exit`.
* on import) so the missing-env-var handling is unit-testable without
* spawning a subprocess. Since 0.1.2 a missing variable no longer exits the
* process at startup — the server boots for introspection and the error is
* returned per tool call instead.
*/

@@ -24,3 +26,3 @@ /**

}
/** Human-readable message for the missing-env-var fail-fast path (stderr only, never stdout). */
/** Human-readable message for the missing-env-var path (stderr warning at boot + per-tool-call error text; never stdout). */
export function formatMissingEnvMessage(missing) {

@@ -27,0 +29,0 @@ return (`[velocms-mcp] Missing required environment variable(s): ${missing.join(", ")}.\n` +

@@ -30,8 +30,26 @@ #!/usr/bin/env node

async function main() {
// Env resolution is LAZY (first tool call), not a startup gate: MCP
// registries (e.g. Glama) boot the server without credentials and only
// need it to start + answer introspection (initialize / tools/list).
// A missing key therefore surfaces as a helpful per-call tool error
// inside the MCP client instead of a dead server. Warn once on stderr
// so interactive users still see the misconfiguration immediately.
const resolution = resolveEnvConfig();
if (!resolution.ok) {
let client = null;
if (resolution.ok) {
client = new VeloCmsClient(resolution.config);
}
else {
console.error(formatMissingEnvMessage(resolution.missing));
process.exit(1);
}
const client = new VeloCmsClient(resolution.config);
/** Returns the API client, or the missing-env error message if unconfigured. */
function requireClient() {
if (client)
return client;
const late = resolveEnvConfig();
if (!late.ok)
return formatMissingEnvMessage(late.missing);
client = new VeloCmsClient(late.config);
return client;
}
const server = new McpServer({ name: SERVER_NAME, version: SERVER_VERSION });

@@ -44,4 +62,8 @@ for (const [name, tool] of Object.entries(tools)) {

}, async (args) => {
const resolved = requireClient();
if (typeof resolved === "string") {
return { content: [{ type: "text", text: resolved }], isError: true };
}
try {
const result = await tool.handler(client, (args ?? {}));
const result = await tool.handler(resolved, (args ?? {}));
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };

@@ -48,0 +70,0 @@ }

{
"name": "@velocms/mcp",
"version": "0.1.1",
"version": "0.1.2",
"description": "MCP server for VeloCMS — draft, publish, and manage your blog (posts, media, comments, members) from Claude Code, Claude Desktop, Cursor, or any MCP client.",

@@ -51,8 +51,8 @@ "type": "module",

"dependencies": {
"@modelcontextprotocol/sdk": "^1.12.1",
"zod": "^3.24.1"
"@modelcontextprotocol/sdk": "1.22.0",
"zod": "3.25.76"
},
"devDependencies": {
"@types/node": "^20.14.0",
"typescript": "^5.6.0",
"typescript": "5.6.3",
"vitest": "^2.1.0"

@@ -64,3 +64,6 @@ },

},
"mcpName": "org.velocms/mcp"
"mcpName": "org.velocms/mcp",
"overrides": {
"zod": "3.25.76"
}
}