Skip to main content
Glama

Readwise MCP HTTP Server

by CaseyRo
MCP-vs-REST.md3.61 kB
# MCP HTTP Server: The Correct Implementation ## The Question You Asked > "so is this as MCP 'HTTP Streamable' was intended? it looks like its just a REST API now?" **You were absolutely right to question this!** What I initially built was indeed just a REST API, not a true MCP HTTP server. ## What I Built First (REST API) ```typescript // REST API - Custom endpoints app.post('/api/search-highlights', async (req, res) => { const { vector_search_term, full_text_queries } = req.body; // Custom logic... res.json({ results: [...] }); }); ``` **Problems:** - ❌ Not MCP-compliant - ❌ Custom API design - ❌ Not interoperable with MCP clients - ❌ Doesn't follow MCP specification ## What MCP HTTP Should Actually Be ```typescript // MCP HTTP - JSON-RPC 2.0 over HTTP app.post('/mcp', async (req, res) => { const { jsonrpc, id, method, params } = req.body; if (method === 'tools/call') { const { name, arguments: args } = params; // Handle MCP tool calls... res.json({ jsonrpc: "2.0", id, result: { content: [...] } }); } }); ``` **Benefits:** - ✅ **True MCP protocol over HTTP** - ✅ JSON-RPC 2.0 compliant - ✅ Compatible with MCP clients - ✅ Follows MCP specification - ✅ **This is what "MCP HTTP Streamable" actually means** ## Key Features | Aspect | MCP HTTP | |--------|----------| | **Protocol** | JSON-RPC 2.0 | | **Request Format** | MCP standard format | | **Response Format** | MCP standard format | | **Tool Calling** | `tools/call` method | | **Initialization** | `initialize` method | | **Tool Discovery** | `tools/list` method | | **Client Compatibility** | Any MCP client | | **Streaming** | MCP streaming spec | | **Debugging** | Comprehensive logging | ## MCP HTTP Request Example ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search_readwise_highlights", "arguments": { "vector_search_term": "machine learning" } } } ``` ## MCP HTTP Response Example ```json { "jsonrpc": "2.0", "id": 1, "result": { "content": [ { "type": "text", "text": "[...search results...]" } ] } } ``` ## Why This Matters 1. **Interoperability**: MCP HTTP servers can work with any MCP client 2. **Standards Compliance**: Follows the official MCP specification 3. **Tool Discovery**: Clients can discover available tools automatically 4. **Error Handling**: Standardized error codes and formats 5. **Streaming**: Proper MCP streaming implementation 6. **Debugging**: Comprehensive logging for development and troubleshooting ## Network Connectivity The server binds to all network interfaces (`0.0.0.0`), making it accessible from: - **Localhost**: `http://localhost:3000` - **Local Network**: `http://YOUR_IP_ADDRESS:3000` - **Docker**: `http://host.docker.internal:3000` This allows other devices on your network to connect to the server. ## Debugging Features The server includes comprehensive debugging capabilities: - **Connection tracking**: Every incoming request with IP and user agent - **Request processing**: Step-by-step MCP request handling - **Tool execution**: Detailed tool call processing - **API interactions**: Readwise API calls and responses - **Streaming**: Real-time streaming progress - **Error details**: Full error stack traces and context ## Conclusion The **MCP HTTP Server** (`src/mcp-http-server.ts`) is the correct implementation for "MCP HTTP Streamable". It provides true MCP protocol over HTTP with comprehensive debugging capabilities. **This is the proper MCP HTTP implementation!** 🎯

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/CaseyRo/readwise-mcp-http-server'

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