Skip to main content
Glama
sp-acc

my-mcp-server

by sp-acc

my-mcp-server

一个使用 TypeScript 构建 MCP (Model Context Protocol) 服务器的游乐场和实验项目。它演示了如何通过 stdio 传输向 AI 代理和语言模型暴露 工具资源

该服务器管理一个简单的用户数据库(以本地 JSON 文件为后端),并暴露 AI 代理可以调用以读取或创建用户记录的端点。


功能特性

  • 工具 — my-create-tool:通过接受 nameaddressemailphone 字段创建新用户,并将记录持久化到 src/users.json

  • 资源 — users://all:以 JSON 形式返回模拟数据库中的完整用户列表。

  • 资源 — users://{userId}/profile:返回由 userId 标识的单个用户的个人资料。


Related MCP server: FastMCP Example Server

先决条件


安装

npm install

运行服务器

开发模式(使用 tsx,无需构建步骤)

npm run server:dev

构建并运行编译输出

npm run server:build   # compiles TypeScript → JavaScript
node dist/server.js    # run the compiled server

监视模式(更改时自动重新编译)

npm run server:build:watch

使用 MCP Inspector UI 进行检查

MCP Inspector 允许您在浏览器 UI 中交互式调用工具并浏览资源:

npm run server:inspect

注意: server:inspect 设置 DANGEROUSLY_OMIT_AUTH=true — 仅用于本地开发。


在代理环境中加载 MCP 服务器

代理 CLI(例如 Claude Code CLI)

代理应能检测到 .mcp.json 的存在并提示加载服务器。否则,它是一个简单的 MCP 服务器配置,需要与其他服务器一起添加到配置中。


项目结构

my-mcp-server/
├── src/
│   ├── server.ts      # MCP server entry point (tools & resources)
│   └── users.json     # Mock user database (read/written at runtime)
├── package.json
└── tsconfig.json

技术栈

角色

@modelcontextprotocol/sdk

MCP 服务器 SDK(工具、资源、stdio 传输)

zod

工具输入模式验证

tsx

无需构建步骤直接运行 TypeScript

typescript

TypeScript 编译器

@modelcontextprotocol/inspector

基于浏览器的 MCP 调试 UI


许可证

ISC

F
license - not found
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

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

View all related MCP servers

Related MCP Connectors

  • MCP server exposing the Backtest360 engine API as tools for AI agents.

  • MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.

  • MCP server for AI dialogue using various LLM models via AceDataCloud

View all MCP Connectors

Latest Blog Posts

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/sp-acc/my-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server