static-mcpify

static-mcpify

Enables AI agents to access structured content by building static Markdown/JSON files served as a Model Context Protocol server.

Category
访问服务器

README

static-mcpify

npm version

Turn any structured content into a static MCP (Model Context Protocol) server.

static-mcpify pulls content from your CMS (currently Contentful), builds it into static Markdown and JSON files, then serves those files as a fully-featured MCP server. Your AI agents get instant access to your content — no database, no runtime dependencies.

Website · Docs · Examples · Deploy Guide · npm · GitHub

Deploy static starter to Netlify Deploy Contentful starter to Netlify

Netlify Starter Templates

  • Static/filesystem starter: creates a new repo from starters/netlify-static-starter and deploys bundled sample Markdown/JSON content immediately
  • Contentful starter: creates a new repo from starters/netlify-contentful-starter, deploys bundled sample content immediately, and rebuilds from Contentful when CONTENTFUL_API_TOKEN and SPACE_ID are configured
  • Both starters auto-wire a Netlify Function at /mcp, ship a netlify.toml, and include a small landing page plus sample MCP client JSON

Quick Start

1. Install

npm install static-mcpify

2. Initialize

Set your Contentful credentials in a .env file:

CONTENTFUL_API_TOKEN=your_token_here
SPACE_ID=your_space_id_here

Run the init wizard to choose content types and configure tools:

npx smcp init --output my-mcp

3. Build

Pull content from Contentful and generate static files:

npx smcp build --output my-mcp

Build specific content types only:

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

4. Serve

Serverless (Netlify Functions, Cloudflare Workers, Deno, Bun)

Use the web standard handler — it takes a Request and returns 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

Use the Node.js handler for traditional server environments:

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);

How It Works

Content Structure

After building, your output directory looks like:

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 is only generated when defaultTool is configured for that entry type. Named tool files like biography.md or description.md are only generated for entries listed in tools.

Auto-Generated Tools

The MCP server dynamically creates tools based on the content structure:

Tool Description
list_assets List assets, with optional filter
get_asset Get asset details by name
list_<type> List entries of a content type, with optional filter
get_<type> Get the configured default tool content by title slug
get_<type>_metadata Get entry metadata JSON by title slug when enabled
get_<type>_<tool> Get a tool's markdown by title slug

Tool names are MCP-safe identifiers, so dashes in content type IDs or tool names are normalized to underscores. For example, agent-skill becomes get_agent_skill.

All list tools return MCP structuredContent in the shape { "titles": ["...", "..."] } and advertise an outputSchema for that response.

For example, with content types person (default tool enabled, tools: biography, skills) and place (tools: description):

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

Configuration

Output Config (config.json)

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

instructions is optional. When omitted, it defaults to "Use list_* tools before get_* tools when you need to discover available titles.".

These instructions are sent in the MCP initialize response as server-level guidance for clients.

Entry Config (content/entries/<type>/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 is optional and defaults to "string".

listTool is optional. When present, it lets you override the description shown for list_<type>.

includeMetadataTool is optional and defaults to false.

defaultTool is optional. When present, it controls the content returned by get_<type>. When omitted, get_<type> is not registered.

tools is optional. Each named tool defines a name and which Contentful fields to include.

When format is "string", tool output is rendered as concatenated Markdown and returned in the MCP content field.

When format is "json", each configured field is returned as a property on MCP structuredContent, and the generated tool definition includes an outputSchema.

List tools always use structuredContent, regardless of format.

Live Examples

Try the hosted example MCP servers by adding these to your VS Code mcp.json:

Static Content Example (people and places):

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

Contentful Example (fantasy adventures and campaigns):

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

Adding a New Source Adapter

To add support for a new CMS (e.g., Sanity, Strapi):

  1. Create module/src/cli/sources/<name>/index.ts
  2. Implement the SourceAdapter interface from module/src/cli/sources/adapter.ts
  3. Register it in module/src/cli/sources/index.ts
  4. Add the source name to the Zod enum in module/src/types/config.ts

Development

Prerequisites

  • Node.js 22+
  • npm

Project Structure

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

This is an npm workspace with two packages:

  • module/ — The publishable static-mcpify npm package (CLI + MCP server)
  • netlify/ — Brand website and Netlify serverless functions for hosted examples

Commands

Command Description
npm start Start both MCP servers (static + contentful) and brand website
npm run build TypeScript compile + build contentful example
npm run build:ts TypeScript compile only
npm test Sanity check MCP server endpoints
npm run lint Run ESLint
npm run fix Run ESLint with auto-fix

Local Development

npm start runs three services concurrently:

  • Static MCP server at http://localhost:3100/mcp
  • Contentful MCP server at http://localhost:3101/mcp
  • Brand website at http://localhost:3102

Testing

Run the sanity tests, which spin up both MCP servers and verify health and MCP initialize responses:

npm test

Always run lint and TypeScript compilation before committing:

npm run lint
npm run build:ts

Netlify Deployment

The project deploys to static-mcpify.alexlockhart.me via Netlify.

  • Pushes to main trigger automatic deploys
  • Build command: npm run build:ts plus npm run build:contentful only when CONTENTFUL_API_TOKEN and SPACE_ID are set
  • node_bundler = "nft" (Node File Tracing) resolves workspace packages in functions
  • Environment variables CONTENTFUL_API_TOKEN and SPACE_ID are set as secrets on Netlify

The Netlify functions use static-mcpify/web-handler which wraps the MCP SDK's WebStandardStreamableHTTPServerTransport with enableJsonResponse: true. This returns a JSON response instead of SSE streaming, which is required for stateless serverless environments.

License

ISC


Made by Alex Lockhart

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选