Token导航 LogoToken导航TokenDH.com
Pocha MCP Server logo
开发工具HTTP官方级别未说明来源级核验

Pocha MCP Server

MCP Server

Pocha MCP Server是一个用于自动生成类型安全的TypeScript API函数模板的工具,支持多种HTTP方法和认证处理。

工具数

1

提示词数

0

GitHub Stars

0

资源数

0
开发工具TypeScriptCursor类型安全Cursor

安装说明

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

作者 / 组织

retz8

提供方

retz8

最后核验

2026/5/17 20:21

快速接入

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

详细介绍

Pocha MCP服务器

模型上下文协议(MCP)服务器,为Pocha项目生成TypeScript API函数。该服务器提供了一个工具,用于按照一致的模式自动生成类型安全的API函数模板。

特性

  • 生成具有正确类型的TypeScript API函数
  • 支持GET、POST、PUT、DELETE HTTP方法
  • 包括身份验证令牌处理
  • 生成正确的错误处理和响应类型
  • 支持可选参数和返回类型

安装

# Clone the repository
git clone https://github.com/jiohjung98/pocha-mcp-server.git

# Install dependencies
pnpm install

# Build the project
pnpm build

用法

服务器提供了一个名为 generate-api-function 它接受以下参数:

{
  functionName: string;          // Name of the API function to generate
  route: string;                 // API route path (e.g., "/pocha/${pochaid}")
  method: "GET" | "POST" | "PUT" | "DELETE";  // HTTP method
  params?: {                     // Optional array of parameters
    name: string;               // Parameter name
    type: string;               // Parameter type
  }[];
  returnType: string;           // Return type of the API function
}

示例

要生成用于获取Pocha信息的API函数,请执行以下操作:

// Input parameters
{
  "functionName": "getPocha",
  "route": "/pocha/${pochaid}",
  "method": "GET",
  "params": [
    {
      "name": "pochaid",
      "type": "number"
    }
  ],
  "returnType": "PochaInfo"
}

// Generated output
/**
 * @desc getPocha
 * @route GET /pocha/${pochaid}
 */
export async function getPocha(pochaid: number, token: string): Promise
 {
  const url = `/pocha/${pochaid}`;
  try {
    const response = await client.get(url, {
      headers: {
        Authorization: `Bearer ${token}`,
      },
    });

    return response?.data;
  } catch (error) {
    console.log(error);
    throw new Error("Error in getPocha");
  }
}

发展

服务器是使用以下方式构建的:

  • TypeScript
  • MCP TypeScript SDK
  • Zod用于模式验证

开始开发:

# Install dependencies
pnpm install

# Build in watch mode
pnpm dev

项目结构

pocha-mcp-server/
├── src/
│   └── index.ts     # Main server implementation
├── dist/            # Compiled JavaScript
├── package.json
└── tsconfig.json

光标设置

要在Cursor IDE中使用此MCP服务器,请执行以下操作:

  1. 打开Cursor MCP配置文件:
   # macOS
   ~/.cursor/mcp.json

   # Windows
   %APPDATA%/cursor/mcp.json

   # Linux
   ~/.cursor/mcp.json
  1. 将以下配置添加到 mcpServers 对象:
   {
     "mcpServers": {
       "pocha-api-generator": {
         "command": "/opt/homebrew/bin/npx",
         "args": ["-y", "node", "/path/to/your/pocha-mcp-server/dist/index.js"]
       }
     }
   }

替换 /path/to/your/pocha-mcp-server 使用克隆此存储库的实际路径。

  1. 重新启动Cursor以使更改生效。
  1. MCP服务器现在可以在Cursor中使用,您可以使用它通过输入自然语言命令来生成API函数,如:
   Can you create a sample API for pocha project that fetches PochaInfo from "/pocha/${pochaid}" using "pocha-api-generator" mcp?

许可证

MIT许可证

目录标签

目录标签

开发工具TypeScriptCursor类型安全API生成本地部署HTTP方法

支持客户端

Cursor

接入字段

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

HTTP

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

token

工具数量(toolCount,工具数)

1

资源数量(resourceCount,资源数)

0

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

0

权限和风险

HTTPtoken部署方式未说明

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

安装前确认

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

仍需确认:installCommand

来源信息

继续浏览同类 MCP