MCP-Server-Template
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
- License
- MIT license
Explore
curl -X POST http://localhost:${PORT:-3000}/mcp/v2 \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "mcp.capabilities",
"params": {},
"id": 1
}'
1. Install dependencies:
npm install
2. Define environment variables (see Configuration).
3. Start the server:
npm run build
npm start
curl -X POST http://localhost:${PORT:-3000}/mcp/v2 \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "mcp.tool.use",
"params": {
"name": "crawl",
"parameters": { "url": "https://example.com", "maxPages": 1 }
},
"id": 2
}'
curl -X POST http://localhost:${PORT:-3000}/mcp/v2 \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "mcp.tool.use",
"params": {
"name": "crawlWithMarkdown",
"parameters": { "url": "https://example.com", "query": "What is this site about?" }
},
"id": 3
}'
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
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.



