@flink-app/mcp-plugin

中文文档
2.0.0-alpha.134发布于 2026/11/07MITTypeScriptCommonJS近 30 天下载 2185

Flink plugin that exposes Flink AI tools over MCP (Model Context Protocol) via Streamable HTTP

原始使用文档
文档目录9 节
  1. Install
  2. Usage
  3. Title and annotations
  4. Connecting from Claude Code
  5. Options
  6. Authentication
  7. How tool results map to MCP
  8. Plugin context
  9. Notes

@flink-app/mcp-plugin

Expose Flink AI tools as an MCP server so MCP clients — Claude Code, Claude Desktop, Cursor, custom agents — can call them over HTTP.

  • Uses the Streamable HTTP transport (stateless, load-balancer friendly), mounted on the Flink app's own Express server.
  • Tools are opt-in per tool via mcp: true.
  • Every call runs inside Flink's request context: the authenticated user and permissions flow into tools exactly as for agents, and the tool's declarative permissions are enforced.

Install

pnpm add @flink-app/mcp-plugin

Usage

import { FlinkApp } from "@flink-app/flink";
import { mcpPlugin } from "@flink-app/mcp-plugin";

const app = await new FlinkApp<AppCtx>({
    name: "My app",
    auth: jwtAuthPlugin({ ... }),
    plugins: [
        mcpPlugin({
            instructions: "Tools for looking up cars in the demo inventory.",
        }),
    ],
}).start();

Mark the tools you want to expose:

export const Tool: FlinkToolProps = {
    id: "search-cars-by-brand",
    description: "Search for cars by brand name.",
    inputSchema: z.object({ brand: z.string() }),
    permissions: ["car:read"],
    mcp: true, // 👈 visible over MCP
};

Tools without mcp: true stay internal to your agents.

Title and annotations

MCP clients decide how much friction to put in front of a tool call based on its annotations. Without them a client has to assume the worst, so even a pure lookup gets an approval prompt on every call. Set them on the Tool props together with an optional human readable title:

export const Tool: FlinkToolProps = {
    id: "get-order-outcome",
    title: "Order outcome",
    description: "Returns what was done with an order. Read-only.",
    mcp: true,
    annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: false },
};
HintMeaningMCP default
readOnlyHintThe tool does not modify its environment.false
destructiveHintThe tool may perform destructive updates (delete, overwrite).true (when not read-only)
idempotentHintRepeated calls with the same arguments have no additional effect.false
openWorldHintThe tool interacts with external entities (web, third-party APIs).true

Both fields are passed through to tools/list as-is and omitted when not set. The hints are advisory: Flink does not enforce them, so a tool marked readOnlyHint: true that writes is the author's problem, as in the MCP spec. Agents ignore both fields.

Connecting from Claude Code

claude mcp add --transport http my-flink-app https://api.example.com/mcp \
  --header "Authorization: Bearer <token>"

Options

OptionDefaultDescription
path/mcpEndpoint path.
nameapp nameServer name reported to clients.
version1.0.0Server version reported to clients.
instructions—Short description sent to clients on initialize, shown to the model with the tool list.
authapp auth pluginSee Authentication.
filtertool.mcp === trueCustom rule for which tools to expose. Replaces the default.
debugfalseLog each tool call.

Authentication

auth valueBehaviour
omittedUses the app's auth plugin (authenticateRequest with no required permissions — a valid token is enough). Without an auth plugin the endpoint is open and a warning is logged.
{ permissions: [...] }Uses the app's auth plugin and requires these permissions to reach the endpoint at all.
falseExplicitly open, no warning.
async (req, app) => ...Custom. Return { user, permissions }, false (401), or a FlinkResponse to shape the rejection.

Rejected requests get a 401 with WWW-Authenticate: Bearer (or the status of the returned FlinkResponse). Per-tool permissions are always enforced on top, using the permissions resolved by authentication.

How tool results map to MCP

Flink ToolResultMCP CallToolResult
{ success: true, data: object }content: [text(JSON)] + structuredContent: data
{ success: true, data: primitive }content: [text(data)]
{ success: false, error, code }isError: true, content: [text("CODE: error")]
thrown Flink error (e.g. forbidden)isError: true, content: [text("PERMISSION_DENIED: ...")]

Input schemas come from inputSchema (Zod 4), inputJsonSchema, or the compiler-generated schema — same priority as for agents. outputSchema is advertised when it describes an object.

Plugin context

ctx.plugins.mcp.listTools(); // McpToolDefinition[] currently exposed
ctx.plugins.mcp.path;        // "/mcp"

Notes

  • Stateless transport: GET/DELETE on the endpoint return 405 (no sessions, no server-initiated notifications). This is what Claude Code and other current clients expect.
  • Tool descriptions become the model's only documentation — make them explicit about arguments and side effects.
  • Long-running tools must finish within the client's request timeout.

版本与发布记录

@flink-app/mcp-plugin 共发布 23 个版本,首次发布于 2026/08/27;过去 12 个月发布了 23 个版本。

版本发布日期距今
2.0.0-alpha.134latest2026/11/078 天前
2.0.0-alpha.1332026/11/069 天前
2.0.0-alpha.1322026/11/0510 天前
2.0.0-alpha.1312026/10/2818 天前
2.0.0-alpha.1302026/10/2521 天前
2.0.0-alpha.1292026/10/2521 天前

关于 @flink-app/mcp-plugin 的常见问题

@flink-app/mcp-plugin 是什么?

Flink plugin that exposes Flink AI tools over MCP (Model Context Protocol) via Streamable HTTP

如何安装 @flink-app/mcp-plugin?

在项目目录运行 npm install @flink-app/mcp-plugin,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@flink-app/flink(>=2.0.0-alpha.134)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@flink-app/mcp-plugin 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@flink-app/mcp-plugin 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@flink-app/mcp-plugin 可以商用吗?

@flink-app/mcp-plugin 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@flink-app/mcp-plugin 的下载量有多少?

根据 npm 官方下载统计,@flink-app/mcp-plugin 在 2026/10/15 – 2026/11/13 这 30 天内被下载 2,185 次,日均约 73 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@flink-app/mcp-plugin 还在维护吗?

最新版本 2.0.0-alpha.134 发布于 2026/11/07(8 天前);至今共发布 23 个版本,其中过去 12 个月发布了 23 个;首次发布于 2026/08/27。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。