FastMCP Demo
A demonstration TypeScript MCP server that showcases basic MCP concepts with simple tools (greeting, calculator), text resources, and prompt templates for learning the Model Context Protocol.
README
FastMCP Demo - TypeScript MCP Server
A demonstration project to understand the Model Context Protocol (MCP) using TypeScript. This project implements a basic MCP server with tools, resources, and prompts.
What is MCP?
The Model Context Protocol (MCP) is a standardized protocol that enables AI assistants to securely access external data sources and tools. It provides a way for AI models to:
- Tools: Execute functions and operations
- Resources: Access data and information
- Prompts: Use predefined prompt templates
Project Structure
fast-mcp/
├── src/
│ └── index.ts # Main MCP server implementation
├── dist/ # Compiled JavaScript (generated)
├── package.json # Project dependencies
├── tsconfig.json # TypeScript configuration
└── README.md # This file
Features
This demo server includes:
Tools
- hello: A simple greeting tool that welcomes users
- calculate: Performs basic arithmetic operations (add, subtract, multiply, divide)
Resources
- demo://example: A simple text resource
- demo://config: Server configuration in JSON format
Prompts
- greet_user: Generates a greeting message for a user
- explain_mcp: Provides an explanation of what MCP is
Setup
-
Install dependencies:
npm install -
Build the project:
npm run build -
Run the server:
npm startOr use the development mode with auto-reload:
npm run dev
How MCP Works
Server Initialization
The server is created with capabilities for tools, resources, and prompts:
const server = new Server(
{ name: "fast-mcp-demo", version: "0.1.0" },
{
capabilities: {
tools: {},
resources: {},
prompts: {},
},
}
);
Transport
This server uses stdio (standard input/output) transport, which means it communicates via stdin/stdout. This is the most common transport for MCP servers.
Request Handlers
Each capability requires request handlers:
ListToolsRequestSchema- Lists available toolsCallToolRequestSchema- Executes a toolListResourcesRequestSchema- Lists available resourcesReadResourceRequestSchema- Reads a resourceListPromptsRequestSchema- Lists available promptsGetPromptRequestSchema- Gets a prompt with arguments
Testing with MCP Clients
To test this server, you'll need an MCP client. Popular options include:
- Claude Desktop - Add the server to your MCP configuration
- MCP Inspector - A debugging tool for MCP servers
- Custom MCP Client - Build your own using the MCP SDK
Example Configuration (Claude Desktop)
Add to your Claude Desktop MCP settings:
{
"mcpServers": {
"fast-mcp-demo": {
"command": "node",
"args": ["/path/to/fast-mcp/dist/index.js"]
}
}
}
Learning Path
This project was built incrementally to understand MCP concepts:
- ✅ Initial Setup - TypeScript configuration and dependencies
- ✅ Basic Server - Simple server with hello tool
- ✅ Resources - Added resource reading capabilities
- ✅ Prompts - Added prompt templates
- ✅ Advanced Tools - Added calculate tool with error handling
Key Concepts
Tools
Tools are functions that the AI can call. They have:
- A name and description
- An input schema (JSON Schema)
- Execution logic that returns results
Resources
Resources are data sources that can be read. They have:
- A URI identifier
- A name and description
- A MIME type
- Content that can be retrieved
Prompts
Prompts are template messages that can be used to guide AI interactions. They have:
- A name and description
- Optional arguments
- Message templates
Next Steps
To extend this demo, consider:
- Adding file system resources
- Implementing authentication
- Adding more complex tools (API calls, database queries)
- Using different transports (SSE, HTTP)
- Adding logging and error handling middleware
- Implementing caching for resources
Resources
- MCP Specification
- MCP TypeScript SDK
- FastMCP (Python) - The Python equivalent
License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.