MCP.so
登录
服务器

MCP Service Framework

@Hiohk

一个基于MCP协议开发的LLM(大模型)服务端项目

概览

What is MCP Service Framework?

MCP Service Framework is an extensible service framework based on the Model Context Protocol (MCP) that provides a standardized tool invocation interface and AI integration capabilities. It includes a basic service architecture, a weather service implementation example, and an intelligent conversation processing pipeline for developers building AI-powered applications.

How to use MCP Service Framework?

Install dependencies with npm install @modelcontextprotocol/sdk express dotenv, configure environment variables (e.g., DeepSeek API key, weather API key), and start the main service with npm run start:prod. Invoke the chat endpoint by sending a POST /chat request with a JSON body containing a message and optional sessionId.

Key features of MCP Service Framework

  • Complete MCP protocol Server/Client communication model
  • Hot-pluggable service registration and invocation
  • Context-aware conversation management with automatic tool calling
  • Multi-turn dialogue state persistence
  • Request retry mechanism (default 3 times)
  • Unified error handling and service health monitoring

Use cases of MCP Service Framework

  • Integrate AI assistants with real‑time weather data retrieval
  • Build custom tool services that plug into an MCP-based conversation pipeline
  • Create multi‑turn chatbots with context retention and dynamic tool selection
  • Develop and test new MCP tools using the provided service template

FAQ from MCP Service Framework

What transport protocol does MCP Service Framework use?

The framework uses the Stdio transport protocol for service communication.

Does MCP Service Framework support custom tool development?

Yes. You can create new MCP services by following the service template that defines tools with JSON Schema for input/output and registers them via MCP request handlers.

What are the performance constraints for tool calls?

Single tool invocation must respond in under 2 seconds. Error retry intervals are 500ms, 1000ms, and 1500ms. The maximum context retained is 5 dialogue turns.

How does the framework handle service errors?

It uses standard MCP error codes, performs automatic retries (default 3 times), and provides unified error handling across all services.

Are there any authentication or environment requirements?

The framework requires configuration of DeepSeek API credentials and optionally a weather API key. No built-in authentication or authorization layer is described beyond the environment variable setup.

来自「媒体与设计」的更多内容