Token导航 LogoToken导航TokenDH.com
Chuna AI logo
AI代理stdio官方级别未说明来源级核验

Chuna AI

MCP Server

chuna-ai

Chuna AI是一个将REST API转换为MCP(模型上下文协议)服务器的网关,使LLM能够无需编写代码即可理解和交互API。

工具数

0

提示词数

0

GitHub Stars

0

资源数

0
API网关TypeScriptClaudeClaude DesktopClaudeCursorVS Code

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

Krishank

提供方

Krishank

最后核验

2026/5/17 20:22

运行时

Node.js

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

npx chuna-ai serve -c ./config

详细介绍

Chuna AI

将任何REST API公开为MCP服务器,而无需编写一行代码。

Chuna AI是LLM访问任何组织API的网关。它可以将所有API作为MCP(模型上下文协议)服务器公开,这样LLM就可以理解它们并与之交互,而无需编写一行代码。

🚀 特性

  • 零代码配置:使用简单的JSON配置定义API
  • MCP协议支持:适用于Claude Desktop、Cursor和其他MCP客户端
  • 中间件系统:添加身份验证、日志记录、验证和自定义逻辑
  • 环境变量:使用安全令牌管理 ${ENV:VAR} 替换
  • 多种HTTP方法:支持GET、POST、PUT、PATCH、DELETE
  • TypeScript:使用TypeScript构建,以提高可靠性和类型安全性

🏗️ 建筑

graph TB
    subgraph "LLM Client"
        A[Claude Desktop]
        B[Cursor IDE]
        C[Other MCP Clients]
    end
    
    subgraph "Chuna AI"
        D[MCP StdIO Server]
        E[Config Loader]
        F[Middleware Engine]
        G[HTTP Executor]
    end
    
    subgraph "Configuration"
        H[tools.json]
        I[middleware/index.ts]
    end
    
    subgraph "External APIs"
        J[REST API 1]
        K[REST API 2]
        L[REST API N]
    end
    
    A --> D
    B --> D
    C --> D
    
    D --> E
    E --> H
    E --> I
    
    D --> F
    F --> G
    
    G --> J
    G --> K
    G --> L
    
    style D fill:#e1f5fe
    style F fill:#f3e5f5
    style G fill:#e8f5e8

📋 运作原理

  1. 配置:在中定义您的API tools.json 带可选中间件
  2. 启动服务器:运行 chuna-ai serve -c ./config
  3. MCP集成:在LLM客户端中配置(Claude Desktop、Cursor等)
  4. LLM互动:要求LLM将您的API用作工具

🛠️ 安装

# Clone the repository
git clone https://github.com/Krishank/chuna-ai.git
cd chuna-ai

# Install dependencies
npm install

# Build the project
npm run build

⚙️ 配置

基本设置

创建一个 config/tools.json 文件:

[
  {
    "name": "products_list",
    "description": "List all products from the API",
    "method": "GET",
    "url": "https://api.example.com/products"
  },
  {
    "name": "create_product",
    "description": "Create a new product",
    "method": "POST", 
    "url": "https://api.example.com/products",
    "headers": {
      "Content-Type": "application/json"
    }
  }
]

使用中间件

[
  {
    "name": "secure_products",
    "description": "List products with authentication and logging",
    "method": "GET",
    "url": "https://api.example.com/products",
    "preMiddleware": ["addAuthHeader", "logRequest"],
    "postMiddleware": ["validateResponse", "logResponse"]
  }
]

环境变量

对敏感数据使用环境变量:

[
  {
    "name": "authenticated_call",
    "method": "GET",
    "url": "https://api.example.com/data",
    "headers": {
      "Authorization": "Bearer ${ENV:API_TOKEN}"
    }
  }
]

🔧 中间件系统

可用中间件

  • addAuthHeader -添加授权标头
  • logRequest -记录HTTP请求
  • logResponse -记录HTTP响应
  • addTimestamp -添加X时间戳标头
  • validateResponse -4xx/5xx响应抛出错误

自定义中间件

在中添加自定义中间件 src/middleware/index.ts:

export const customAuth: PreMiddleware = (spec, context) => {
  return {
    ...spec,
    headers: {
      ...spec.headers,
      'X-API-Key': process.env.CUSTOM_API_KEY,
    },
  };
};

export const transformResponse: PostMiddleware = async (result, context) => {
  return {
    ...result,
    body: {
      data: result.body,
      timestamp: new Date().toISOString(),
    },
  };
};

