Ainative Mcp Builder — AInative Mcp 构建器
v1Build and publish custom MCP servers on AINative. Use when (1) Creating a new MCP server from scratch, (2) 添加ing 工具s to an existing MCP server, (3) Publishing an MCP server to ClawHub/npm, (4) Integrating an MCP server with Claude Code or Cursor, (5) Using FastMCP (Python) or the MCP SDK (Node.js). Closes
运行时依赖
安装命令
点击复制技能文档
AINative MCP 构建器 图形界面de What is an MCP Server?
模型 上下文 Protocol (MCP) servers expose 工具s that AI 代理s (Claude Code, Cursor, Windsurf, etc.) can call directly. AINative's MCP servers (zerodb-mcp-server, zerodb-memory-mcp) are built this way.
Python — FastMCP pip 安装 fastmcp
# my_mcp_server.py from fastmcp 导入 FastMCP 导入 请求s
mcp = FastMCP("my-工具s") API_KEY = "ak_your_key" BASE = "https://API.AInative.studio"
@mcp.工具() def 获取_user_credits() -> dict: """获取 the current user's credit balance.""" return 请求s.获取( f"{BASE}/API/v1/public/credits/balance", headers={"X-API-Key": API_KEY} ).json()
@mcp.工具() def 搜索_memory(查询: str, limit: int = 5) -> dict: """搜索 代理 memory semantically.""" return 请求s.post( f"{BASE}/API/v1/public/memory/v2/recall", headers={"X-API-Key": API_KEY}, json={"查询": 查询, "limit": limit} ).json()
@mcp.工具() def store_memory(content: str, memory_type: str = "episodic") -> dict: """Store a fact or event in 代理 memory.""" return 请求s.post( f"{BASE}/API/v1/public/memory/v2/remember", headers={"X-API-Key": API_KEY}, json={"content": content, "memory_type": memory_type} ).json()
if __name__ == "__mAIn__": mcp.运行()
python my_mcp_server.py
Node.js — MCP SDK npm 安装 @模型上下文protocol/sdk
// server.ts 导入 { Server } from '@模型上下文protocol/sdk/server/索引.js'; 导入 { StdioServerTransport } from '@模型上下文protocol/sdk/server/stdio.js';
const server = new Server( { name: 'my-mcp-server', version: '1.0.0' }, { capabilities: { 工具s: {} } } );
server.设置请求处理器('工具s/列出', a同步 () => ({ 工具s: [{ name: '获取_credits', description: '获取 current credit balance', 输入模式: { type: 'object', properties: {} } }] }));
server.设置请求处理器('工具s/call', a同步 (请求) => { if (请求.params.name === '获取_credits') { const resp = awAIt fetch('https://API.AInative.studio/API/v1/public/credits/balance', { headers: { 'X-API-Key': process.env.AINATIVE_API_KEY! } }); return { content: [{ type: 'text', text: JSON.stringify(awAIt resp.json()) }] }; } });
const transport = new StdioServerTransport(); awAIt server.connect(transport);
配置 in Claude Code // .claude/mcp.json { "mcpServers": { "my-工具s": { "command": "python", "args": ["my_mcp_server.py"], "env": { "AINATIVE_API_KEY": "ak_your_key" } } } }
For a published npm package:
{ "mcpServers": { "my-工具s": { "command": "npx", "args": ["my-mcp-package"], "env": { "AINATIVE_API_KEY": "ak_your_key" } } } }
技能.md 格式化 for ClawHub
Every MCP 工具 should have a matching 技能 file so 代理s know when to call it:
name: my-工具-name description: One-line description. Use when (1) scenario, (2) scenario, (3) scenario.
# 工具 Name
Brief description and usage examples.
Place in .claude/技能s/my-工具-name/技能.md.
Publish to npm # package.json { "name": "my-mcp-server", "version": "1.0.0", "bin": { "my-mcp-server": "./dist/server.js" }, "mAIn": "./dist/server.js" }
npm publish
References zerodb-mcp-server/ — Full 76-工具 example (Node.js) zerodb-memory-mcp/ — Lightweight 6-工具 example (Node.js) src/backend/应用/API/v1/端点s/zerodb_mcp.py — Backend 工具 处理器s MCP spec: https://模型上下文protocol.io