Mimory MCP Focusjs

MCP运维云端

提供方 MimoryInc

运维云端 未标注 无需鉴权 社区 / 第三方

一个TypeScript库,为MCP客户端提供聚焦强制包装器,实现细粒度的工具访问控制和参数验证。

一句话选型结论

按资料字段整理

Mimory MCP Focusjs 属于运维云端类 MCP 服务器,传输方式未标注,无需鉴权,没有现成安装命令,需按官方文档接入。接入前先确认权限范围;涉及写入、删除或付款的操作,建议先在测试环境验证。

分类运维云端 传输方式未标注 鉴权无需鉴权 部署方式未标注
GitHub 星标 0 仓库热度,无公开仓库时显示未标注
工具数 未标注 暴露给模型的工具数量
资源 / 提示词 0 / 0 资源与提示词模板数量
维护方 社区 / 第三方 核验等级 仅资料核对

工具与能力

运维云端
数量来自来源目录的标注,具体工具清单以官方文档为准
工具数量未标注暴露给模型可调用的工具个数
资源数量0可读取的资源条目
提示词数量0内置提示词模板数量

能力标签

适用场景

TypeScript库TypeScript本地部署访问控制参数验证JWT集成MCP兼容

安装与配置

未标注 无需鉴权
上游未给出传输方式
  1. 1
    准备运行环境

    按官方文档确认运行环境(常见为 Node.js 或 Python),装好后再执行安装命令。

  2. 2
    安装服务

    复制上面的安装命令执行;命令里带占位符的位置,换成自己的密钥或路径。

  3. 3
    写入客户端配置

    在客户端的 MCP 配置里填好启动命令和参数,保存后完全退出客户端再打开,让新配置生效。

  4. 4
    验证是否可用

    连接成功后随便调一个只读工具,确认能返回结果,再接入正式流程。

典型使用场景

3 类
按分类与标签整理的常见用法,具体以官方文档为准
云资源查询

查实例、存储、账单等云上资源状态。

部署与发布

把部署、重启、回滚这类操作接进对话。

监控与告警

拉取监控指标,异常时让模型帮你判断。

选择建议

选之前先看这几条
按条目字段给出的判断,不替你决定用不用

值得选的地方

  • 资料标注无需鉴权,装好就能连。

先想清楚的地方

  • 没有现成安装命令,需要按官方文档自己填启动命令和参数。
  • 资料没标注工具数量,实际能力要装好后确认。
  • 版本更新与行为细节以官方仓库为准。

更适合

  • 需要在运维云端场景里让模型直接调用外部能力的人。
  • 想先快速试一下、能接受在本地或自有环境跑服务的人。

不太适合

  • 需要厂商级 SLA 和技术支持的生产环境。

同类对比

6 个同类
同分类里挑最接近的几条,字段以各自详情页为准
MCP 服务器工具数传输方式部署方式安装命令最后核验
Mimory MCP Focusjs当前 未标注 未标注 未标注 无 2026-05-17
lobehub 未标注 stdio · 本地进程 本地部署 有 2026-04-11
TrendRadar 未标注 stdio · 本地进程 本地部署 有 2026-04-13
Ui Tars Desktop 8a825770 未标注 stdio · 本地进程 本地部署 有 2026-05-17
ruflo 未标注 stdio · 本地进程 本地部署 有 2026-04-13
FastGPT 未标注 stdio · 本地进程 本地部署 有 2026-04-11

服务器档案

运维云端
字段来自项目仓库与公开索引,中文说明由本站标注
提供方MimoryInc上游标注的维护方 MimoryInc
分类运维云端本站按上游分类展示
连接方式未标注上游未给出传输方式
鉴权方式无需鉴权远程服务建议用最小权限凭据
维护方社区 / 第三方核验等级 仅资料核对
包名 / 运行时未标注 · 未标注本地安装时用到的包标识与运行时
部署类型未标注上游给出的部署形态
最近核验2026-05-17上游最后核验时间

详细介绍

8.8 KB
来自项目仓库与上游目录的原文,未做删改

一个TypeScript库,为MCP(模型上下文协议)客户端提供强制焦点的包装器,实现对工具访问和参数验证的细粒度控制。

特点/特性

  • 重点执法控制可以调用哪些工具以及允许使用哪些参数
  • JWT 集成从JWT令牌中提取焦点规则,以实现基于令牌的安全访问控制
  • 灵活配置支持基于简单参数和复合焦点配置的配置
  • TypeScript 支持全面支持TypeScript,配备完整的类型定义
  • 与MCP兼容与基础MCP客户端实现无缝工作

