MCP Server
Complete guide for the HTTP-based MCP (Model Context Protocol) server integrated into the datablocks Next.js application.
Overview
The datablocks MCP server is now hosted directly through the Next.js application, making it accessible via HTTP endpoints. This eliminates the need for separate processes and makes integration easier.
Key Benefits
- ✓No separate process - Runs as part of your Next.js app
- ✓HTTP-based - Standard REST API endpoints
- ✓Always available - Accessible whenever your app is running
- ✓Easy integration - Works with any HTTP client
- ✓Publicly accessible - Can be used by external tools and services
Architecture
┌─────────────────────────────────────────┐ │ Next.js Application │ │ │ │ ┌───────────────────────────────────┐ │ │ │ MCP HTTP Endpoints │ │ │ │ │ │ │ │ GET /api/mcp │ │ │ │ GET /api/mcp/tools │ │ │ │ POST /api/mcp/execute │ │ │ │ GET /api/mcp/resources │ │ │ │ GET /api/mcp/prompts │ │ │ └───────────────────────────────────┘ │ │ ↓ │ │ ┌───────────────────────────────────┐ │ │ │ MCP Handlers (lib/) │ │ │ └───────────────────────────────────┘ │ │ ↓ │ │ ┌───────────────────────────────────┐ │ │ │ Prisma Database Access │ │ │ └───────────────────────────────────┘ │ └─────────────────────────────────────────┘
Available Endpoints
GET /api/mcp
Get server information and capabilities
GET /api/mcp/tools
List all available tools
POST /api/mcp/execute
Execute a tool with parameters
GET /api/mcp/resources
List all available resources
GET /api/mcp/prompts
List all available prompts