Token导航 LogoToken导航TokenDH.com
Static Mcpify logo
AI代理stdio官方级别未说明来源级核验

Static Mcpify

MCP Server

smcp

将结构化内容转换为静态MCP服务器,为AI代理提供即时内容访问。

工具数

0

提示词数

0

GitHub Stars

1

资源数

0
TypeScript知识管理JavaScript

安装说明

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

作者 / 组织

megazear7

提供方

megazear7

最后核验

2026/5/17 20:20

运行时

Node.js

快速接入

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

命令预览

npx smcp init --output my-mcp

详细介绍

静态mcpify

](https://www.npmjs.com/package/static-mcpify)

将任何结构化内容转换为静态内容 MCP(模型上下文协议) 服务器。

static-mcpify 从CMS(当前为Contentful)中提取内容,将其构建为静态Markdown和JSON文件,然后将这些文件作为功能齐全的MCP服务器提供。你的AI代理可以即时访问你的内容——没有数据库,没有运行时依赖关系。

网站 · ** · **

![Deploy to Netlify](https://app.netlify.com/start/deploy?repository=https://github.com/megazear7/static-mcpify)

快速开始

1.安装

npm install static-mcpify

2.初始化

.env 文件:

CONTENTFUL_API_TOKEN=your_token_here
SPACE_ID=your_space_id_here

运行init向导以选择内容类型和配置工具:

npx smcp init --output my-mcp

3.建造

从Contentful中提取内容并生成静态文件:

npx smcp build --output my-mcp

仅构建特定内容类型:

npx smcp build --output my-mcp --content-type blog --content-type author

4.发球

无服务器(Netlify Functions、Cloudflare Workers、Deno、Bun)

使用web标准处理程序——它需要一个 Request 并返回a Response:

import { handleMcpRequest } from 'static-mcpify/web-handler';

export default async (req: Request) => {
  if (req.method === 'GET') {
    return new Response(JSON.stringify({ status: 'ok' }), {
      headers: { 'Content-Type': 'application/json' },
    });
  }

  return handleMcpRequest('./my-mcp/content', req);
};

Express/Node.js HTTP

在传统服务器环境中使用Node.js处理程序:

import { handleMcpRequest } from 'static-mcpify/handler';
import express from 'express';

const app = express();
app.use(express.json());

app.all('/mcp', async (req, res) => {
  await handleMcpRequest('./my-mcp/content', req, res);
});

app.listen(3000);

运作原理

内容结构

构建后,您的输出目录如下:

my-mcp/
├── config.json
└── content/
    ├── assets/
    │   └── photo.json
    └── entries/
        ├── person/
      │   ├── config.json           # defaultTool + tools: biography, skills
        │   ├── bob-smith/
        │   │   ├── data.json         # All non-rich-text fields
        │   │   └── tools/
      │   │       ├── _default.md   # Output for get_person
      │   │       ├── biography.md  # Output for get_person_biography
        │   │       └── skills.md
        │   └── steve-baker/
        │       ├── data.json
        │       └── tools/
      │           ├── _default.md
      │           ├── biography.md
        │           └── skills.md
        └── place/
            ├── config.json
            └── work-site/
                ├── data.json
                └── tools/
                    └── description.md

_default.md 仅在以下情况下生成 defaultTool 为该条目类型配置。命名工具文件,如 biography.mddescription.md 仅为中列出的条目生成 tools.

自动生成的工具

MCP服务器根据内容结构动态创建工具:

工具说明
list_assets列出资产,带可选过滤器
get_asset按名称获取资产详细信息
list_列出内容类型的条目,带有可选筛选器
get_按标题段获取配置的默认工具内容
get__metadata启用时,通过标题slug获取条目元数据JSON
get__按标题slug获取工具的标记

工具名称是MCP安全的标识符,因此内容类型ID或工具名称中的破折号被规范化为下划线。例如, agent-skill 成为 get_agent_skill.

所有列表工具返回MCP structuredContent 呈...形状 { "titles": ["...", "..."] } 并做广告 outputSchema 对于这个回应。

例如,对于内容类型 person (默认工具已启用,工具:传记、技能)和 place (工具:说明):

  • list_person / get_person / get_person_metadata / get_person_biography / get_person_skills
  • list_place / get_place / get_place_description
  • list_assets / get_asset

配置

输出配置(config.json)

{
  "source": "contentful",
  "instructions": [
    "Use list_* tools before get_* tools when you need to discover available titles."
  ]
}

instructions 是可选的。如果省略,则默认为 "Use list_* tools before get_* tools when you need to discover available titles.".

这些指令在MCP中发送 initialize 响应作为客户端的服务器级指导。

条目配置(content/entries//config.json)

{
  "contentType": "person",
  "format": "json",
  "listTool": {
    "description": "List all available people."
  },
  "includeMetadataTool": true,
  "defaultTool": {
    "description": "Get the primary biography for a specific person.",
    "fields": ["biography"]
  },
  "tools": [
    {
      "name": "biography",
      "fields": ["biography"]
    },
    {
      "name": "skills",
      "fields": ["skills", "certifications"]
    }
  ]
}

format 是可选的,默认为 "string".

listTool 是可选的。如果存在,它允许您覆盖显示的描述 list_.

includeMetadataTool 是可选的,默认为 false.

defaultTool 是可选的。当存在时,它控制由返回的内容 get_当省略时, get_ 未注册。

tools 是可选的。每个命名工具都定义了一个名称和要包含的Contentful字段。

format"string",工具输出呈现为连接的Markdown,并在MCP中返回 content 现场。

format"json",每个配置的字段都作为MCP上的属性返回 structuredContent,生成的工具定义包括 outputSchema.

列出始终使用的工具 structuredContent,不管 format.

现场实例

通过将这些添加到您的VS代码中,尝试托管示例MCP服务器 mcp.json:

静态内容示例 (人物和地点):

{
  "static-example": {
    "type": "http",
    "url": "https://static-mcpify.alexlockhart.me/example/static/mcp"
  }
}

有内容的例子 (奇幻冒险和战役):

{
  "contentful-example": {
    "type": "http",
    "url": "https://static-mcpify.alexlockhart.me/example/contentful/mcp"
  }
}

添加新的源适配器

要添加对新CMS(例如Sanity、Strapi)的支持:

  1. 创建 module/src/cli/sources//index.ts
  2. 实施 SourceAdapter 接口来自 module/src/cli/sources/adapter.ts
  3. 在中注册 module/src/cli/sources/index.ts
  4. 将源名称添加到Zod枚举中 module/src/types/config.ts

发展

先决条件

  • Node.js 22+
  • npm

项目结构

module/                # Publishable npm package (static-mcpify)
├── src/
│   ├── types/         # Zod schemas and TypeScript types
│   ├── cli/           # smcp CLI tool (init + build commands)
│   │   └── sources/   # Source adapters (pluggable)
│   │       └── contentful/
│   └── server/        # MCP server + handlers
├── package.json
└── tsconfig.json
netlify/               # Brand website + hosted examples
├── brand/             # Static HTML/CSS brand website
├── functions/         # Netlify serverless function handlers
└── package.json
examples/              # Example content and configs
├── static/            # Pre-built static content (no CMS needed)
└── contentful/        # Contentful-backed content (built at deploy time)
test/                  # Sanity tests

这是一个包含两个包的npm工作区:

  • module/ --可出版的 static-mcpify npm包(CLI+MCP服务器)
  • netlify/ --用于托管示例的品牌网站和Netlify无服务器功能

命令

命令描述
npm start启动MCP服务器(静态+内容)和品牌网站
npm run buildTypeScript编译+构建内容丰富的示例
npm run build:ts仅编译TypeScript
npm test健全性检查MCP服务器端点
npm run lint运行ESLint
npm run fix运行ESLint并自动修复

本地开发

npm start 同时运行三个服务:

  • 静态MCP服务器http://localhost:3100/mcp
  • 内容丰富的MCP服务器http://localhost:3101/mcp
  • 品牌网站http://localhost:3102

测试

运行健全性测试,启动两个MCP服务器并验证健康状况和MCP初始化响应:

npm test

在提交之前,始终运行lint和TypeScript编译:

npm run lint
npm run build:ts

Netlify部署

项目部署到 静态mcpify.alexlockhart.me 通过Netlify。

  • 推到 main 触发自动部署
  • 构建命令: npm run build:ts && npm run build:contentful
  • node_bundler = "nft" (节点文件跟踪)解析函数中的工作区包
  • 环境变量 CONTENTFUL_API_TOKENSPACE_ID 在Netlify上被设置为秘密

Netlify函数使用 static-mcpify/web-handler 它封装了MCP SDK WebStandardStreamableHTTPServerTransport 随着 enableJsonResponse: true。这将返回JSON响应,而不是无状态无服务器环境所需的SSE流。

许可证

国际学生委员会

______________________________________________________________________

由...制作 亚历克斯·洛克哈特

目录标签

目录标签

TypeScript知识管理JavaScript静态生成本地部署MCP协议内容管理无服务器AI集成

接入字段

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

stdio

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

none

运行时(runtime,运行环境)

Node.js

来源包(packageName,安装包名)

smcp

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

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

0

权限和风险

stdionone部署方式未说明

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

安装前确认

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

来源信息

继续浏览同类 MCP