@codify-ai/mcp-client 1.0.1 → 1.0.2

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.
Files changed (2) hide show
  1. package/mcp-client.js +36 -6
  2. package/package.json +1 -1
package/mcp-client.js CHANGED
@@ -25,7 +25,7 @@ import { z } from 'zod';
25
25
 
26
26
  function parseArgs() {
27
27
  const args = process.argv.slice(2);
28
- let serverUrl = process.env.CODIFY_SERVER_URL || 'http://localhost:8080';
28
+ let serverUrl = process.env.CODIFY_SERVER_URL || 'https://mcp.codify-api.com';
29
29
 
30
30
  for (let i = 0; i < args.length; i++) {
31
31
  const arg = args[i];
@@ -323,12 +323,39 @@ mcpServer.registerResource(
323
323
  // 注册工具:getCode - 从 SQLite 获取指定频道的代码
324
324
  mcpServer.registerTool(
325
325
  "getCode",
326
- z.object({
327
- channelId: z.string().describe("频道 ID,例如: my-demo, test-channel")
328
- }).describe("从 Codify 服务器获取指定频道的代码"),
329
- async ({ channelId }) => {
326
+ {
327
+ description: " Codify 服务器获取指定频道的代码",
328
+ inputSchema: {
329
+ channelId: z.string().describe("频道 ID,例如: my-demo, test-channel")
330
+ }
331
+ },
332
+ async (args) => {
330
333
  try {
334
+ // 调试:打印所有参数
335
+ if (process.env.DEBUG) {
336
+ console.error(`[DEBUG] getCode 接收到的参数:`, JSON.stringify(args, null, 2));
337
+ console.error(`[DEBUG] args 类型:`, typeof args);
338
+ console.error(`[DEBUG] args 是否为对象:`, args && typeof args === 'object');
339
+ console.error(`[DEBUG] args 的键:`, args ? Object.keys(args) : 'null');
340
+ }
341
+
342
+ // 从参数中获取 channelId
343
+ const channelId = args?.channelId;
344
+
331
345
  console.error(`[Tool] getCode 被调用: channelId=${channelId}`);
346
+ console.error(`[Tool] 原始 args:`, args);
347
+
348
+ if (!channelId) {
349
+ return {
350
+ content: [
351
+ {
352
+ type: "text",
353
+ text: `❌ 参数错误: 未提供 channelId\n\n💡 请使用格式: getCode({ channelId: "my-demo" })\n\n📋 调试信息:\n- args: ${JSON.stringify(args)}\n- args 类型: ${typeof args}`
354
+ }
355
+ ],
356
+ isError: true
357
+ };
358
+ }
332
359
 
333
360
  // 添加认证头
334
361
  const headers = {};
@@ -391,7 +418,10 @@ mcpServer.registerTool(
391
418
  // 注册工具:listChannels - 列出所有可用频道
392
419
  mcpServer.registerTool(
393
420
  "listChannels",
394
- z.object({}).describe("列出 Codify 服务器上所有可用的频道"),
421
+ {
422
+ description: "列出 Codify 服务器上所有可用的频道",
423
+ inputSchema: {}
424
+ },
395
425
  async () => {
396
426
  try {
397
427
  console.error(`[Tool] listChannels 被调用`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codify-ai/mcp-client",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Codify MCP 客户端 - 连接到远程 Codify MCP 服务器,供 Cursor 等 IDE 使用",
5
5
  "type": "module",
6
6
  "bin": {