Token导航 LogoToken导航TokenDH.com
E MCP logo
开发工具stdio官方级别未说明来源级核验

E MCP

MCP Server

A framework for building simple MCP servers with custom middleware

工具数

1

提示词数

0

GitHub Stars

11

资源数

0
服务器开发TypeScript开发工具

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

joeymeere

提供方

joeymeere

最后核验

2026/5/18 03:29

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

电磁兼容性计划

叉子 LiteMCP TS库具有内置身份验证处理和自定义中间件等扩展功能。

特性

这被设计为LiteMCP等工具的近乎直接的替代品。因此,所有添加的功能目前都是可选的。

  • 当前LiteMCP的所有功能
  • 内置身份验证处理程序
  • 自定义分层中间件支持

快速启动

通过Bun或NPM安装:

npm i emcp
# or use Bun (preferred)
bun add emcp

基本用法

(可选)运行示例:

bun run example:basic
bun run example:auth
bun run example:middleware
bun run example:advanced
const server = new eMCP("mcp-server-with-auth", "1.0.0", {
  authenticationHandler: async (request) => {
    // implement your custom auth logic here
    return true;
  },
});

// Request to this tool, or any other resource or prompt will
// require authentication governed by the handler
server.addTool({
  name: "add",
  description: "Add two numbers",
  parameters: z.object({
    a: z.number(),
    b: z.number(),
  }),
  execute: async (args) => {
    server.logger.debug("Adding two numbers", args);
    return args.a + args.b;
  },
});

自定义中间件

const server = new eMCP("mcp-server-with-middleware", "1.0.0", {
  authenticationHandler: async (request) => {
    // implement your custom auth logic here
    return true;
  },
});

// This will time entire req -> res cycle, including middlewares
server.use(async (request, next) => {
  const startTime = Date.now();
  server.logger.debug("Request started", { method: request.method });

  // Wait for all inner middleware and the handler to complete
  const response = await next();

  const endTime = Date.now();
  server.logger.debug("Request completed", {
    method: request.method,
    duration: `${endTime - startTime}ms`,
  });

  return response;
});

中间件的工作原理

eMCP中的中间件按注册顺序运行。一旦每个中间件处理程序都命中了它 next() 则将进行标准MCP程序。一旦服务器完成处理,那么中间件处理程序的顺序将反向运行,并在 next() 块。

简单地说,它看起来像这样:


4. Server handler

5. Middleware 2
6. Middleware 1
---- Response sent ---->

如果你熟悉像Hono这样的框架,那么这对你来说就很熟悉了。

路线图

  • 符合人体工程学的MCP\MCP通信
  • 融入框架

为什么?

因为我喜欢

目录标签

目录标签

服务器开发TypeScript开发工具developer-toolsmcpmodel-context-protocol认证处理本地部署自定义中间件TypeScript库

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

1

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP