Token导航 LogoToken导航TokenDH.com
Sim MCP Js logo
运维云端stdio官方级别未说明来源级核验

Sim MCP Js

MCP Server

@modelcontextprotocol/inspector

一个最小化、符合MCP标准的框架,用于LLM工具、脚本和自动化。

工具数

3

提示词数

0

GitHub Stars

0

资源数

0
LLM工具JavaScript本地部署

安装说明

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

作者 / 组织

Sivx

提供方

Sivx

最后核验

2026/5/17 20:19

运行时

Node.js

快速接入

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

命令预览

npx @modelcontextprotocol/inspector tsx yourfile.ts

详细介绍

sim-mcp

LLM工具、脚本和自动化的最小MCP兼容框架。

______________________________________________________________________

安装

npm install sim-mcp
npm install -D typescript tsx
npm install -g @modelcontextprotocol/inspector   # (Optional) For MCP stdio testing

______________________________________________________________________

用法

import { toolsJson, ChatAssistant, isMCP } from "sim-mcp";

/** Input for weather info for a city */
export interface WeatherInput {
  /** Name of the city */
  name: string;
}

/**
 * Get weather info for a city.
 * @param wi Weather input
 * @returns Weather description string
 */
export async function Weather(wi: WeatherInput) {
  return `The weather in ${wi.name} is sunny with 75°F.`;
}

/** Input for greeting */
export interface GreetInput {
  /** Name of the person to greet */
  name: string;
}

/**
 * Return a friendly greeting for a user.
 * @param gi Greeting input
 * @returns Greeting string
 */
export function Greet(gi: GreetInput) {
  return `Hello, ${gi.name}!`;
}

/** No input for random city generation */
export interface RandomCityInput {}

/**
 * Generate a random city name using the LLM.
 * @returns City name string
 */
export async function RandomCity(_: RandomCityInput) {
  const bot = new ChatAssistant();
  const res = await bot.solo("Suggest a random city name.");
  return res.text || "Unknown City";
}

const allTools = toolsJson([Weather, Greet, RandomCity]);
const greetTool = toolsJson([Greet]);

if (!isMCP()) {
  (async () => {
    const bot = new ChatAssistant({
      instructions: "Concise and helpful.",
      tools: allTools,
    });

    // PROMPT: User-driven Q&A loop
    let res;
    do {
      res = await bot.prompt("Ask about weather, greeting, or type 'exit':");
      if (res.text) console.log("Assistant:", res.text);
    } while (res.type !== "exit");

    // CHAINING: Use RandomCity, then Weather
    const city = await bot.decide("Pick a random city.");
    if (city.error || !city.result) {
      console.log("Error getting random city.");
      return;
    }
    const weather = await bot.decide(`What's the weather in ${city.result}?`);
    if (weather.error) {
      console.log("Error getting weather.");
      return;
    }
    console.log(`Random city: ${city.result}\nWeather: ${weather.text}`);

    // DISCUSS: LLM-only chat (no tools)
    const chatRes = await bot.discuss(
      "Tell me something interesting about the world's capitals."
    );
    console.log("Discuss:", chatRes.text);

    // DECIDE with custom tool set: only greet
    const greetRes = await bot.decide("Say hello to Alex.", {
      tools: greetTool,
    });
    console.log("Decide (greet only):", greetRes.text);
  })();
}

______________________________________________________________________

辅助方法

方法用例工具调用用户输入仅限LLM描述
prompt交互式问答/用户驱动聊天用户键入问题,助手回答(有或没有工具)
decide强制工具调用(仅函数调用)LLM _必须_ 使用工具回答提示
chat通用(工具或文本,由LLM决定)可选LLM可以自由回答或调用工具(如果它决定)
solo一次性,仅LLM响应(不使用工具)始终是一个LLM文本回复,没有函数调用
discuss聊天/讨论模式(不允许使用工具)无工具调用的对话、摘要或信息
  • 所有方法都接受以下选项 { model, instructions, tools }.

______________________________________________________________________

API

  • toolsJson(tools: Function[])
  • ChatAssistant({ model?, instructions?, tools? })

- .prompt(message, options?) - .decide(message, options?) - .chat(message, options?) - .solo(message, options?) - .discuss(message, options?)

  • isMCP()

_默认导出_: { toolsJson, ChatAssistant, isMCP }

______________________________________________________________________

MCP工具测试

npx @modelcontextprotocol/inspector tsx yourfile.ts

______________________________________________________________________

环境

  • 使用 .env 在项目根 OPENAI_API_KEY 以及其他变量。
  • .env 是自动加载的。

______________________________________________________________________

关于

作者:丹·怀特黑德()\ 零配置,LLM和MCP的工具优先自动化。

______________________________________________________________________

许可证

麻省理工学院

目录标签

目录标签

LLM工具JavaScript本地部署自动化框架MCP兼容脚本工具

接入字段

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

stdio

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

none

运行时(runtime,运行环境)

Node.js

来源包(packageName,安装包名)

@modelcontextprotocol/inspector

工具数量(toolCount,工具数)

3

资源数量(resourceCount,资源数)

0

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

0

权限和风险

stdionone部署方式未说明

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

安装前确认

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

来源信息

继续浏览同类 MCP