reddit-cli/TESTING.md

1.5 KiB

MCP Server Testing

The MCP server is now running at http://home.ms:5000. Here are the curl commands to test all endpoints:

1. Health Check

curl -X GET http://home.ms:5000/health

2. Search Posts

curl -X GET "http://home.ms:5000/search?q=python&limit=5"

3. Get Post Details

curl -X GET http://home.ms:5000/posts/xyz123

4. Get Post Comments

curl -X GET "http://home.ms:5000/posts/xyz123/comments?limit=10"

5. Get AI Summary

curl -X GET http://home.ms:5000/posts/xyz123/summary
curl -X GET "http://home.ms:5000/trending?limit=5"

7. OpenAPI Specification

curl -X GET http://home.ms:5000/openapi.json

Example Response Format

Search Response:

{
  "posts": [
    {
      "id": "xyz123",
      "title": "Example Post Title",
      "subreddit": "example",
      "created_utc": 1634567890,
      "url": "http://reddit.com/r/example/comments/xyz123",
      "body": "Post content here...",
      "score": 123
    }
  ],
  "after": "next_token",
  "query": "python",
  "limit": 5
}

AI Summary Response:

{
  "post_id": "xyz123",
  "summary": "AI-generated summary of the post and comments...",
  "post_title": "Example Post Title",
  "subreddit": "example"
}

Authentication

All AI-related endpoints require the API key in the Authorization header:

curl -X GET http://home.ms:5000/posts/xyz123/summary \
  -H "Authorization: Bearer 111"