mcp-demo-server
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-demo-servercreate a task called 'write the report'"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-demo-server
A small Model Context Protocol (MCP) server built with
TypeScript and the official @modelcontextprotocol/sdk. It exposes a set of tools an LLM
client (Claude Desktop, Claude Code, or any other MCP-compatible client) can call: a
SQLite-backed task manager, a calculator, and a tool that reports the server's own metadata.
What is MCP?
Model Context Protocol is an open protocol that standardizes how applications provide context and capabilities (tools, resources, prompts) to LLMs. An MCP server exposes a set of tools with typed input schemas; an MCP client (like Claude Desktop or Claude Code) discovers those tools and lets the model call them, receiving structured results back. Communication typically happens over stdio (a local subprocess) or HTTP.
This project focuses on the tools side of the protocol: input validation, error handling, and testable business logic decoupled from the transport layer.
Related MCP server: MCP Server Demo
Stack
Node.js + TypeScript (strict mode)
@modelcontextprotocol/sdk(official TypeScript SDK)zodfor input schema validationbetter-sqlite3for persistencevitestfor unit testsESLint + Prettier
Project structure
src/
server.ts # MCP server bootstrap (stdio transport, tool registration)
db.ts # SQLite connection + schema
tools/
tasks.ts # task CRUD business logic
calculator.ts # arithmetic operations
serverInfo.ts # server metadata
types/
task.ts # Task type + zod schemas
lib/
result.ts # Result<T> type used for standardized success/error returns
tests/
tasks.test.ts
calculator.test.ts
serverInfo.test.tsEach tool's logic lives in a plain function that takes a database/context and typed input and
returns a Result<T> ({ ok: true, data } or { ok: false, error }). server.ts is the only
file that talks to the MCP SDK — it wires those functions to registerTool, so the logic can be
unit tested without spinning up a server or a transport.
Running locally
npm install
npm run build
npm start # runs the compiled server over stdioFor development without a build step:
npm run dev # runs src/server.ts directly via tsxThe server communicates over stdio, so running it directly in a terminal will just sit there waiting for JSON-RPC messages on stdin — that's expected. It's meant to be launched by an MCP client, not run interactively.
Testing with Claude Code
Add the server to Claude Code's MCP config, pointing at the built entrypoint:
claude mcp add mcp-demo-server -- node /absolute/path/to/mcp-demo-server/dist/server.jsOr, for a project-scoped config, add to .mcp.json:
{
"mcpServers": {
"mcp-demo-server": {
"command": "node",
"args": ["/absolute/path/to/mcp-demo-server/dist/server.js"]
}
}
}Then ask Claude to use the tools, e.g. "create a task called 'write the report'" or "what's 23 * 47?". Any other MCP client (Claude Desktop, MCP Inspector, etc.) can connect the same way via stdio.
Running the test suite
npm test # run once
npm run test:watch
npm run lint
npm run format:checkTools
task_create
Creates a new task.
Input
{ "title": "Write the report", "description": "Q3 summary" }Output
{
"id": 1,
"title": "Write the report",
"description": "Q3 summary",
"status": "pending",
"createdAt": "2026-01-15 10:00:00",
"updatedAt": "2026-01-15 10:00:00"
}task_list
Lists tasks, optionally filtered by status (pending, in_progress, done).
Input
{ "status": "pending" }Output: array of task objects (same shape as task_create).
task_get
Fetches a single task by id.
Input
{ "id": 1 }Output: a task object, or an error result if the id doesn't exist.
task_update
Updates one or more fields of an existing task. Omitted fields are left unchanged.
Input
{ "id": 1, "status": "done" }Output: the updated task object.
task_delete
Deletes a task by id.
Input
{ "id": 1 }Output
{ "id": 1 }calculate
Performs a basic arithmetic operation (add, subtract, multiply, divide) on two numbers.
Input
{ "operation": "divide", "a": 10, "b": 2 }Output
5Dividing by zero returns an error result instead of throwing:
{ "isError": true, "content": [{ "type": "text", "text": "Division by zero is not allowed" }] }server_info
Returns metadata about the running server: name, version, Node.js version, uptime in seconds, and the list of available tools. Takes no input.
Output
{
"name": "mcp-demo-server",
"version": "1.0.0",
"nodeVersion": "v22.14.0",
"uptimeSeconds": 42,
"tools": ["task_create", "task_list", "task_get", "task_update", "task_delete", "calculate", "server_info"]
}Error handling
Every tool validates its input against a zod schema before running any logic (the MCP SDK
rejects malformed input automatically based on the registered schema). Business-level failures
(task not found, division by zero) are returned as Result error values rather than thrown
exceptions, and are surfaced to the client as isError: true tool results — never as an
unhandled exception that crashes the server process.
License
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityCmaintenanceA server implementation that enables LLMs to programmatically manage tasks in Todo.txt files using the Model Context Protocol (MCP), supporting operations like adding, completing, deleting, listing, searching, and filtering tasks.Last updated11179ISC
- Flicense-quality-maintenanceA demonstration MCP server that provides calculator tools for arithmetic operations, personalized greeting resources, and code review prompt templates. Enables users to perform basic math calculations, generate dynamic greetings, and access reusable code review templates through the Model Context Protocol.Last updated
- FlicenseCqualityDmaintenanceA reference implementation of a Model Context Protocol server that demonstrates core primitives including tools, resources, and prompts. It enables users to perform basic arithmetic operations and manage notes through a simple storage system.Last updated4
- Flicense-qualityCmaintenanceA task manager MCP server that demonstrates all three MCP primitives (tools, resources, prompts). Enables users to manage tasks, read task summaries and details, and run structured planning/review prompts through natural language.Last updated
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Personal assistant MCP server with search, execute, packages, jobs, secrets, and integrations.
Hosted MCP server for LLM cost estimation, model comparison, and budget-aware routing.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Alucsky/mcp-demo-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server