Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
E

easy-mcp

> 编程语言
Open source

Absurdly easy Model Context Protocol Servers in Typescript

196 stars0 likes1 views
WebsiteGitHub

About

Absurdly easy Model Context Protocol Servers in Typescript

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:

bash
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.

typescript
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

…

Quick Start with Express-like API

Also see examples/example-minimal.ts or run bun start:express

This API is more verbose and less magical, but it's more stable and tested.

…

Express-Like API

EasyMCP.create(name: string, options: ServerOptions)

Creates a new EasyMCP instance.

  • name: The name of your MCP server.
  • options: Server options, including the version.

mcp.resource(config: ResourceConfig)

Defines a resource.

mcp.template(config: ResourceTemplateConfig)

Defines a resource template.

mcp.tool(config: ToolConfig)

Defines a tool.

mcp.prompt(config: PromptConfig)

Defines a prompt.

mcp.root(config: Root)

Defines a root.

mcp.serve()

Starts the MCP server.

(Experimental) Decorator API

EasyMCP provides decorators for a more concise and declarative way to define your MCP server components. Here's an overview of the available decorators:

@Tool(config?: ToolConfig)

Defines a method as a tool. The method will take in any arguments you declare and infer types and input configurations based on your TS annotations. An optional context argument can be added as the last argument to access MCP capabilities.

  • config: Optional configuration object for the tool.
    • description: Optional description of the tool.
    • optionals: Optional array of parameter names that should be marked as optional.
    • parameters: Optional array of parameter definitions for full control over the input schema.

Example:

typescript
@Tool({
  description: "Greets a person",
  optionals: ["title"],
})
greet(name: string, title?: string, optionalContext: Context) {
  return `Hello, ${title ? title + " " : ""}${name}!`;
}

@Resource(uri: string, config?: Partial)

Defines a method as a resource or resource template. A resource template is defined by using handlebars in the URI.

  • uri: The URI or URI template for the resource.
  • config: Optional configuration object for the resource.
    • name: Optional name for the resource.
    • description: Optional description of the resource.
    • mimeType: Optional MIME type of the resource.

Example:

typescript
@Resource("greeting/{name}")
getGreeting(name: string) {
  return `Hello, ${name}!`;
}

@Prompt(config?: PromptDefinition)

Defines a method as a prompt.

  • config: Optional configuration object for the prompt.
    • name: Optional name for the prompt (defaults to method name).
    • description: Optional description of the prompt.
    • args: Optional array of argument definitions.

Example:

typescript
@Prompt({
  description: "Generates a greeting prompt",
  args: [
    { name: "name", description: "Name to greet", required: true },
  ],
})
greetingPrompt(name: string) {
  return `Generate a friendly greeting for ${name}.`;
}

@Root(uri: string, config?: { name?: string })

Defines a root directory for the MCP server. This decorator is applied to the class, not to a method.

  • uri: The URI of the root directory.
  • config: Optional configuration object.
    • name: Optional name for the root.

Example:

typescript
@Root("/my-sample-dir/photos")
@Root("/my-root-dir", { name: "My laptop's root directory" })
class MyMCP extends EasyMCP {
  // ...
}

When using decorators, EasyMCP will automatically infer types and create appropriate configurations for your tools, resources, prompts, and roots. This can significantly reduce boilerplate code and make your MCP server definition more concise.

But... the decorator API is experimental and may have bugs or unexpected changes

Contributing

Contributions are welcome! Just submit a PR.

License

This project is licensed under the MIT License.

Credits

EasyMCP was created by Zach Caceres but inspired by FastMCP by kjlowin, a library for Python MCP servers.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

TypeScriptaibunclaudeclaude-ai

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言