learn-mcp
A learning MCP server with tools, resources, prompts, and sampling for AI clients like Cursor, using local JSON storage.
README
learn-mcp
A learning MCP (Model Context Protocol) server built with the official TypeScript SDK. It exposes tools, resources, prompts, and sampling to AI clients like Cursor.
Data is stored in a local JSON file (src/data/users.json) — no external database required.
Features
Tools
| Tool | Description |
|---|---|
create-user |
Create a user with name, email, address, and phone |
create-random-user |
Uses MCP sampling to ask the client's AI to generate a fake user, then saves it |
Resources
| Resource | URI | Description |
|---|---|---|
users |
users://all |
All users (static resource) |
user-details |
users://{userId}/profile |
Single user by ID (resource template) |
Prompts
| Prompt | Args | Description |
|---|---|---|
generate-fake-name |
name |
Returns a message template asking the AI to generate a fake user for a given name |
Prerequisites
- Node.js 18+
- npm
Getting started
# Install dependencies
npm install
# Build TypeScript (optional — Cursor config uses tsx directly)
npm run build
Scripts
| Command | Description |
|---|---|
npm run build |
Compile TypeScript to build/ |
npm run build:watch |
Recompile on file changes |
npm start |
Run compiled server (node build/index.js) |
npm run mcp |
Run server via tsx (development) |
npm run dev |
Run with tsx watch mode |
npm run inspect |
Open MCP Inspector in the browser |
Cursor setup
This project includes .cursor/mcp.json:
{
"mcpServers": {
"learn-mcp": {
"type": "stdio",
"command": "npx",
"args": ["tsx", "src/index.ts"],
"cwd": "${workspaceFolder}"
}
}
}
After opening the project in Cursor:
- Go to Settings → MCP and confirm
learn-mcpis connected - Use Agent mode to invoke tools and read resources
- Reload the window if the server doesn't appear (
Ctrl+Shift+P→ "Developer: Reload Window")
Example prompts in Cursor
Create a user named Alice with email alice@example.com, address 42 Oak St, phone 555-1234
Show me all users
Read users://5/profile
Use the generate-fake-name prompt with name "Jared Leto"
MCP Inspector
Test tools, resources, and prompts without Cursor:
npm run inspect
Open the URL printed in the terminal (usually http://localhost:6274).
Stdio rule: Never run the server through
npm run devin MCP config — npm prints to stdout and breaks the JSON-RPC transport. Always usetsx src/index.tsornode build/index.jsdirectly.
Project structure
├── .cursor/
│ └── mcp.json # Cursor MCP configuration
├── src/
│ ├── index.ts # Server entry point
│ └── data/
│ └── users.json # User "database"
├── build/ # Compiled output (gitignored)
├── package.json
├── tsconfig.json
└── README.md
Transport
Uses stdio — the client spawns the server process and communicates over stdin/stdout. This is the standard setup for local MCP servers in Cursor and Claude Desktop.
Sampling note
create-random-user calls sampling/createMessage, which asks the client (not the server) to run an LLM and return generated text. This requires the client to support the sampling capability.
- Works when the client implements
sampling/createMessageand the user approves the request - Cursor may not fully support sampling yet — if
create-random-userfails withMethod not found, usecreate-userinstead
Development notes
- Use
registerTool(),registerResource(), andregisterPrompt()— the older.tool(),.resource(), and.prompt()methods are deprecated - Resource templates need a
listcallback for Cursor to discover individual URIs - Use
console.error()for debug logs — neverconsole.log()on stdio transport (stdout is reserved for JSON-RPC) McpServerconstructor takes two arguments: server info (name,version) and options (capabilities, etc.)
License
ISC
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。