Skip to main content
Glama

API 测试器 MCP 服务器

这是一个模型上下文协议 (MCP) 服务器,允许 Claude 代表您发出 API 请求。它提供了用于测试各种 API 的工具,包括与 OpenAI API 的专用集成。

特征

  • 向任何 API 发出 HTTP 请求(GET、POST、PUT、DELETE)

  • 无需在聊天中分享 API 密钥即可测试 OpenAI 的 GPT 模型

  • 使用 DALL-E 生成图像

  • 格式正确,方便阅读的回复

Related MCP server: Contentful MCP Server

设置

先决条件

  • Python 3.10 或更高版本

  • MCP SDK 1.2.0 或更高版本

安装

  1. 安装所需的依赖项:

pip install "mcp[cli]" httpx python-dotenv
  1. 使用以下方法之一设置您的 OpenAI API 密钥:

选项 1:环境变量

# On Windows (PowerShell) $env:OPENAI_API_KEY = "your-api-key" # On Windows (Command Prompt) set OPENAI_API_KEY=your-api-key # On macOS/Linux export OPENAI_API_KEY="your-api-key"

选项 2:使用 .env 文件(推荐)

在项目目录中创建一个.env文件(从.env.example复制):

OPENAI_API_KEY=your_openai_api_key_here

运行服务器

python main.py

与 Claude 一起使用

一旦您的服务器运行,您就可以通过在 Claude Desktop 配置文件中进行配置将其连接到 Claude for Desktop。

示例提示

常规 API 测试

Use the get_request tool to fetch data from https://jsonplaceholder.typicode.com/posts/1
Use the post_request tool to send data to https://jsonplaceholder.typicode.com/posts with this JSON body: {"title": "Test Post", "body": "This is a test", "userId": 1}

使用 OpenAI 工具

Use the openai_chat_completion tool with: prompt: "Write a short poem about artificial intelligence" system_message: "You are a helpful assistant that writes creative poetry" model: "gpt-4"
Use the openai_image_generation tool with: prompt: "A futuristic city with flying cars and tall glass buildings at sunset" size: "1024x1024"

可用工具

通用 API 工具

  • get_request :向任何 URL 发出 GET 请求

  • post_request :使用 JSON 主体发出 POST 请求

  • put_request :使用 JSON 主体发出 PUT 请求

  • delete_request :发出 DELETE 请求

OpenAI 专用工具

  • openai_chat_completion :使用 OpenAI 的聊天模型生成文本

  • openai_image_generation :使用 DALL-E 生成图像

安全说明

  • 您的 OpenAI API 密钥存储在服务器中,不会在聊天中暴露

  • API 使用将计入您的 OpenAI 配额,并可能产生费用

  • 对于生产用途,请始终将 API 密钥设置为环境变量或使用.env文件

  • .env文件包含在.gitignore中,以防止意外提交您的 API 密钥

-
security - not tested
F
license - not found
-
quality - not tested

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Vikrant-Khedkar/api-tester-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server