JUHE API Marketplace
jiliangmason avatar
MCP Server

Custom Context MCP Server

A FastMCP-based server that supports SSE real-time event streaming and tool calling, with features for text-to-JSON conversion and grouping text by JSON templates.

0
GitHub Stars
3/3/2026
Last Updated
No Configuration
Please check the documentation below.
  1. Home
  2. MCP Servers
  3. custom-mcp-server

README Documentation

Custom Context MCP Server

基于FastMCP框架的MCP服务器,支持SSE实时事件流和工具调用。

功能特性

  • ✅ 基于FastMCP框架
  • ✅ SSE实时事件流
  • ✅ HTTP健康检查端点
  • ✅ 支持mcp-inspector调试
  • ✅ TypeScript类型安全
  • ✅ 热重载开发模式

快速开始

安装依赖

pnpm install

开发模式

# 启动开发服务器(包含mcp-inspector)
pnpm run dev

# 或者启动监听模式
pnpm run dev:watch

生产模式

# 构建项目
pnpm run build

# 启动服务器
pnpm start

调试指南

使用mcp-inspector调试

  1. 启动服务器:

    pnpm run dev
    
  2. 访问mcp-inspector:

    • 服务器启动后会自动打开mcp-inspector界面
    • 或者手动访问:http://localhost:6274
  3. 测试工具:

    • 在mcp-inspector中选择工具
    • 输入参数并执行
    • 查看实时结果

服务器端点

  • SSE端点: http://localhost:3005/sse
  • 健康检查: http://localhost:3005/health
  • mcp-inspector: http://localhost:6274

测试工具

group-text-by-json
{
  "template": "{\"name\": \"string\", \"age\": \"number\", \"city\": \"string\"}"
}
text-to-json
{
  "template": "{\"name\": \"string\", \"age\": \"number\", \"city\": \"string\"}",
  "text": "name: John Doe\nage: 25\ncity: Beijing"
}

项目结构

src/
├── common/
│   ├── constants.ts    # 常量定义
│   ├── tools.ts        # 工具实现
│   ├── types.ts        # 类型定义
│   └── utils.ts        # 工具函数
└── index.ts           # 主入口文件

工具功能

1. group-text-by-json

根据JSON模板生成文本分组提示词,帮助AI将文本按模板结构分组。

2. text-to-json

将分组文本转换为JSON格式,基于原始模板结构。

开发指南

添加新工具

  1. 在 src/common/types.ts 中定义工具schema
  2. 在 src/common/tools.ts 中实现工具逻辑
  3. 在 src/common/constants.ts 中添加工具名称
  4. 在 src/index.ts 中注册工具

调试技巧

  1. 查看日志: 服务器会输出详细的日志信息
  2. SSE连接: 可以通过浏览器访问SSE端点查看实时事件
  3. 健康检查: 访问健康检查端点确认服务器状态
  4. 热重载: 开发模式下支持代码热重载

常见问题

端口被占用
# 检查端口占用
lsof -i :3005
lsof -i :6274
构建错误
# 清理并重新构建
rm -rf build/
pnpm run build
依赖问题
# 重新安装依赖
pnpm install

技术栈

  • FastMCP: MCP协议实现框架
  • Express: HTTP服务器和中间件
  • TypeScript: 类型安全
  • SSE: 服务器发送事件
  • Zod: 数据验证

许可证

ISC

Quick Actions

View on GitHubView All Servers

Key Features

Model Context Protocol
Secure Communication
Real-time Updates
Open Source

Boost your projects with Wisdom Gate LLM API

Supporting GPT-5, Claude-4, DeepSeek v3, Gemini and more.

Enjoy a free trial and save 20%+ compared to official pricing.

Learn More
JUHE API Marketplace

Accelerate development, innovate faster, and transform your business with our comprehensive API ecosystem.

JUHE API VS

  • vs. RapidAPI
  • vs. API Layer
  • API Platforms 2025
  • API Marketplaces 2025
  • Best Alternatives to RapidAPI

For Developers

  • Console
  • Collections
  • Documentation
  • MCP Servers
  • Free APIs
  • Temp Mail Demo

Product

  • Browse APIs
  • Suggest an API
  • Wisdom Gate LLM
  • Global SMS Messaging
  • Temp Mail API

Company

  • What's New
  • Welcome
  • About Us
  • Contact Support
  • Terms of Service
  • Privacy Policy
Featured on Startup FameFeatured on Twelve ToolsFazier badgeJuheAPI Marketplace - Connect smarter, beyond APIs | Product Huntai tools code.marketDang.aiFeatured on ShowMeBestAI
Copyright © 2026 JUHEDATA HK LIMITED - All rights reserved