Provides access to file resources including project information, sample JSON data, and system status through the 'file://' URI scheme.
Built with JavaScript, the server demonstrates tools for performing calculations, fetching weather data, and generating UUIDs.
Requires Node.js 18+ to run the MCP server, which provides access to tools, resources, and prompt templates.
Uses Yarn package manager for dependency management and provides scripts for running the server in standard and development modes.
MCP Learning Server
A comprehensive educational Model Context Protocol (MCP) server built with JavaScript that demonstrates all three main MCP capabilities: Tools, Resources, and Prompts.
🎯 What is MCP?
Model Context Protocol (MCP) is a protocol that allows AI assistants to connect to external data sources and tools. It provides three main capabilities:
1. 🔧 Tools
Functions that the AI can call to perform actions:
- API calls
- Calculations
- Data manipulation
- External system interactions
2. 📚 Resources
Data sources that the AI can read from:
- Files and documents
- Database content
- Web pages
- System information
3. 📝 Prompts
Template prompts with variables:
- Reusable prompt templates
- Customizable with parameters
- Consistent AI interactions
🚀 Getting Started
Prerequisites
- Node.js 18+
- Yarn package manager
Installation
🛠️ Features Demonstrated
Tools Available:
calculate
- Perform mathematical calculationsget_weather
- Get weather information (mock data)generate_uuid
- Generate unique identifiers
Resources Available:
file://project-info
- Information about this projectfile://sample-data
- Sample JSON datafile://system-status
- System status and statistics
Prompts Available:
code-review
- Generate code reviewsexplain-concept
- Explain technical conceptsproject-documentation
- Generate project documentation
📖 Step-by-Step Learning Guide
Step 1: Understanding the Basic Structure
The MCP server is built using the @modelcontextprotocol/sdk
package:
Step 2: Server Initialization
Step 3: Implementing Tools
Tools are functions the AI can call. Each tool needs:
- A name and description
- An input schema (JSON Schema)
- A handler function
Step 4: Implementing Resources
Resources provide data that the AI can read:
Step 5: Implementing Prompts
Prompts are reusable templates with variables:
🧪 Testing Your Server
Manual Testing
You can test the server by running it and sending MCP protocol messages via stdin/stdout:
Using with MCP Clients
MCP servers typically run as stdio processes that communicate with AI assistants or other MCP clients through JSON-RPC messages.
🔍 Key Learning Points
- Protocol Structure: MCP uses JSON-RPC 2.0 over stdio
- Capability Declaration: Servers declare what they can do (tools, resources, prompts)
- Schema Validation: All inputs use JSON Schema for validation
- Error Handling: Proper error codes and messages are crucial
- Transport Layer: StdioServerTransport handles communication
🛡️ Error Handling
The server includes comprehensive error handling:
📚 Next Steps
- Extend Tools: Add more sophisticated tools that call real APIs
- Dynamic Resources: Connect to databases or file systems
- Advanced Prompts: Create more complex prompt templates
- Authentication: Add security for production use
- Logging: Implement comprehensive logging
- Testing: Add unit and integration tests
🔗 Resources
📄 License
MIT License - feel free to use this code for learning and building your own MCP servers!
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
A comprehensive educational server demonstrating Model Context Protocol capabilities for tools, resources, and prompts, allowing AI assistants to connect to external data and functionality.
Related MCP Servers
- -securityFlicense-qualityA comprehensive Model Context Protocol server implementation that enables AI assistants to interact with file systems, databases, GitHub repositories, web resources, and system tools while maintaining security and control.Last updated -61TypeScript
- -securityFlicense-qualityA Model Context Protocol server that provides AI models with structured access to external data and services, acting as a bridge between AI assistants and applications, databases, and APIs in a standardized, secure way.Last updated -1Python
- -securityAlicense-qualityA comprehensive Model Context Protocol server providing educational resources and curriculum planning support with intelligent filtering across multiple educational APIs.Last updated -PythonMIT License
- -securityAlicense-qualityA server that provides organized documentation content for various applications using the Model Context Protocol, enabling AI assistants to access quickstart guides and code examples.Last updated -PythonMIT License