MCP-Server-Template

by SteffenHebestreit

226 downloads
Not rated
GitHub

About

This repository implements a Model Context Protocol (MCP) server for web crawling capabilities, exposing crawlers as LangChain-compatible tools or any MCP-compliant client. It includes two main services:

Details

Author
SteffenHebestreit
Downloads
226
Categories
Developer Tools

- Unified server architecture integrating Express and MCP
- Centralized configuration with module-specific settings
- Two MCP transports: Streamable HTTP and SSE
- Web crawling tools: crawl and crawlWithMarkdown
- Docker support for containerized deployment

Use Docker with docker-compose up --build, or run locally by installing dependencies (npm install), defining environment variables, building (npm run build), and starting (npm start). The server provides MCP Streamable HTTP at /mcp/v2 (recommended), legacy SSE at /mcp/sse, and API endpoints at /api/health and /api/version.

MCP-Server-Template

This repository implements a Model Context Protocol (MCP) server for web crawling capabilities, exposing crawlers as tools for any MCP-compliant client. It features a unified server architecture with centralized configuration.

Documentation
-------------
- OVERVIEW.md: High-level architecture and conceptual overview.
- CODE_STRUCTURE.md: Detailed explanation of each source file and its purpose.
- MCP_API.md: Detailed API endpoint specifications, JSON-RPC methods, request/response schemas, examples, and sequence diagrams.

Folder Structure
----------------

.
├── .env # Environment variables configuration file
├── .env-template # Template for environment variables
├── .github/ # GitHub-specific files (workflows, templates)
├── .gitignore # Git ignore configuration
├── CODE_STRUCTURE.md # Detailed code structure documentation
├── CONTRIBUTING.md # Contribution guidelines
├── LICENSE.md # MIT License file
├── MCP_API.md # API specifications document
├── OVERVIEW.md # System overview document
├── README.md # Project overview and quick start (this file)
├── docker-compose.yml # Defines multi-container environment
├── package.json # Root package with workspace configuration

└── mcp-service/ # MCP server implementation
├── Dockerfile # Docker configuration for MCP server
├── package.json # Package configuration
├── tsconfig.json # TypeScript configuration
├── tsconfig.node.json # TypeScript Node.js-specific configuration
└── src/
├── index.ts # Entry point for MCP server
├── config/ # Centralized configuration
│ ├── index.ts # Main configuration entry point
│ ├── appConfig.ts # Application settings
│ ├── mcpConfig.ts # MCP-specific settings
│ ├── securityConfig.ts # Security-related settings
│ ├── crawlConfig.ts # Web crawling settings
│ └── utils.ts # Configuration utility functions
├── controllers/ # API endpoint controllers
│ ├── resourceController.ts
│ └── toolController.ts
├── mcp/ # MCP protocol implementation
│ └── SimpleMcpServer.ts
├── routes/ # Route definitions
│ ├── apiRoutes.ts # General API endpoints
│ ├── mcpRoutes.ts # MCP-specific endpoints (SSE)
│ └── mcpStreamableRoutes.ts # MCP endpoints with Streamable HTTP
├── server/ # Unified server implementation
│ └── server.ts # Express and MCP server integration
├── services/ # Business logic services
│ └── crawlExecutionService.ts # Web crawling service
└── types/ # TypeScript type definitions
├── mcp.ts # MCP type definitions
├── modelcontextprotocol.d.ts # MCP SDK type declarations
└── module.d.ts # Module declarations for external libraries

Quick Start
-----------

Using Docker

docker-compose up --build

Running Locally

1. Install dependencies:

   npm install

2. Define environment variables (see Configuration).
3. Start the server:
   npm run build
npm start

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.