未来工作

  • 全面MCP覆盖集中所有MCP功能,包括资源、提示等
  • 改进后的对焦功能更精确的模式匹配以强化焦点控制
  • 更便捷的JWT集成已签名的JWT,即使不作为访问令牌使用,也应自动更新上下文

安装```bash

npm install mimory-mcp-focusjs


## 快速入门

### 使用工厂函数(推荐)```typescript
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { focusClientSimple, focusClientComposite } from "mimory-mcp-focusjs";

// Create your MCP client
const client = new Client(/* your MCP client configuration */);

// Simple focus using factory function
const simpleFocusedClient = focusClientSimple(
client,
["echo", "add"], // focus_tools
{
message: ["hello", "world"], // focus_params
a: ["range:1-100"],
b: ["range:1-100"]
},
false // strict mode
);

// Composite focus using factory function
const compositeFocusedClient = focusClientComposite(
client,
{
"echo": {
message: ["hello", "world"],
priority: ["range:1-10"]
},
"add": {
a: ["range:1-100"],
b: ["range:1-100"]
}
},
false // strict mode
);

// Use the focused clients - they will automatically enforce your rules
const tools = await simpleFocusedClient.listTools(); // Only returns allowed tools
const result = await simpleFocusedClient.callTool({
name: "add",
arguments: { a: 5, b: 10 } // Will succeed
});

使用 withFocus(旧版)```typescript

import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { withFocus } from "mimory-mcp-focusjs";

// Create your MCP client
const client = new Client(/ your MCP client configuration /);

// Apply focus rules
const focusedClient = await withFocus(client, {
focusTools: ["echo", "add"], // Only allow these tools
focusParams: {
message: ["hello", "world"], // Only allow these values for 'message' parameter
a: ["range:1-100"], // Only allow values between 1-100 for 'a' parameter
b: ["range:1-100"]
},
strict: true // Enforce all parameters must be in focus rules
});

// Use the focused client - it will automatically enforce your rules
const tools = await focusedClient.listTools(); // Only returns allowed tools
const result = await focusedClient.callTool({
name: "add",
arguments: { a: 5, b: 10 } // Will succeed
});


## API 参考文档

### 工厂函数(推荐)

#### `focusClientSimple()`

使用基于简单参数的配置创建一个专注的客户端。```typescript
function focusClientSimple(
client: Client,
focusTools?: string[],
focusParams?: Record,
strict: boolean = false
): FocusedClient

参数:

  • client底层的MCP客户端
  • focusTools允许使用的工具名称数组(默认: ["*"])
  • focusParams将对象参数名称映射到允许的值
  • strict如果为真,则所有参数必须在焦点规则中定义

focusClientComposite()

使用复合配置创建一个专注的客户端。```typescript
function focusClientComposite(
client: Client,
focus?: Record>,
strict: boolean = false
): FocusedClient


**参数:**

- `client`底层的MCP客户端
- `focus`复合焦点配置对象
- `strict`如果为真,则所有参数必须在焦点规则中定义

#### `refocusClientSimple()`

更新简单聚焦客户端的焦点规则。```typescript
function refocusClientSimple(
client: FocusedClient,
focusTools: string[],
focusParams: Record,
strict: boolean
): void

refocusClientComposite()

更新组合焦点客户端的焦点规则。```typescript
function refocusClientComposite(
client: FocusedClient,
focus: Record>,
strict: boolean
): void


### 核心类

#### `FocusedClient`

统一的焦点客户端类,能够处理简单和复合焦点类型。```typescript
class FocusedClient {
constructor(
client: Client,
focus: Record,
focusType: string
)

refocus(focus: Record, focusType: string): void
}

FocusClient (遗产)

一个通过简单参数配置来强制MCP客户端遵循焦点规则的封装器。```typescript
class FocusClient {
constructor(
client: Client,
focusTools: string[] = ["*"],
focusParams: Record = {},
strict: boolean = false
)
}


**参数:**

- `client`底层的MCP客户端
- `focusTools`允许使用的工具名称数组(使用 `["*"]` (适用于所有工具)
- `focusParams`将对象映射参数名称到允许的值
- `strict`如果为真,则所有参数必须在焦点规则中定义

#### `FocusClientComposite` (遗产)

一个使用组合配置对象来强制执行焦点规则的包装器。```typescript
class FocusClientComposite {
constructor(
client: Client,
focus: FocusComposite = {},
strict: boolean = false
)
}

参数:

  • client底层的MCP客户端
  • focus复合焦点配置对象
  • strict如果为真,则所有参数必须在焦点规则中定义

实用函数

withFocus()

