generic-mcp-server
일반 MCP 서버 템플릿
사용자 정의 및 확장이 용이하도록 설계된 모듈식 확장 가능 모델 컨텍스트 프로토콜(MCP) 서버 템플릿입니다.
특징
모듈형 아키텍처 : 명확하게 정의된 구조를 통해 관심사를 명확하게 분리
작고 집중된 파일 : 유지 관리가 더 쉽고 AI가 수집하기 더 쉽습니다.
간편한 확장 포인트 : 새로운 도구와 서비스를 추가하기 위한 간단한 패턴
포괄적인 오류 처리 : 코드베이스 전체에 걸친 강력한 오류 관리
유형 안전성 : 적절한 타이핑을 통한 전체 TypeScript 지원
Related MCP server: Swagger MCP
프로젝트 구조
지엑스피1
시작하기
필수 조건
Node.js 18 이상
npm 또는 yarn
설치
이 저장소를 복제하세요:
git clone https://github.com/v4lheru/generic-mcp-template.git cd generic-mcp-template종속성 설치:
npm install.env.example기반으로.env파일을 만듭니다.cp .env.example .envAPI 키와 구성을 사용하여
.env파일을 편집합니다.
건물과 운영
프로젝트를 빌드하세요:
npm run build서버를 실행합니다:
npm start
템플릿 확장
새로운 서비스 추가
src/services/에 새로운 서비스 파일을 만듭니다.// src/services/my-service.ts import { BaseService } from './base-service.js'; import config from '../config.js'; export class MyService extends BaseService { // Implement your service... }src/types/에 필요한 유형을 추가합니다.
새로운 도구 추가
새 파일에 도구를 정의하거나
src/tools/에 있는 기존 도구를 확장합니다.// src/tools/my-tools.ts export const myTools = [ { name: "my_tool", description: "Description of my tool", inputSchema: { // JSON Schema for the tool's input } } ];도구에 대한 핸들러를 구현합니다.
// src/tools/my-tool-handlers.ts import { MyService } from '../services/my-service.js'; export function createMyToolHandlers(myService: MyService) { return { my_tool: async (args: any) => { // Implement your tool handler } }; }src/index.ts에 도구와 핸들러를 등록합니다.
구성
이 템플릿은 src/config.ts 의 중앙 집중식 구성 시스템을 사용합니다. 구성은 다음을 통해 제공될 수 있습니다.
환경 변수
명령줄 인수(
--env KEY=VALUE사용)코드의 기본값
오류 처리
템플릿에는 포괄적인 오류 처리가 포함되어 있습니다.
속도 제한 지원을 통한 서비스 수준 오류 처리
적절한 오류 메시지를 통한 도구 수준 오류 처리
MCP 프로토콜 오류 처리
특허
MIT
Available Tools
2 toolscalculate-sumB
Calculates the sum of two numbers
| Name | Required | Description | Default |
|---|---|---|---|
| a | Yes | The first number | |
| b | Yes | The second number |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. While 'calculates' implies a read-only operation, the description doesn't address important behavioral aspects like error handling (e.g., overflow, invalid inputs), performance characteristics, or whether the operation has side effects. For a tool with zero annotation coverage, this represents a significant gap in behavioral context.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is perfectly concise at just one sentence that directly states the tool's function. There's zero wasted language, no unnecessary elaboration, and the information is front-loaded effectively. Every word earns its place in this minimal but complete statement of purpose.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's low complexity (simple arithmetic operation), 100% schema coverage, and no output schema, the description is minimally adequate. However, it lacks information about return values (though no output schema exists), error conditions, or limitations (e.g., numeric range constraints). For a basic calculation tool, this represents the minimum viable description but with clear gaps in completeness.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, with both parameters 'a' and 'b' clearly documented as 'the first number' and 'the second number' respectively. The description adds no additional parameter semantics beyond what the schema already provides. According to the scoring rules, when schema_description_coverage is high (>80%), the baseline is 3 even with no parameter information in the description.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose with a specific verb ('calculates') and resource ('sum of two numbers'). It distinguishes from the sibling tool 'get-weather' by focusing on mathematical calculation rather than weather data retrieval. However, it doesn't explicitly differentiate from potential mathematical sibling tools, which prevents a perfect score.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives. There's no mention of when-not-to-use scenarios or comparison with other calculation tools. The only implied usage is for summing two numbers, but this is basic and doesn't help an agent make informed decisions about tool selection.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get-weatherC
Get weather forecast for a city
| Name | Required | Description | Default |
|---|---|---|---|
| city | Yes | The city name |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions 'Get weather forecast' but doesn't specify details like data freshness, rate limits, error handling, or authentication needs. This leaves significant gaps in understanding how the tool behaves beyond its basic function.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that directly states the tool's purpose without any wasted words. It is appropriately sized and front-loaded, making it easy to parse quickly.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the lack of annotations and output schema, the description is incomplete. It doesn't explain what the weather forecast includes (e.g., temperature, conditions), potential limitations, or return format. For a tool with no structured behavioral data, more context is needed to fully understand its operation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 100% description coverage, with the 'city' parameter fully documented. The description implies the parameter's use ('for a city') but adds no additional meaning beyond what the schema provides, such as format examples or constraints. This meets the baseline for high schema coverage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose with a specific verb ('Get') and resource ('weather forecast for a city'), making it immediately understandable. However, it doesn't differentiate from sibling tools, as 'calculate-sum' is unrelated, so no sibling distinction is needed or provided.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives, such as other weather-related tools or data sources. It only states what the tool does, without context for its application or prerequisites.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
2 tool updates
- First observed
calculate-sum - First observed
get-weather
TDQS
Scored across 2 tools
The two tools have completely distinct purposes: calculate-sum performs a mathematical operation on numbers, while get-weather retrieves weather data for a city. There is no overlap or ambiguity between these functions, making it impossible for an agent to confuse them.
The tool names use a verb-noun pattern (calculate-sum, get-weather), which is consistent in structure. However, they use different verb styles (calculate vs. get) and a hyphen delimiter, which is readable but shows minor deviation in convention.
With only 2 tools, the server feels thin and under-scoped for a generic purpose. This minimal set lacks coverage for typical operations in any specific domain, making it inappropriate for most agent workflows.
The tool surface is severely incomplete for a generic server. There are major gaps in functionality, such as missing basic CRUD operations, data processing tools, or domain-specific coverage, which will likely cause agent failures in practical use.
Maintenance
Related MCP Connectors
A full backend your AI coding agent can set up over MCP
MCP server unifying ERPs, CRMs, APIs and knowledge base for Claude, ChatGPT and Gemini.
Host any HTTP API as a standard MCP server; auto-distribute to 12+ mainstream agent platforms.
AI-native mock API server with MCP. Create REST/SOAP mocks from Claude, Cursor, or Windsurf.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAutomatically converts any OpenAPI specification or Postman Collection into an MCP server, enabling AI assistants like Claude to directly interact with REST APIs without writing any code.Apache 2.0
- FlicenseNot gradedqualityDmaintenanceAutomatically converts Swagger/OpenAPI specifications into MCP servers, enabling AI agents to interact with any REST API through natural language by exposing endpoints as AI-friendly tools.3-
- AlicenseNot gradedqualityBmaintenanceOne command to turn any codebase into an MCP server. Not just REST APIs. Not just OpenAPI specs.55Apache 2.0
- FlicenseNot gradedqualityDmaintenanceConverts any Swagger/OpenAPI specification into an MCP server, enabling AI assistants to intelligently query API endpoints, schemas, and generate code examples.18-