
zcaceres/easy-mcp
Developer toolsЭта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал
zcaceres/easy-mcp — это кандидат для MCP-сервера, импортированный из https://github.com/zcaceres/easy-mcp.
Обзор
zcaceres/easy-mcp — это кандидат для MCP-сервера, импортированный из https://github.com/zcaceres/easy-mcp.
Обзор (машинный перевод)
EasyMCP пригоден, но он находится в бета-версии. Пожалуйста, сообщайте о любых возникнутых проблемах.
EasyMCP — это самый простой способ создания серверов Model Context Protocol (MCP) в TypeScript.
Он скрывает сантехнику, форматирование и другие шаблонные определения за простыми декларациями.
Easy MCP позволяет определить минимум необходимого для начала. Или можно определить более сложные ресурсы, шаблоны, инструменты и подсказки.
Особенности
- Простой API, похожий на Express: EasyMCP предоставляет высокоуровневый, интуитивно понятный API. Определяйте инструменты, подсказки, ресурсы, шаблоны ресурсов и корни с помощью вызовов, аналогичных определению конечных точек в ExpressJS. Каждый возможный параметр, который может быть необязательным, является необязательным и скрытым, если только он не нужен.
- API Experimental Decorators: Автоматически выводит аргументы инструментов, запросов и ресурсов. Определение схемы ввода не требуется!
- Объект контекста: Доступ к возможностям MCP, таким как логирование и отчётность о прогрессе, через объект контекста в ваших инструментах.
- Отличная безопасность типа: Лучшая диагностика и меньше ошибок во время выполнения.
Ограничения бета
- Пока нет поддержки MCP-сэмплинга
- Поддержки SSE пока нет.
- Пока нет уведомлений об обновлении ресурсов
Эта страница переведена автоматически. Технические детали смотрите в оригинале.
README
Показан фрагмент оригинального README. Открыть оригинал.
easy-mcp
EasyMCP is usable but in beta. Please report any issues you encounter.
EasyMCP is the simplest way to create Model Context Protocol (MCP) servers in TypeScript.
It hides the plumbing, formatting, and other boilerplate definitions behind simple declarations.
Easy MCP allows you to define the bare minimum of what you need to get started. Or you can define more complex resources, templates, tools, and prompts.
Features
- Simple Express-like API: EasyMCP provides a high-level, intuitive API. Define Tools, Prompts, Resources, Resource Templates, and Roots with calls similar to defining endpoints in ExpressJS. Every possible parameter that could be optional is optional and hidden unless you need it.
- Experimental Decorators API: Automagically infers tool, prompt, and resource arguments. No input schema definition required!
- Context Object: Access MCP capabilities like logging and progress reporting through a context object in your tools.
- Great Type Safety: Better DX and fewer runtime errors.
Beta Limitations
- No support for MCP sampling, yet
- No support for SSE, yet
- No resource update notifications, yet
- Prompts technically accept inputs, but the Typescript SDK suggests they can’t. So this functionality feels unfinished.
Installation
To install EasyMCP, run the following command in your project directory:
bun install
Quick Start with (Experimental) Decorators API
Also see examples/express-decorators.ts or run bun start:decorators
EasyMCP’s decorator API is dead simple and infers types and input configuration automatically.
But it’s experimental and may change or have not-yet-discovered problems.
import EasyMCP from "./lib/EasyMCP";
import { Tool, Resource, Prompt } from "./lib/experimental/decorators";
class MyMCP extends EasyMCP {
@Resource("greeting/{name}")
getGreeting(name: string) {
return `Hello, ${name}!`;
}
@Prompt()
greetingPrompt(name: string) {
return `Generate a greeting for ${name}.`;
}
@Tool()
greet(name: string, optionalContextFromServer: Context) {
optionalContextFromServer.info(`Greeting ${name}`);
return `Hello, ${name}!`;
}
}
const mcp = new MyMCP({ version: "1.0.0" });
Complex Example with Decorators API
See examples/express-express.ts or run bun start:express
import EasyMCP from "./lib/EasyMCP";
import { Prompt } from "./lib/decorators/Prompt";
import { Resource } from "./lib/decorators/Resource";
import { Root } from "./lib/decorators/Root";
import { Tool } from "./lib/decorators/Tool";
@Root("/my-sample-dir/photos")
@Root("/my-root-dir", { name: "My laptop's root directory" }) // Optionally you can name the root
class ZachsMCP extends EasyMCP {
/**
You can declare a Tool with zero configuration. Relevant types and plumbing will be inferred and handled.
By default, the name of the Tool will be the name of the method.
*/
Установка
This server does not publish a one-line install command.
Open the repository installation guide Новичок в MCP? Начните с руководства на mcpskill.org →