便捷功能,用于创建一个带有自动配置检测的专注客户端。```typescript
async function withFocus(
client: Client,
opts: {
focusTools?: string[];
focusParams?: FocusParams;
focus?: FocusComposite;
strict?: boolean;
}
): Promise


#### 实用函数

##### `checkToolArgsFocus()`

检查工具参数是否符合焦点规则。```typescript
function checkToolArgsFocus(
tool: string,
args: Record,
focus: any,
focusType: string
): { isValid: boolean; errorResult?: any }
filterToolsFocus()

基于焦点规则的过滤工具。```typescript
function filterToolsFocus(
tools: any[],
focus: any,
focusType: string
): any[]


#### JWT 集成

##### `extractMCPContextJWT()`

从JWT令牌中提取焦点规则。```typescript
async function extractMCPContextJWT(
jwtToken: string,
jwtKey: string,
jwtSigningAlgorithm: string,
parameterField: string = 'context',
toolField: string = 'tools',
strict: boolean = false
): Promise<{ contextParams: FocusParams; toolsAllowed: FocusTools }>
extractMCPCompositeContextJWT()

从JWT令牌中提取复合焦点配置。```typescript
async function extractMCPCompositeContextJWT(
jwtToken: string,
jwtKey: string,
jwtSigningAlgorithm: string,
compositeContextField: string
): Promise


### 类型定义```typescript
type FocusComposite = Record>;
type FocusParams = Record;
type FocusTools = string[];
type Primitive = string | number | boolean;

焦点规则

参数值

焦点规则支持多种值类型:

  • 确切值: "hello", "world"
  • 通配符: "*" (允许任何值)
  • 范围: "range:1-100" (允许输入范围内的数值)
  • 数组: ["value1", "value2"] (允许列表中的任意值)

示例```typescript

// Simple parameter focus
const focusParams = {
message: ["hello", "world"], // Only allow these exact values
count: ["range:1-10"], // Allow numbers 1-10
enabled: ["true", "false"], // Allow boolean strings
any: "*" // Allow any value
};

// Composite focus
const focusComposite = {
"echo": { // Specific rules for 'echo' tool
message: ["hello", "world"],
priority: ["range:1-5"]
},
"add": { // Specific rules for 'add' tool
a: ["range:1-100"],
b: ["range:1-100"]
}
};


## JWT 集成示例```typescript
import { extractMCPContextJWT, focusClientSimple } from "mimory-mcp-focusjs";

// Extract focus rules from JWT
const { contextParams, toolsAllowed } = await extractMCPContextJWT(
jwtToken,
secretKey,
"HS256",
"context", // JWT field containing parameters
"tools"    // JWT field containing allowed tools
);

// Apply the extracted rules using factory function
const focusedClient = focusClientSimple(
client,
toolsAllowed,
contextParams,
true // strict mode
);

错误处理

图书馆抛出(或:图书馆推出) FocusError 对于与焦点相关的违规行为:```typescript
try {
await focusedClient.callTool({
name: "unauthorized_tool",
arguments: { message: "hello" }
});
} catch (error) {
if (error instanceof FocusError) {
console.log("Focus violation:", error.message);
}
}


## 示例

查看 `examples/` 完整工作示例的目录:

- `basic-usage.ts` - 基础焦点客户端使用(传统方法)
- `jwt-integration.ts` 基于JWT的焦点提取
- `composite-focus.ts` - 复合焦点配置(传统方法)
- `everything-mcp-server.ts` - 与Everything MCP服务器的集成

## 发展```bash
# Install dependencies
npm install

# Build the library
npm run build

许可证

麻省理工学院(MIT)

贡献

欢迎贡献!请随时提交拉取请求。

支持

如需支持,请在此提交问题 GitHub。

常见问题

5 问
答案由本站依据条目字段整理,不引用上游原文
Mimory MCP Focusjs 怎么安装?

资料没有给出安装命令,请到官方仓库或文档按说明接入;这类条目多数是生态应用,或尚未发布可安装包。

Mimory MCP Focusjs 怎么在客户端里配置?

它的传输方式未标注,在客户端 MCP 配置里按官方文档填写启动命令和参数,保存后重启客户端生效。

Mimory MCP Focusjs 收费吗?

本站不代收费用,也没有标注具体价格。是否收费取决于服务本身和背后的接口额度,正式使用前按官方说明确认。

Mimory MCP Focusjs 需要 API Key 吗?

资料标注为无需认证,装好就能连;如果实际调用时报鉴权错误,按官方文档补上凭据。

Mimory MCP Focusjs 能提供哪些能力?

资料显示能力标签包括 TypeScript、访问控制、云端部署。具体工具清单以官方文档为准。

热门专题

按标签挑服务器
全部专题 →

服务器信息以作者仓库与官方文档为准;分类、传输方式与鉴权方式的中文说明为中文整理,最近核验 2026-05-17。