MCP Demo 669431e6

MCPAI代理

提供方 tylerjhayden

AI代理 stdio · 本地进程 Token 社区 / 第三方 Claude
查看接入方式

一个基于TypeScript的MCP服务器实现,展示生产就绪模式,包括计算、API集成和文件系统访问功能,适用于企业级应用开发。

一句话选型结论

按资料字段整理

MCP Demo 669431e6 属于AI代理类 MCP 服务器,stdio · 本地进程,Token,可直接接入 Claude,有可直接执行的安装命令。接入前先确认权限范围;涉及写入、删除或付款的操作,建议先在测试环境验证。

分类AI代理 传输方式stdio · 本地进程 鉴权Token 部署方式本地部署
GitHub 星标 1 仓库热度,无公开仓库时显示未标注
工具数 3 暴露给模型的工具数量
资源 / 提示词 0 / 0 资源与提示词模板数量
维护方 社区 / 第三方 核验等级 仅资料核对

工具与能力

AI代理
数量来自来源目录的标注,具体工具清单以官方文档为准
工具数量3暴露给模型可调用的工具个数
资源数量0可读取的资源条目
提示词数量0内置提示词模板数量

能力标签

支持客户端

适用场景

协议服务器TypeScript本地部署企业开发框架比较生产就绪

安装与配置

stdio · 本地进程 Token
客户端在本机拉起子进程,数据不出本机
docker run -p 3000:3000 \

这条命令只是入口,具体启动参数请按官方文档补齐,不要直接照搬到别的服务器。

  1. 1
    准备运行环境

    stdio 服务在本地起进程,需要先装好 Docker,再按安装命令拉取依赖。

  2. 2
    安装服务

    复制上面的安装命令执行;命令里带占位符的位置,换成自己的密钥或路径。

  3. 3
    写入客户端配置

    在客户端的 MCP 配置里填好启动命令和参数,保存后完全退出客户端再打开,让新配置生效。

  4. 4
    验证是否可用

    连接成功后客户端会列出约 3 个工具,随便调一个只读工具确认能返回结果。

典型使用场景

3 类
按分类与标签整理的常见用法,具体以官方文档为准
给代理接外部能力

让代理在任务中途调用搜索、数据库等真实工具。

多步任务编排

把一串操作拆成步骤,由代理按顺序执行。

自动化重复流程

把固定流程交给代理跑,减少手工操作。

选择建议

选之前先看这几条
按条目字段给出的判断,不替你决定用不用

值得选的地方

  • 资料标注 3 个工具,职责相对集中,接入后不容易误操作。
  • 有现成的安装命令,不用自己找入口,照着跑就能起服务。
  • 已适配 Claude,换客户端不用重新研究配置。

先想清楚的地方

  • stdio 方式要求本地装好运行时(如 Node.js),换机器要重新装一遍。
  • 使用前要准备好Token对应的凭据,并按最小权限配置。
  • 版本更新与行为细节以官方仓库为准。

更适合

  • 需要在AI代理场景里让模型直接调用外部能力的人。
  • 已经在用 Claude 的用户,接入路径最短。
  • 想先快速试一下、能接受在本地或自有环境跑服务的人。

不太适合

  • 完全不想在本地装环境的人。
  • 不方便管理密钥或第三方授权的人。
  • 需要厂商级 SLA 和技术支持的生产环境。

同类对比

6 个同类
同分类里挑最接近的几条,字段以各自详情页为准
MCP 服务器工具数传输方式部署方式安装命令最后核验
MCP Demo 669431e6当前 3 stdio · 本地进程 本地部署 有 2026-05-17
Filesystem 560c4363 13 未标注 本地部署 无 2026-05-17
Server Everything (everything) 11 stdio · 本地进程 本地部署 有 2026-05-17
Time 7365cb6d 2 SSE · 服务端推送 远程部署 有 2026-05-18
Everything Claude Code 未标注 stdio · 本地进程 本地部署 有 2026-05-17
Openmemory 557e1585 未标注 stdio · 本地进程 本地部署 有 2026-05-17

服务器档案

AI代理
字段来自项目仓库与公开索引,中文说明由本站标注
提供方tylerjhayden上游标注的维护方 tylerjhayden
分类AI代理本站按上游分类展示
连接方式stdio · 本地进程客户端在本机拉起子进程,数据不出本机
鉴权方式Token远程服务建议用最小权限凭据
维护方社区 / 第三方核验等级 仅资料核对
包名 / 运行时未标注 · Docker本地安装时用到的包标识与运行时
部署类型本地部署上游给出的部署形态
最近核验2026-05-17上游最后核验时间