然后在你的配置中使用:

{
  "name": "my_tool",
  "method": "GET", 
  "url": "https://api.example.com/data",
  "preMiddleware": ["customAuth"],
  "postMiddleware": ["transformResponse"]
}

🚀 用法

命令行接口命令模式

# Start the MCP server
node dist/cli.cjs serve -c ./config

# Or with npm
npm run build
npx chuna-ai serve -c ./config

库模式

import { startMcpServer, loadConfigFromPath } from 'chuna-ai';

const config = await loadConfigFromPath('./config');
await startMcpServer({ config });

🔌 MCP客户端集成

Chuna AI可与任何兼容MCP的客户端配合使用。以下是最受欢迎的选项:

🤖 克劳德桌面(拟人)

最适合:API集成的通用人工智能协助

设置:

  1. 从下载克劳德桌面 Anthropic网站
  2. 查找您的配置文件:

- macOS: ~/Library/Application Support/Claude/claude_desktop_config.json - 视窗: %APPDATA%\Claude\claude_desktop_config.json

  1. 添加Chuna AI服务器:
{
  "mcpServers": {
    "chuna-ai": {
      "command": "node",
      "args": [
        "/path/to/chuna-ai/dist/cli.cjs",
        "serve",
        "-c", 
        "/path/to/chuna-ai/config"
      ]
    }
  }
}
  1. 重新启动克劳德桌面
  2. 在新的对话中,提问:“有哪些工具可用?”或“列出我的API工具”

💻 光标IDE

最适合:代码开发与API集成

设置:

  1. 打开光标IDE
  2. 转到“设置”→ 特性→ 模型上下文协议
  3. 点击“编辑JSON”并添加:
{
  "mcpServers": {
    "chuna-ai": {
      "command": "node",
      "args": [
        "/path/to/chuna-ai/dist/cli.cjs",
        "serve",
        "-c",
        "/path/to/chuna-ai/config"
      ]
    }
  }
}
  1. 在MCP设置中单击“重新加载”
  2. 打开新聊天并使用API工具

🧠 Continue.dev

最适合:VS Code,AI编码辅助

设置:

  1. 在VS代码中安装Continue扩展
  2. 打开继续设置(Cmd/Ctrl + Shift + P → “继续:打开配置”)
  3. 增添 config.json:
{
  "mcpServers": {
    "chuna-ai": {
      "command": "node",
      "args": [
        "/path/to/chuna-ai/dist/cli.cjs",
        "serve",
        "-c",
        "/path/to/chuna-ai/config"
      ]
    }
  }
}
  1. 重新启动VS代码
  2. 使用 @ 在继续聊天以访问您的工具

🔧 MCP检查员(开发)

最适合:测试和调试MCP服务器

设置:

# Install MCP Inspector
npm install -g @modelcontextprotocol/inspector

# Start your Chuna AI server
node dist/cli.cjs serve -c ./config

# In another terminal, start inspector
mcp-inspector

特性:

  • 可视化工具测试界面
  • 请求/响应检查
  • 中间件调试
  • 实时工具执行

🐍 Python MCP客户端

最适合:自定义Python应用程序

import asyncio
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client

async def main():
    server_params = StdioServerParameters(
        command="node",
        args=["/path/to/chuna-ai/dist/cli.cjs", "serve", "-c", "/path/to/chuna-ai/config"]
    )
    
    async with stdio_client(server_params) as (read, write):
        async with ClientSession(read, write) as session:
            # List available tools
            tools = await session.list_tools()
            print(f"Available tools: {[tool.name for tool in tools.tools]}")
            
            # Call a tool
            result = await session.call_tool("products_list", {})
            print(f"Result: {result.content}")

asyncio.run(main())

🌐 基于Web的MCP客户端

最适合:基于浏览器的人工智能应用程序

热门选项:

  • MCP Web客户端:基于浏览器的MCP客户端
  • 自定义Web应用程序:使用MCP WebSocket传输构建自己的

📱 移动MCP客户端

最适合:移动AI应用程序

  • 克劳德·莫比尔:支持MCP的iOS/Android应用程序
  • 自定义移动应用程序:将MCP集成到React Native/Flutter应用程序中

🎯 客户比较

