aws-docs-mcp-server

Kenblair1226/aws-docs-mcp-server

3.2

If you are the rightful owner of aws-docs-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

This server is a port of the AWS Documentation MCP Server to run on Cloudflare Workers with HTTP streaming support.

Tools
  1. read_documentation

    Fetch and convert AWS documentation pages to markdown.

  2. search_documentation

    Search AWS documentation using the official search API.

  3. recommend

    Get content recommendations for AWS documentation pages.

AWS Documentation MCP Server - Cloudflare Workers

This is a port of the AWS Documentation MCP Server to run on Cloudflare Workers with HTTP streaming support.

Features

  • Standard MCP Protocol: Full JSON-RPC 2.0 implementation with proper MCP compliance
  • HTTP-based MCP Transport: REST API endpoints with MCP protocol support
  • Server-Sent Events (SSE): Streaming responses for real-time updates
  • Cloudflare Workers: Edge computing for low latency globally
  • TypeScript: Type-safe implementation with modern JavaScript features

Available Tools

  1. read_documentation - Fetch and convert AWS documentation pages to markdown
  2. search_documentation - Search AWS documentation using the official search API
  3. recommend - Get content recommendations for AWS documentation pages

API Endpoints

MCP Protocol Endpoints

  • POST /mcp - Standard MCP JSON-RPC endpoint (recommended)
  • GET /mcp/info - Server information and capabilities
  • GET /mcp/tools/list - List available tools
  • POST /mcp/tools/call - Execute tools (JSON request/response)
  • GET /sse/connect - SSE connection for streaming
  • POST /sse/tools/call - Execute tools with streaming response

Utility Endpoints

  • GET /health - Health check
  • GET / - API documentation

Setup

  1. Install dependencies:

    npm install
    
  2. Development:

    npm run dev
    
  3. Deploy to Cloudflare Workers:

    npm run deploy
    

Usage Examples

Using Standard MCP Protocol

Initialize MCP session:

curl -X POST https://your-worker.your-subdomain.workers.dev/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {}}'

List available tools:

curl -X POST https://your-worker.your-subdomain.workers.dev/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc": "2.0", "id": 2, "method": "tools/list", "params": {}}'

Execute a tool:

curl -X POST https://your-worker.your-subdomain.workers.dev/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc": "2.0", "id": 3, "method": "tools/call", "params": {"name": "read_documentation", "arguments": {"url": "https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html"}}}'

Using Legacy HTTP Endpoints

List available tools:

curl https://your-worker.your-subdomain.workers.dev/mcp/tools/list

Read documentation:

curl -X POST https://your-worker.your-subdomain.workers.dev/mcp/tools/call \
  -H "Content-Type: application/json" \
  -d '{"params": {"name": "read_documentation", "arguments": {"url": "https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html"}}}'

Search documentation:

curl -X POST https://your-worker.your-subdomain.workers.dev/mcp/tools/call \
  -H "Content-Type: application/json" \
  -d '{"params": {"name": "search_documentation", "arguments": {"search_phrase": "S3 bucket naming", "limit": 5}}}'

Get recommendations:

curl -X POST https://your-worker.your-subdomain.workers.dev/mcp/tools/call \
  -H "Content-Type: application/json" \
  -d '{"params": {"name": "recommend", "arguments": {"url": "https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html"}}}'

Using Server-Sent Events

Connect to streaming endpoint:

curl -N https://your-worker.your-subdomain.workers.dev/mcp/stream

Execute tool with streaming:

curl -X POST https://your-worker.your-subdomain.workers.dev/mcp/tools/stream \
  -H "Content-Type: application/json" \
  -d '{"params": {"name": "read_documentation", "arguments": {"url": "https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html"}}}' \
  -N

JavaScript/TypeScript Client

// Regular HTTP call
const response = await fetch('https://your-worker.your-subdomain.workers.dev/mcp/tools/call', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    params: {
      name: 'search_documentation',
      arguments: {
        search_phrase: 'Lambda functions',
        limit: 10
      }
    }
  })
});

const result = await response.json();

// Server-Sent Events
const eventSource = new EventSource('https://your-worker.your-subdomain.workers.dev/mcp/stream');

eventSource.addEventListener('connection', (event) => {
  console.log('Connected:', JSON.parse(event.data));
});

eventSource.addEventListener('result', (event) => {
  console.log('Result:', JSON.parse(event.data));
});

eventSource.addEventListener('error', (event) => {
  console.error('Error:', JSON.parse(event.data));
});

Configuration

Update wrangler.toml to configure:

[vars]
AWS_DOCUMENTATION_PARTITION = "aws"  # or "aws-cn" for China regions
FASTMCP_LOG_LEVEL = "ERROR"

Differences from Python Version

  1. Transport: HTTP instead of stdio
  2. Runtime: JavaScript/TypeScript instead of Python
  3. Streaming: Server-Sent Events instead of JSON-RPC
  4. Dependencies: Native Web APIs instead of Python libraries
  5. Deployment: Cloudflare Workers instead of local process

Performance Benefits

  • Edge Computing: Runs globally on Cloudflare's edge network
  • Low Latency: Reduced response times due to geographic distribution
  • Scalability: Auto-scaling with Cloudflare Workers platform
  • Caching: Built-in HTTP caching for documentation pages

Error Handling

The server returns standard HTTP status codes and JSON error responses:

{
  "error": {
    "code": -32601,
    "message": "Unknown tool: invalid_tool_name"
  }
}

Common error codes:

  • -32601: Method not found (unknown tool)
  • -32602: Invalid params
  • -32603: Internal error