mcp-server-blog

portal-labs-infrastructure/mcp-server-blog

3.3

If you are the rightful owner of mcp-server-blog 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 repository provides a demonstration of a Model Context Protocol (MCP) server using TypeScript, OAuth 2.0, and Firestore.

The MCP Server Demo is a stripped-down implementation designed to showcase the architectural patterns and security considerations involved in building a Model Context Protocol server. It focuses on the MCP Resource Server component, which is responsible for handling requests from clients and validating OAuth 2.0 Bearer tokens issued by a separate Authorization Server. The demo illustrates how to integrate OAuth 2.0 for securing tool calls, manage workspace context, and implement multi-tenancy. It also provides examples of using Zod for schema definition and validation, and demonstrates how to structure tools using Higher-Order Components (HOCs) for common logic. The server interacts with Google Firestore for data storage and retrieval, and is built with TypeScript for type-safe development. This demo is intended as a learning resource and is not a production-ready solution.

Features

  • MCP TypeScript SDK Integration: Core server setup and tool registration.
  • OAuth 2.0 Token Validation: Securely handling Bearer tokens via SDK middleware.
  • Workspace Context Management: Using HOCs for authentication and workspace authorization.
  • Firestore Integration: Fetching user data and tool-specific data using Firestore.
  • Zod for Schemas & Validation: Defining input schemas and runtime validation.

Usages

usage with Node.js

bash
git clone https://github.com/portal-labs-infrastructure/mcp-server-blog
cd mcp-server-blog
npm install
# or
yarn install

usage with Environment Variables

bash
cp .env.example .env
# Edit .env and fill in the required configuration values

usage with Development Mode

bash
npm run dev

usage with Production Mode

bash
npm run build
npm start

usage with Firestore Emulator

bash
gcloud emulators firestore start --host-port=localhost:8081