Skip to main content

Add your description here

Project description

API Tester MCP Server

This is a Model Context Protocol (MCP) server that allows Claude to make API requests on your behalf. It provides tools for testing various APIs, including a dedicated integration with OpenAI's APIs.

Features

  • Make HTTP requests (GET, POST, PUT, DELETE) to any API
  • Test OpenAI's GPT models without sharing your API key in the chat
  • Generate images with DALL-E
  • Properly formatted responses for easy reading

Setup

Prerequisites

  • Python 3.10 or higher
  • MCP SDK 1.2.0 or higher

Installation

  1. Install the required dependencies:
pip install "mcp[cli]" httpx python-dotenv
  1. Set your OpenAI API key using one of these methods:

Option 1: Environment Variables

# 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"

Option 2: Using a .env File (Recommended)

Create a .env file in the project directory (copy from .env.example):

OPENAI_API_KEY=your_openai_api_key_here

Running the Server

python main.py

Using with Claude

Once your server is running, you can connect it to Claude for Desktop by configuring it in the Claude Desktop config file.

Example Prompts

General API Testing

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}

Using OpenAI Tools

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"

Available Tools

General API Tools

  • get_request: Make GET requests to any URL
  • post_request: Make POST requests with JSON bodies
  • put_request: Make PUT requests with JSON bodies
  • delete_request: Make DELETE requests

OpenAI-Specific Tools

  • openai_chat_completion: Generate text using OpenAI's chat models
  • openai_image_generation: Generate images using DALL-E

Security Notes

  • Your OpenAI API key is stored in the server and not exposed in the chat
  • API usage will count against your OpenAI quota and may incur charges
  • For production use, always set the API key as an environment variable or use a .env file
  • The .env file is included in .gitignore to prevent accidentally committing your API key

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mseep_api_tester-0.1.1.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mseep_api_tester-0.1.1-py3-none-any.whl (2.5 kB view details)

Uploaded Python 3

File details

Details for the file mseep_api_tester-0.1.1.tar.gz.

File metadata

  • Download URL: mseep_api_tester-0.1.1.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.12

File hashes

Hashes for mseep_api_tester-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7542a7c2ceb52cff38b5763fed40f43a00c2ab9c9246cdd5b059aeb7079ed16c
MD5 e12d0006a9abcf00f1c313ea73c0237d
BLAKE2b-256 a88a9bd92bde3ae2478a23697039decd344ece963a78c66ae97b96c5c232a3e0

See more details on using hashes here.

File details

Details for the file mseep_api_tester-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for mseep_api_tester-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a801b32f81ca8e6e4e50ef335dfe065f8a8a3c0394ae630e4f41661f2709b55a
MD5 01925692d0085d100d5af22b9f792511
BLAKE2b-256 f11579712810d88fb1764d0d23312ceaa7bef14a1ba6ce2f9a20eb2240b5057d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page