返回顶部
a

ainative-mcp-builder

Build and publish custom MCP servers on AINative. Use when (1) Creating a new MCP server from scratch, (2) Adding tools 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 #1523.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
79
下载量
0
收藏
概述
安装方式
版本历史

ainative-mcp-builder

# AINative MCP Builder Guide ## What is an MCP Server? Model Context Protocol (MCP) servers expose tools that AI agents (Claude Code, Cursor, Windsurf, etc.) can call directly. AINative's MCP servers (zerodb-mcp-server, zerodb-memory-mcp) are built this way. ## Python — FastMCP ```bash pip install fastmcp ``` ```python # my_mcp_server.py from fastmcp import FastMCP import requests mcp = FastMCP("my-tools") API_KEY = "ak_your_key" BASE = "https://api.ainative.studio" @mcp.tool() def get_user_credits() -> dict: """Get the current user's credit balance.""" return requests.get( f"{BASE}/api/v1/public/credits/balance", headers={"X-API-Key": API_KEY} ).json() @mcp.tool() def search_memory(query: str, limit: int = 5) -> dict: """Search agent memory semantically.""" return requests.post( f"{BASE}/api/v1/public/memory/v2/recall", headers={"X-API-Key": API_KEY}, json={"query": query, "limit": limit} ).json() @mcp.tool() def store_memory(content: str, memory_type: str = "episodic") -> dict: """Store a fact or event in agent memory.""" return requests.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.run() ``` ```bash python my_mcp_server.py ``` ## Node.js — MCP SDK ```bash npm install @modelcontextprotocol/sdk ``` ```typescript // server.ts import { Server } from '@modelcontextprotocol/sdk/server/index.js'; import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'; const server = new Server( { name: 'my-mcp-server', version: '1.0.0' }, { capabilities: { tools: {} } } ); server.setRequestHandler('tools/list', async () => ({ tools: [{ name: 'get_credits', description: 'Get current credit balance', inputSchema: { type: 'object', properties: {} } }] })); server.setRequestHandler('tools/call', async (request) => { if (request.params.name === 'get_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); ``` ## Configure in Claude Code ```json // .claude/mcp.json { "mcpServers": { "my-tools": { "command": "python", "args": ["my_mcp_server.py"], "env": { "AINATIVE_API_KEY": "ak_your_key" } } } } ``` For a published npm package: ```json { "mcpServers": { "my-tools": { "command": "npx", "args": ["my-mcp-package"], "env": { "AINATIVE_API_KEY": "ak_your_key" } } } } ``` ## SKILL.md Format for ClawHub Every MCP tool should have a matching skill file so agents know when to call it: ```markdown --- name: my-tool-name description: One-line description. Use when (1) scenario, (2) scenario, (3) scenario. --- # Tool Name Brief description and usage examples. ``` Place in `.claude/skills/my-tool-name/SKILL.md`. ## Publish to npm ```bash # 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-tool example (Node.js) - `zerodb-memory-mcp/` — Lightweight 6-tool example (Node.js) - `src/backend/app/api/v1/endpoints/zerodb_mcp.py` — Backend tool handlers - MCP spec: `https://modelcontextprotocol.io`

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 ainative-mcp-builder-1776064681 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 ainative-mcp-builder-1776064681 技能

通过命令行安装

skillhub install ainative-mcp-builder-1776064681

下载 Zip 包

⬇ 下载 ainative-mcp-builder v1.0.0

文件大小: 2.32 KB | 发布时间: 2026-4-14 10:45

v1.0.0 最新 2026-4-14 10:45
AINative MCP Builder 1.0.0 – Initial Release

- Introduces a skill for building and publishing custom MCP servers on AINative.
- Provides step-by-step guides for both Python (FastMCP) and Node.js (MCP SDK).
- Details tool creation, server setup, and MCP integration with Claude Code.
- Explains SKILL.md formatting for ClawHub compatibility.
- Includes instructions for publishing MCP servers to npm.
- Reference resources and example MCP servers are provided.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部