MCP服务器框架

MiniMCP是一个使用Deno和TypeScript构建的轻量级声明式MCP服务器框架,允许AI应用调用自定义工具、资源和提示模板。

  • by thewizster
  • TypeScript
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 thewizster/MiniMCP

使用说明

MiniMCP

一个用Deno和TypeScript构建的小型声明性MCP服务器。定义工具、资源和提示 在普通对象中——没有样板。

快速开始

# 1. Install Deno (if needed)
curl -fsSL https://deno.land/install.sh | sh

# 2. Clone & run
git clone https://github.com/thewizster/MiniMCP.git
cd MiniMCP
deno task start

这是什么?

MCP(模型上下文协议) 让像Claude这样的AI应用程序调用你的代码。MiniMCP使建筑成为 MCP服务器尽可能简单:

import { MiniMCP } from "./src/server.ts";

const mcp = new MiniMCP("my-server");

mcp.addTool({
  name: "greet",
  description: "Say hello",
  inputs: { name: { type: "string", description: "Who to greet" } },
  handler: ({ name }) => `Hello, ${name}!`,
});

mcp.start();

就是这样。三个概念,一个API:

概念 功能 方法
工具 AI可以调用的函数 addTool()
资源 AI可以读取的数据 addResource()
提示 AI可以使用的模板 addPrompt()

项目结构

MiniMCP/
├── src/
│   ├── server.ts          # MiniMCP helper class (the framework)
│   ├── index.ts            # Example server using the API
│   └── server_test.ts      # Tests
├── deno.json               # Tasks and config
├── GETTING_STARTED.md       # Setup guide
└── README.md

使用Claude Desktop进行测试

添加到您的Claude桌面配置 (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "minimcp": {
      "command": "deno",
      "args": ["run", "--allow-all", "/full/path/to/MiniMCP/src/index.ts"]
    }
  }
}

或使用MCP检查器:

npx @modelcontextprotocol/inspector deno run --allow-all src/index.ts

Deno任务

deno task start   # Run the server
deno task dev     # Run with auto-reload
deno task lint    # Lint
deno task fmt     # Format
deno task check   # Type-check
deno task test    # Run tests

文档

链接

许可证

麻省理工学院