详细介绍

15.2 KB
来自项目仓库与上游目录的原文,未做删改

MCP Demo Server

Model Context Protocol (MCP) server implementation demonstrating production-ready patterns in TypeScript.
Four parallel implementations comparing bare-metal and framework approaches.

Overview

This project showcases MCP server implementations with:

  • Three core patterns: Computation (calculate), API integration (weather), filesystem access
  • Four implementations: Bare-metal, FastMCP, EasyMCP*, mcp-framework
  • Framework comparison: Real-world evaluation of MCP development approaches

Note: The EasyMCP implementation may not run due to unstable npm package (v0.0.0-development).
-
Enterprise patterns: Security, observability, reliability demonstrated across all implementations
-
Dual transports*: Stdio for desktop apps, HTTP/SSE for remote access

Quick Start

Prerequisites

  • Node.js 20+
  • pnpm 8+
  • OpenWeatherMap API key (free tier: https://openweathermap.org/api)

Installation```bash

Clone and install

git clone <repository-url>
cd mcp-demo
pnpm install

Configure

cp .env.example .env

Edit .env and add your WEATHER_API_KEY


### Use with Claude Code```bash
# Build the server
pnpm build

# Add to Claude Code
claude mcp add demo-server node -- $(pwd)/dist/servers/bare-metal/index.js

# Verify connection
claude mcp list

Manual Testing (HTTP mode)```bash

Development

TRANSPORT_MODE=http pnpm dev

Production

pnpm build
TRANSPORT_MODE=http pnpm start


**Note**: For Claude Code (stdio mode), you don&#x27;t need to manually run the server - it auto-starts!

## Architecture

### High-Level Design```
┌─────────────┐
│   Client    │
└──────┬──────┘
       │
┌──────▼───────────────────┐
│  Transport Layer         │
│  • Stdio (stdin/stdout)  │
│  • HTTP/SSE (Express)    │
└──────┬───────────────────┘
       │
┌──────▼───────────────┐
│  Middleware Pipeline │
│  • Auth              │
│  • Rate Limiting     │
│  • Logging/Tracing   │
│  • Metrics           │
└──────┬───────────────┘
       │
┌──────▼────────────┐
│  Message Router   │
│  • tools/list     │
│  • tools/call     │
│  • resources/list │
│  • resources/read │
└──────┬────────────┘
       │
┌──────▼──────────────────┐
│  Handler Registries     │
│  • ToolRegistry         │
│  • ResourceRegistry     │
└──────┬──────────────────┘
       │
┌──────▼────────────────────┐
│  Capability Handlers      │
│  • CalculateTool          │
│  • WeatherTool            │
│  • FileResourceHandler    │
└───────────────────────────┘

Handler Pattern

All capabilities implement a common interface:```typescript
interface CapabilityHandler<TParams, TResult> {
validate(input: unknown): ValidationResult<TParams>;
execute(params: TParams, context: ExecutionContext): Promise<Result<TResult>>;
handleError(error: Error): MCPError;
}


This eliminates repetition and makes adding new capabilities simple:

1. Implement the interface
2. Register with appropriate registry
3. Done - routing and transport work automatically

## Framework Comparison

This project includes **four parallel implementations** of the same MCP server capabilities, allowing you to compare approaches:

| Implementation | Lines of Code | Pattern | Best For |
|---------------|---------------|---------|----------|
| **Bare-metal** (`/servers/bare-metal`) | ~2,000 | Direct MCP SDK | Learning MCP internals, full control, custom needs |
| **FastMCP** (`/servers/fastmcp-impl`) | ~420 | Builder API | Production apps, Express-like familiarity |
| **EasyMCP** (`/servers/easymcp-impl`) ⚠️ | ~400 | Decorators | Rapid prototyping, minimal boilerplate (package unstable) |
| **mcp-framework** (`/servers/mcp-framework-impl`) | ~455 | Auto-discovery | Large projects with many capabilities |

⚠️ *EasyMCP implementation may not run - the `easy-mcp` npm package has broken exports in v0.0.0-development*

### Feature Matrix

| Feature | Bare-metal | FastMCP | EasyMCP | mcp-framework |
|---------|------------|---------|---------|---------------|
| **Transport: stdio** | ✓ | ✓ | ✓ | ✓ |
| **Transport: HTTP/SSE** | ✓ | ✓ | ✗ | ✓ |
| **Input validation** | Manual Zod | Zod schemas | Type inference | Zod + helpers |
| **Auto-discovery** | ✗ | ✗ | ✗ | ✓ (from `/tools`) |
| **Type safety** | Manual | Schema-based | Decorator inference | `MCPInput` |
| **Setup complexity** | High | Medium | Low | Medium |
| **Boilerplate** | High | Low | Minimal | Low-Medium |
| **Framework dependency** | None | FastMCP | EasyMCP | mcp-framework |
| **Learning curve** | Steep | Gentle | Gentle | Medium |

### Code Comparison: Adding a Tool

**Bare-metal** (must implement full interface):```typescript
class MyTool implements CapabilityHandler {
  validate(input: unknown): ValidationResult { /* ... */ }
  execute(params: MyParams, ctx: ExecutionContext): Promise&lt;Result&gt; { /* ... */ }
  handleError(error: Error): MCPError { /* ... */ }
}
// Register manually
toolRegistry.register(&#x27;my_tool&#x27;, new MyTool());

FastMCP (builder pattern):```typescript
server.addTool({
name: 'my_tool',
parameters: z.object({ input: z.string() }),
execute: async (args) => processInput(args.input),
});


**EasyMCP** (decorators):```typescript
class MyMCP extends EasyMCP {
  @Tool({ description: &#x27;Process input&#x27; })
  async myTool(input: string) {
    return processInput(input);
  }
}

mcp-framework (auto-discovery):```typescript
// In /tools/my_tool.ts
class MyTool extends MCPTool {
name = 'my_tool';
schema = defineSchema({ input: z.string().describe('Input') });
async execute(input: MCPInput<this>) {
return processInput(input.input);
}
}
export default MyTool;
// Automatically discovered - no registration needed


### When to Choose Each Approach

**Choose Bare-metal when:**
- Learning MCP protocol internals
- Need maximum control and customization
- Building something unusual or experimental
- Want minimal dependencies
- Performance optimization is critical

**Choose FastMCP when:**
- Building production applications quickly
- Team is familiar with Express.js patterns
- Need session management and authentication
- Want a proven, battle-tested framework

**Choose EasyMCP when:**
- ⚠️ **Note:** Currently not recommended - package has stability issues
- Rapid prototyping or MVPs
- Building simple, small servers
- Team prefers TypeScript decorators
- Want absolute minimum boilerplate
- Developer experience is top priority

**Choose mcp-framework when:**
- Building large projects with many capabilities
- Want CLI tooling (`mcp validate`, `mcp add`)
- Team prefers convention over configuration
- Scalability and organization are important
- Need structured file organization

### Running the Implementations

Each implementation is in its own directory under `/servers`:```bash
# Bare-metal
cd servers/bare-metal
pnpm build
node dist/index.js

# FastMCP
cd servers/fastmcp-impl
npm install
npm run dev

# EasyMCP (⚠️ may not work - package unstable)
cd servers/easymcp-impl
npm install
npm run dev

# mcp-framework
cd servers/mcp-framework-impl
npm install
npm run dev

All implementations support the same three capabilities (calculate, get_weather, file access) with identical APIs.

Capabilities

1. calculate (Computation Pattern)

Evaluates mathematical expressions with security controls.

Method: tools/call

Parameters:```json
{
"name": "calculate",
"arguments": {
"expression": "2 + 2 * 10"
}
}


**Returns**:```json
{
  &quot;expression&quot;: &quot;2 + 2 * 10&quot;,
  &quot;result&quot;: 22
}

Security: Expression sanitization prevents code injection. Only mathematical operators allowed.

2. get_weather (API Integration Pattern)

Fetches current weather data from OpenWeatherMap.

Method: tools/call

Parameters:```json
{
"name": "get_weather",
"arguments": {
"location": "San Francisco"
}
}


**Returns**:```json
{
  &quot;location&quot;: &quot;San Francisco, US&quot;,
  &quot;temperature&quot;: 18.5,
  &quot;conditions&quot;: &quot;partly cloudy&quot;,
  &quot;timestamp&quot;: &quot;2025-10-20T10:37:00Z&quot;
}

Features: 10-minute result caching, configurable timeout, error handling for API failures.

3. file:// resources (Filesystem Pattern)

Provides safe read access to files in allowed directories.

List resources:```json
{
"method": "resources/list"
}


**Read resource**:```json
{
  &quot;method&quot;: &quot;resources/read&quot;,
  &quot;params&quot;: {
    &quot;uri&quot;: &quot;file:///tmp/example.txt&quot;
  }
}

Security: Path traversal protection, restricted to ALLOWED_FILE_PATHS, MIME type detection.

Configuration

All configuration via environment variables. See .env.example for details.

Key Variables```bash

Transport

TRANSPORT_MODE=stdio # or "http"
HTTP_PORT=3000 # HTTP mode only

Weather API

WEATHER_API_KEY=your_key # Required for weather tool
WEATHER_CACHE_TTL=600 # Seconds (10 min default)

Security

ALLOWED_FILE_PATHS=/tmp # Colon-separated paths
API_KEYS=key1,key2 # HTTP mode only
RATE_LIMIT_REQUESTS=60 # Requests/min per client

Observability

LOG_LEVEL=info # debug|info|warn|error
LOG_FORMAT=pretty # json|pretty


## Deployment

### Local Development```bash
# Stdio mode with auto-reload
pnpm dev

# HTTP mode with auto-reload
TRANSPORT_MODE=http pnpm dev

Docker```bash

Build image

docker build -t mcp-demo .

Run container

docker run -p 3000:3000 \
-e WEATHER_API_KEY=your_key \
-e API_KEYS=your_api_key \
mcp-demo


### MCP Client Integration

**Claude Code CLI** (recommended):```bash
# Build the server first
pnpm build

# Add to Claude Code (stdio mode)
claude mcp add demo-server node -- /path/to/mcp-demo/dist/servers/bare-metal/index.js

# Verify it&#x27;s connected
claude mcp list

# The server will auto-start when Claude Code needs it
# No need to manually run pnpm start!

Claude Desktop (stdio):```json
{
"mcpServers": {
"demo-server": {
"command": "node",
"args": ["/path/to/mcp-demo/dist/servers/bare-metal/index.js"]
}
}
}


**HTTP Client**:```bash
curl -X POST http://localhost:3000/mcp \
  -H &quot;Content-Type: application/json&quot; \
  -H &quot;Authorization: Bearer your_api_key&quot; \
  -d &#x27;{
    &quot;jsonrpc&quot;: &quot;2.0&quot;,
    &quot;id&quot;: 1,
    &quot;method&quot;: &quot;tools/call&quot;,
    &quot;params&quot;: {
      &quot;name&quot;: &quot;calculate&quot;,
      &quot;arguments&quot;: {&quot;expression&quot;: &quot;2 + 2&quot;}
    }
  }&#x27;

Sharing Your Server

Stdio vs HTTP: When to Use Each

Stdio Mode (Local, Single User):
- ✅ Personal use with Claude Code/Desktop
- ✅ Secure (OS-level permissions only)
- ✅ No network exposure
- ✅ Auto-starts/stops with client

HTTP Mode (Shared, Multi-User):
- ✅ Share with other Claude Code users
- ✅ Remote access (deploy to cloud)
- ✅ Multiple simultaneous clients
- ✅ Testing with curl/Postman
- ✅ Browser-based integrations

Deployment for Sharing

Quick Test (ngrok):```bash

Terminal 1: Start server

TRANSPORT_MODE=http pnpm start

Terminal 2: Create tunnel

ngrok http 3000

Share URL: Others add with

claude mcp add --transport http your-server https://abc123.ngrok.io/mcp


**Production (Cloud)**:```bash
# Deploy to Railway, Render, Fly.io, AWS, etc.
# Set environment:
#   TRANSPORT_MODE=http
#   API_KEYS=key1,key2,key3

# Users connect:
claude mcp add --transport http your-server \
  https://your-domain.com/mcp \
  --header &quot;Authorization: Bearer user_api_key&quot;

Self-Host (GitHub):```bash

Share repo - users run their own instance

git clone your-repo
pnpm install && pnpm build
claude mcp add demo-server node -- $(pwd)/dist/servers/bare-metal/index.js


## Implementation Details

### Bare-Metal Approach

This implementation uses the official MCP SDK minimally, implementing core patterns manually:

**Advantages**:
- Full control and transparency
- Clear understanding of MCP mechanics
- Easy to customize for specific needs
- Minimal dependencies

**Components**:
- Manual request routing and handler registration
- Custom middleware pipeline
- Direct transport setup (stdio readline, Express HTTP)
- Explicit error handling patterns

**Lines of Code**: ~2500 (excluding tests)

### Security Considerations

**Production Checklist**:

- [x] Input validation with Zod schemas
- [x] Path traversal protection for file access
- [x] Expression sanitization to prevent code injection
- [x] API key authentication (HTTP mode)
- [x] Rate limiting (token bucket algorithm)
- [x] Request tracing for audit logs
- [x] Secure environment variable handling
- [ ] HTTPS/TLS for HTTP transport (configure reverse proxy)
- [ ] API key rotation mechanism (add to config)

## Extension Guide

Adding a new tool is straightforward:

**1. Create handler** (servers/bare-metal/handlers/MyTool.ts):```typescript
export class MyTool implements CapabilityHandler&lt;MyParams, MyResult&gt; {
  validate(input: unknown): ValidationResult&lt;MyParams&gt; {
    return validateWithSchema(MyParamsSchema, input);
  }

  async execute(params: MyParams, context: ExecutionContext): Promise&lt;Result&lt;MyResult&gt;&gt; {
    // Your logic here
    return { success: true, data: result };
  }

  handleError(error: Error): MCPError {
    return { code: MCPErrorCode.InternalError, message: error.message };
  }
}

2. Register in index.ts:```typescript
toolRegistry.register('my_tool', new MyTool(), {
name: 'my_tool',
description: 'Does something useful',
inputSchema: { / JSON schema / }
});


**Done!** Transport, routing, logging, and metrics work automatically.

## Testing```bash
# Run all tests
pnpm test

# Watch mode
pnpm test:watch

# Coverage report
pnpm test:coverage

Tests cover:
- Unit tests for all handlers
- Security validation (path traversal, injection attempts)
- Middleware functionality (auth, rate limiting)
- Integration tests for both transports

Project Structure```

/mcp-demo
/shared # Common utilities
/types # TypeScript interfaces
/security # Validation, sanitization
/observability # Logging, metrics, tracing
/config # Configuration management
/utils # HTTP client, helpers
/servers/bare-metal # Bare-metal implementation
/handlers # Tool and resource handlers
/transport # Stdio and HTTP transports
/middleware # Auth, rate limiting
/registry # Capability registration
/core # Message routing
index.ts # Main entry point
/tests # Test suites
/docs # Specifications
```

License

MIT

Contributing

Contributions welcome! This project is designed as a learning resource and template for production MCP servers.

Focus areas:
- Additional capability examples (database, caching, etc.)
- Enhanced security patterns
- Performance optimizations
- Framework comparison implementations

常见问题

8 问
答案由本站依据条目字段整理,不引用上游原文
MCP Demo 669431e6 怎么安装?

在客户端按下面的安装命令接入:docker run -p 3000:3000 \。装完在客户端配置里引用同一个包或端点。

MCP Demo 669431e6 怎么在 Claude 里配置?

它的传输方式是stdio · 本地进程,在客户端的 MCP 配置里填好启动命令和参数,保存后完全退出客户端再打开,配置才会生效。

MCP Demo 669431e6 收费吗?

本站不代收费用,也没有标注具体价格。是否收费取决于服务本身和背后的接口额度,正式使用前按官方说明确认。

MCP Demo 669431e6 需要 API Key 吗?

资料标注需要Token认证,使用前准备好对应凭据,并按最小权限配置。

MCP Demo 669431e6 支持哪些客户端?

资料标注支持 Claude;其他客户端只要能配置 MCP Server,也能用同样的命令或地址接入。

MCP Demo 669431e6 能提供哪些能力?

资料显示约 3 个工具;能力标签包括 TypeScript、Claude、生产就绪。具体工具清单以官方文档为准。

MCP Demo 669431e6 需要什么运行环境?

运行时为 Docker;属于本地进程,需要在本机装好运行环境。

MCP Demo 669431e6 是本地还是远程?

它是本地进程(stdio),由客户端在本机拉起。传输方式为stdio · 本地进程。

热门专题

按标签挑服务器
全部专题 →

服务器信息以作者仓库与官方文档为准;分类、传输方式与鉴权方式的中文说明为中文整理,最近核验 2026-05-17。