API Documentation

prompts.example.vn provides an MCP-first API for searching and discovering AI prompts programmatically. Use the MCP endpoint directly with any MCP-compatible client, or make standard HTTP requests.

MCP-First API

Our API is built on the Model Context Protocol (MCP), enabling seamless integration with AI assistants, IDEs, and automation tools. The same endpoint works for both MCP clients and traditional REST-style requests.

# MCP Endpoint

POST https://prompts.example.vn/api/mcp

Using with MCP Clients

Add prompts.example.vn to your MCP client configuration:

{
  "mcpServers": {
    "prompts-chat": {
      "url": "https://prompts.example.vn/api/mcp"
    }
  }
}

Compatible with Claude Desktop, Cursor, Windsurf, and other MCP-enabled tools.

MCP Prompts

All public prompts are exposed as native MCP prompts. This allows MCP clients to list and use prompts directly via slash commands or prompt pickers. You can filter prompts by category or tag using URL query parameters.

# Filter by users (one or more usernames)
"prompts-chat": {
  "url": "https://prompts.example.vn/api/mcp?users=f,torvalds"
}

# Filter by categories
"prompts-chat": {
  "url": "https://prompts.example.vn/api/mcp?categories=coding,marketing"
}

# Filter by tags
"prompts-chat": {
  "url": "https://prompts.example.vn/api/mcp?tags=chatgpt,writing"
}

# Combine filters
"prompts-chat": {
  "url": "https://prompts.example.vn/api/mcp?users=f&categories=coding&tags=js"
}

prompts/list

Browse all available prompts with pagination support.

prompts/get

Retrieve a prompt by ID. Variables (${name} or ${name:default}) are automatically substituted with provided arguments.

# List prompts
curl -X POST https://prompts.example.vn/api/mcp \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc": "2.0", "id": 1, "method": "prompts/list"}'

# Get a specific prompt with arguments
curl -X POST https://prompts.example.vn/api/mcp \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{
    "jsonrpc": "2.0",
    "id": 2,
    "method": "prompts/get",
    "params": {
      "name": "code-review-assistant",
      "arguments": { "topic": "AI safety" }
    }
  }'

Available Tools

search_prompts

Search for AI prompts by keyword. Returns matching prompts with title, description, content, author, category, and tags.

ParameterTypeRequiredDescription
querystringYesSearch query to find relevant prompts
limitnumberNoMaximum results (default: 10, max: 50)
typestringNoFilter by type: TEXT, STRUCTURED, IMAGE, VIDEO, AUDIO
categorystringNoFilter by category slug
tagstringNoFilter by tag slug

get_prompt

Get a prompt by ID. If the prompt contains template variables (like ${variable} or ${variable:default}), the MCP client will be asked to provide values through elicitation.

ParameterTypeRequiredDescription
idstringYesThe ID of the prompt to retrieve

Variable Elicitation

When a prompt contains variables like ${name} or ${topic:default value}, MCP clients that support elicitation will prompt the user to fill in these values. Variables with default values (after the colon) are optional. The prompt content will be returned with variables replaced.

MCP Protocol Examples

Initialize Connection

curl -X POST https://prompts.example.vn/api/mcp \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "initialize",
    "params": {
      "protocolVersion": "2024-11-05",
      "capabilities": {},
      "clientInfo": { "name": "my-app", "version": "1.0.0" }
    }
  }'

List Available Tools

curl -X POST https://prompts.example.vn/api/mcp \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{
    "jsonrpc": "2.0",
    "id": 2,
    "method": "tools/list"
  }'

Search Prompts

curl -X POST https://prompts.example.vn/api/mcp \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{
    "jsonrpc": "2.0",
    "id": 3,
    "method": "tools/call",
    "params": {
      "name": "search_prompts",
      "arguments": {
        "query": "code review",
        "limit": 5
      }
    }
  }'

Response Format

The search_prompts tool returns results in the following format:

{
  "query": "code review",
  "count": 2,
  "prompts": [
    {
      "id": "abc123",
      "title": "Code Review Assistant",
      "description": "A prompt for conducting thorough code reviews",
      "content": "You are an expert code reviewer...",
      "type": "TEXT",
      "author": "username",
      "category": "Development",
      "tags": ["coding", "review", "development"],
      "votes": 42,
      "createdAt": "2024-01-15T10:30:00.000Z"
    }
  ]
}

REST API Alternative

For simpler integrations, you can also use the standard REST endpoint:

# Search prompts via REST
curl "https://prompts.example.vn/api/prompts?q=code+review&perPage=10"

# Get prompt by ID
curl "https://prompts.example.vn/api/prompts/{id}"

Server Information

Get MCP server information and available tools:

GET https://prompts.example.vn/api/mcp

Rate Limits

The API is public and free to use. Please be respectful with request frequency. For high-volume usage, consider self-hosting your own instance.

Support

For issues and feature requests, please open a GitHub Issue.