客户端最适合易于安装功能
克劳德桌面一般人工智能协助⭐⭐⭐⭐⭐全面对话,工具调用
光标IDE代码开发⭐⭐⭐⭐代码上下文,API集成
Continue.devVS代码开发⭐⭐⭐⭐内联代码辅助
MCP检查员测试/调试⭐⭐⭐可视化界面,调试
Python客户端自定义应用程序⭐⭐完全程序化控制
Web客户端浏览器应用程序⭐⭐基于Web的AI应用程序

🚀 快速入门示例

示例1:使用Claude Desktop进行电子商务

// config/tools.json
[
  {
    "name": "get_products",
    "description": "Get all products from our store",
    "method": "GET",
    "url": "https://api.mystore.com/products",
    "preMiddleware": ["addAuthHeader", "logRequest"]
  }
]

克劳德对话:

You: "Show me all products in our store"
Claude: I'll get the products for you using the get_products tool.
[Claude calls get_products tool]
Claude: Here are all the products in your store: [product list]

示例2:CRM与Cursor的集成

// config/tools.json
[
  {
    "name": "create_lead",
    "description": "Create a new sales lead",
    "method": "POST",
    "url": "https://crm.company.com/leads",
    "headers": {
      "Authorization": "Bearer ${ENV:CRM_TOKEN}",
      "Content-Type": "application/json"
    },
    "preMiddleware": ["logRequest"],
    "postMiddleware": ["validateResponse"]
  }
]

光标聊天:

You: "Create a lead for John Doe, email john@example.com, interested in our premium plan"
Cursor: I'll create that lead for you using the CRM API.
[Cursor calls create_lead tool with the provided information]

🔍 故障排除

常见问题

  1. 工具未出现:检查MCP服务器是否正在运行以及配置是否有效
  2. 身份验证错误:验证是否设置了环境变量
  3. 连接问题:确保MCP配置中的路径是绝对的
  4. 中间件错误:检查中间件函数名称是否与导出匹配

调试模式

# Run with debug logging
DEBUG=* node dist/cli.cjs serve -c ./config

健康检查

# Test MCP server manually
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | node dist/cli.cjs serve -c ./config

💡 示例工作流

电子商务API

[
  {
    "name": "list_products",
    "description": "Get all products",
    "method": "GET",
    "url": "https://api.shop.com/products"
  },
  {
    "name": "create_order", 
    "description": "Create a new order",
    "method": "POST",
    "url": "https://api.shop.com/orders",
    "preMiddleware": ["addAuthHeader", "logRequest"]
  },
  {
    "name": "update_inventory",
    "description": "Update product inventory",
    "method": "PUT", 
    "url": "https://api.shop.com/inventory",
    "preMiddleware": ["addAuthHeader"]
  }
]

CRM集成

[
  {
    "name": "get_contacts",
    "description": "Retrieve all contacts",
    "method": "GET", 
    "url": "https://crm.example.com/contacts",
    "headers": {
      "Authorization": "Bearer ${ENV:CRM_TOKEN}"
    },
    "preMiddleware": ["logRequest"],
    "postMiddleware": ["validateResponse"]
  },
  {
    "name": "create_lead",
    "description": "Create a new sales lead", 
    "method": "POST",
    "url": "https://crm.example.com/leads",
    "headers": {
      "Authorization": "Bearer ${ENV:CRM_TOKEN}",
      "Content-Type": "application/json"
    }
  }
]

🧪 测试

# Run tests
npm test

# Run tests in watch mode
npm run test:watch

# Type checking
npm run typecheck

# Linting
npm run lint

📦 发展

# Watch mode for development
npm run dev

# Build for production
npm run build

# Format code
npm run format

🤝 贡献

  1. 分叉存储库
  2. 创建要素分支: git checkout -b feature/amazing-feature
  3. 提交更改: git commit -m 'Add amazing feature'
  4. 推送到分支: git push origin feature/amazing-feature
  5. 打开拉取请求

📄 许可证

此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。

🙏 致谢

  • 为MCP(模型上下文协议)生态系统构建
  • 灵感来自对无缝LLM-API集成的需求
  • 感谢开源社区提供的工具和库

______________________________________________________________________

由以下材料制成❤️ 对于AI社区

目录标签

目录标签

API网关TypeScriptClaude本地部署LLM集成零代码配置MCP协议中间件系统

支持客户端

Claude DesktopClaudeCursorVS Code

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

api-key

运行时(runtime,运行环境)

Node.js

来源包(packageName,安装包名)

chuna-ai

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdioapi-key部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP