MCP Server

MCP Server

A basic MCP server implementation using Node.js and TypeScript that bridges AI models with external tools and data sources via JSON-RPC.

Category
Visit Server

README

πŸ“‘ MCP Server - Model Context Protocol (Node.js + TypeScript) ✨ Author

Name: Imane Lmzk Project: MCP Server Learning Implementation

πŸ“Œ Overview

This project demonstrates a basic implementation of an MCP (Model Context Protocol) Server using Node.js and TypeScript.

The MCP server acts as a bridge between AI models and external tools/data sources, allowing structured communication via standardized protocols.

🧠 What is MCP?

Model Context Protocol (MCP) is a protocol designed to allow AI systems to:

Access external tools (APIs, databases, services) Retrieve structured data Execute actions in a controlled environment

πŸ‘‰ Think of MCP as:

A middleware layer between an AI model and real-world systems.

πŸ—οΈ Architecture Client (AI / App) β”‚ β–Ό MCP Server β”‚ β”œβ”€β”€ Tools (functions) β”œβ”€β”€ Resources (data) └── External APIs / DB βš™οΈ Tech Stack Node.js TypeScript Express (optional for HTTP transport) JSON-RPC / HTTP πŸ“‚ Project Structure mcp-server/ β”œβ”€β”€ src/ β”‚ β”œβ”€β”€ server.ts # MCP server entry point β”‚ β”œβ”€β”€ tools/ # Tool definitions β”‚ β”œβ”€β”€ resources/ # Data providers β”‚ └── types/ # Type definitions β”œβ”€β”€ package.json └── tsconfig.json πŸš€ Getting Started

  1. Install dependencies npm install
  2. Run the server npm run dev

Server runs on:

http://localhost:3000 πŸ”Œ MCP Core Concepts

  1. Tools

Tools are functions exposed to the AI.

Example:

export const getUser = async (id: number) => { return { id, name: "Imane" }; }; 2. Resources

Resources provide structured data.

export const users = [ { id: 1, name: "Imane" }, { id: 2, name: "Ali" } ]; 3. Requests (JSON-RPC style)

Example request:

{ "method": "tools/getUser", "params": { "id": 1 } } 4. Response { "result": { "id": 1, "name": "Imane" } } πŸ§ͺ Example Endpoint (Express) import express from "express"; import { getUser } from "./tools/getUser";

const app = express(); app.use(express.json());

app.post("/mcp", async (req, res) => { const { method, params } = req.body;

if (method === "tools/getUser") { const result = await getUser(params.id); return res.json({ result }); }

res.status(400).json({ error: "Unknown method" }); });

app.listen(3000, () => { console.log("MCP Server running on port 3000"); }); πŸ“‘ How MCP Works (Step-by-Step) Client sends a request MCP server interprets the method Calls the appropriate tool Returns structured response πŸ”— Use Cases AI assistants accessing databases Automation systems API orchestration Tool-based AI agents πŸ“ˆ Learning Goals Understand MCP architecture Build tool-based APIs Structure backend for AI interaction Practice TypeScript backend patterns πŸ”§ Useful Commands npm run dev # Start server npm run build # Compile TypeScript npm start # Run production build πŸ“„ License

MIT

🚧 Status

In Progress β€” Learning MCP concepts and real-world integration.

πŸ’‘ Final Insight

MCP is not just a server β€” it’s a design pattern for AI-integrated systems. Mastering it means understanding how AI interacts with real-world data and tools.

Recommended Servers

playwright-mcp

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.

Official
Featured
TypeScript
Magic Component Platform (MCP)

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.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

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.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

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.

Official
Featured
TypeScript
Kagi MCP Server

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.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Exa Search

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.

Official
Featured