my-mcp-server
my-mcp-server
TypeScript で MCP (Model Context Protocol) サーバーを構築するためのプレイグラウンド兼実験プロジェクトです。stdio トランスポートを介して AI エージェントや言語モデルにツールとリソースを公開する方法を示します。
このサーバーは、シンプルなユーザーデータベース(ローカル JSON ファイルでバックアップ)を管理し、AI エージェントがユーザーレコードを読み取ったり作成したりするために呼び出せるエンドポイントを公開します。
特徴
ツール —
my-create-tool:name、address、email、phoneフィールドを受け取り、レコードを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:watchMCP 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技術スタック
パッケージ | 役割 |
| MCP サーバー SDK(ツール、リソース、stdio トランスポート) |
| ツールの入力スキーマ検証 |
| ビルドステップなしで TypeScript を直接実行 |
| TypeScript コンパイラ |
| ブラウザベースの MCP デバッグ UI |
ライセンス
ISC
This server cannot be deployed
Maintenance
Related MCP Connectors
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
- UnifAPIOAuthcom.unifapi
Hosted MCP server for live public-data APIs and Skills for AI agents.
MCP server for building and testing AI agents with multi-model experimentation and insights.
MCP server exposing the Backtest360 engine API as tools for AI agents.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceA lightweight MCP server that connects a local AI model (Ollama) with custom CRUD tools for an in-memory database, enabling natural language database management.-
- FlicenseNot gradedqualityDmaintenanceEducational example of an MCP server built with FastMCP, demonstrating how to expose tools, resources, and prompts for AI clients.-
- FlicenseNot gradedqualityDmaintenanceExample MCP server built with FastMCP, demonstrating tools, resources, and prompts for AI integration.13-
- FlicenseNot gradedqualityDmaintenanceA demonstrative MCP server that exposes a query-user tool for retrieving user info by ID, integrated with LangChain for agent-driven model reasoning and tool calls.-