MCP Server Template
Minimal template for building Model Context Protocol servers with Bun and TypeScript, including schema-based state validation, YAML persistence, and tool registration.
README
MCP Server Template
Minimal template for building Model Context Protocol (MCP) servers with Bun and TypeScript.
Quick Start
bun install
bun run dev # Development
bun run start # Production
Configure in Cursor
{
"mcpServers": {
"my-mcp-server": {
"command": "bun",
"args": ["/path/to/your/project/index.ts"],
"cwd": "/path/to/your/project"
}
}
}
Project Structure
├── index.ts # Server entry point
├── schema.ts # State schema (Zod)
├── config.ts # Configuration
├── state.yaml # State file
├── tools/ # Tool handlers
└── utils/ # State & logging utilities
Features
- Schema-based state validation (Zod)
- YAML state persistence
- Tool usage logging
- Deep merge for state updates
Usage
Customize State
- Update
schema.tsto match your state structure - State is automatically validated on read/write
Add Tools
- Create
tools/your-tool.tsfollowingexample-tool.tspattern - Register in
index.ts:registerYourTool(server);
State Operations
import { getState, updateState, saveState } from "./utils/state.ts";
import { type State } from "./schema.ts";
const state = await getState();
await updateState({ version: "1.0.1" }); // Deep merge
await saveState(newState); // Full replacement
Logging
import { log } from "./utils/logger.ts";
await log("info", "tool_name", request, response);
See TEMPLATE.md for detailed examples.
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.