@fictjs/mcp

@fictjs/mcp

MCP server for retrieving Fict documentation, running compiler/ESLint/TypeScript diagnostics, and generating shareable Playground links.

Category
访问服务器

README

@fictjs/mcp

Fict MCP server for docs retrieval, compiler diagnostics, and Playground link generation.

Features

  • list-sections: list all documentation section ids.
  • search-sections: keyword search for relevant section ids.
  • get-documentation: fetch docs content by section id (md or normalized llms format).
    • supports maxCharsPerDocument for bounded per-section output.
  • fict-autofixer: run aggregated diagnostics on a virtual file map:
    • Compiler diagnostics (source: "compiler")
    • ESLint diagnostics via @fictjs/eslint-plugin (source: "eslint")
    • TypeScript diagnostics (syntax-focused) (source: "typescript")
  • list-playground-templates: discover available template ids before generating links.
  • playground-link: generate shareable Fict Playground URLs from template + file overrides.
  • fict-task prompt: docs-first + autofixer-before-output workflow template.
  • fict://doc/<section-id> resources for each local docs section.

Docs section metadata

list-sections / search-sections can expose per-section metadata from markdown frontmatter:

---
title: Custom Guide Title
tags: [mcp, docs]
use_cases:
  - Explain migration constraints
  - Provide implementation checklist
---

If frontmatter metadata is missing, built-in defaults are still applied for core Fict docs. When available, MCP can load sections from a generated manifest (assets/docs-manifest.json) to avoid full docs scanning at startup.

Build

pnpm build

Test

pnpm test

Run (stdio transport)

pnpm build
pnpm start
# stdio mode also accepts docs/playground overrides:
pnpm start -- --stdio --docs-root ../docs --docs-manifest ./assets/docs-manifest.json --playground-origin http://localhost:4173

Run (Streamable HTTP transport)

pnpm build
pnpm start -- --http --host 127.0.0.1 --port 8788 --path /mcp --health-path /healthz --stats-path /stats --auth-token your-token --enable-cors --cors-origin https://your-client.example --max-sessions 100 --session-ttl-ms 1800000 --docs-root ../docs --docs-manifest ./assets/docs-manifest.json --playground-origin http://localhost:4173

Run (Legacy HTTP+SSE transport, deprecated)

pnpm build
FICT_MCP_ENABLE_SSE=1 pnpm start -- --sse --host 127.0.0.1 --port 8790 --sse-path /sse --messages-path /messages --health-path /healthz --stats-path /stats --max-sessions 100 --session-ttl-ms 1800000

You can also switch transports via env:

FICT_MCP_TRANSPORT=http pnpm start

Environment variables:

  • FICT_MCP_DOCS_ROOT: absolute or relative path to a Fict docs checkout. When omitted, the server walks upward from the current working directory looking for docs/.
  • FICT_MCP_DOCS_MANIFEST: optional docs manifest path override (if provided but missing/invalid, startup fails fast).
  • FICT_PLAYGROUND_ORIGIN: playground base URL (default: http://localhost:4173).
  • FICT_MCP_TRANSPORT: stdio, http, or sse (default: stdio, and sse requires FICT_MCP_ENABLE_SSE=1).
  • FICT_MCP_ENABLE_SSE: set to 1 to enable deprecated HTTP+SSE transport.
  • FICT_MCP_HTTP_HOST: HTTP bind host (default: 127.0.0.1).
  • FICT_MCP_HTTP_PORT: HTTP bind port (default: 8788).
  • FICT_MCP_HTTP_PATH: HTTP endpoint path (default: /mcp).
  • FICT_MCP_AUTH_TOKEN: optional bearer token; when set, all HTTP/SSE requests must include Authorization: Bearer <token>.
  • FICT_MCP_HTTP_ENABLE_CORS: set to 1/true to emit CORS headers (default: disabled).
  • FICT_MCP_HTTP_CORS_ORIGIN: optional Access-Control-Allow-Origin value when CORS is enabled (default: *).
  • FICT_MCP_SSE_PATH: SSE stream endpoint path (default: /sse).
  • FICT_MCP_SSE_MESSAGES_PATH: SSE client message POST path (default: /messages).
  • FICT_MCP_HTTP_HEALTH_PATH: health endpoint path (default: /healthz).
  • FICT_MCP_HTTP_STATS_PATH: stats endpoint path (default: /stats).
  • FICT_MCP_HTTP_MAX_SESSIONS: max active HTTP sessions before LRU eviction (default: 100).
  • FICT_MCP_HTTP_SESSION_TTL_MS: idle session TTL in milliseconds (default: 1800000).

In HTTP mode, invalid docsRoot config fails fast at startup instead of deferring the error to the first MCP request. When docsManifestPath / FICT_MCP_DOCS_MANIFEST is explicitly provided, missing/invalid manifests also fail fast at startup. If docsRoot is auto-discovered and no override is provided, server startup uses bundled assets/docs-manifest.json when present. For HTTP/SSE transports bound to non-loopback hosts (for example 0.0.0.0), --auth-token / FICT_MCP_AUTH_TOKEN is required.

HTTP observability endpoints

When running with --http, MCP also serves:

  • GET /healthz (configurable via --health-path / FICT_MCP_HTTP_HEALTH_PATH)
  • GET /stats (configurable via --stats-path / FICT_MCP_HTTP_STATS_PATH)

/stats includes request counters, status counters, error count, active session count, and session lifecycle totals (created/reused/expired/evicted/deleted). --path, --health-path, and --stats-path must be distinct values. For --sse, --sse-path, --messages-path, --health-path, and --stats-path must also be distinct.

fict-autofixer options

fict-autofixer input supports:

  • entry: optional entry path; if provided it must exist in files
  • profile: app-default | ci-hard-gate | migration
  • includeEslint (default: true)
  • includeTypescript (default: true)

fict-autofixer issue output includes:

  • source: compiler | eslint | typescript
  • code: diagnostic/rule code
  • suggestion: actionable fix hint

Example MCP client config

{
  "mcpServers": {
    "fict": {
      "command": "fict-mcp",
      "args": ["--stdio"],
      "env": {
        "FICT_MCP_DOCS_ROOT": "/absolute/path/to/fict/docs",
        "FICT_PLAYGROUND_ORIGIN": "http://localhost:4173"
      }
    }
  }
}

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选