tecof-mcp
Official@tecof/mcp
面向 Tecof Developer API v1 的 stdio MCP 服务器。在 Tecof 主题仓库内运行; 从磁盘(AST)读取主题组件,将代理编写的简单"区块"定义转换为编辑器文档, 并通过 Developer API 创建/更新草稿页面。发布始终在面板中完成(API 中没有 publish)。
SDK:
@modelcontextprotocol/server@^2(+zod@^4)—McpServer+serveStdioNode ≥ 20,ESM
支持工具注解(
readOnlyHint、destructiveHint)和_meta["anthropic/requiresUserInteraction"](删除)
安装
在主题仓库根目录:
# 1) Panelden API anahtarı üretin: Ayarlar → Geliştirici / API Anahtarları (scope: pages:read, pages:write)
# 2) .env (gitignore'da) içine yazın
echo 'TECOF_API_TOKEN=tcf_...' >> .env服务器通过 npx 运行,无需全局安装:
npx -y @tecof/mcp@latest环境变量
按 TECOF_PROJECT_DIR → CLAUDE_PROJECT_DIR → process.cwd() 的顺序查找项目目录;
.env 和 .env.local 从此处读取。不会覆盖 process.env — 文件中的值仅填充
为空的键(.env.local > .env)。
变量 | 必填 | 说明 |
| 是 |
|
| 是* | 后端地址;若缺失则使用 |
| 否 | 全局主题 id;若缺失则使用 |
| 否 | 本地预览根地址(默认 |
| 否 | 主题仓库位于其他目录时使用 |
缺少 token/URL 时服务器仍会启动;list_components 和 validate_document
可正常工作,页面相关工具会返回带指引的错误。日志仅写入 stderr;
未捕获的错误也落入 stderr,进程不会崩溃。
安全:TECOF_API_URL 必须为 https。若提供 http://(非 loopback)地址,
启动时会在 stderr 打印警告,并在每个工具错误中附加相同提示;http→https
重定向不会被跟随(Node fetch 在重定向时会丢弃 Authorization,导致误导性的 401)—
3xx 响应会被转换为"TECOF_API_URL 协议/主机错误"。请求超时(30 秒)涵盖
header 和 body 读取的整个过程。
Claude Code — .mcp.json
{
"mcpServers": {
"tecof": {
"type": "stdio",
"command": "npx",
"args": ["-y", "${TECOF_MCP_PACKAGE:-@tecof/mcp@latest}"]
}
}
}TECOF_MCP_PACKAGE 环境变量可覆盖包 spec — 在发布到 npm 之前或本地
开发时,可指向本仓库文件夹(npx -y /path/to/tecof-mcp 会运行文件夹中的 bin):
export TECOF_MCP_PACKAGE=/Users/<siz>/Desktop/Tecof/tecof-mcp # claude'u bu shell'den başlatın发布(npm)
npm run build && npm test && node scripts/smoke.mjs
npm version patch # ya da minor
npm publish --access public # @tecof kapsamı — tecof-theme-editor/analytics ile aynı hesapCodex — .codex/config.toml
[mcp_servers.tecof]
command = "npx"
args = ["-y", "@tecof/mcp@latest"]Gemini CLI — .gemini/settings.json
{
"mcpServers": {
"tecof": {
"command": "npx",
"args": ["-y", "@tecof/mcp@latest"]
}
}
}令牌不会写入任何配置文件;保留在 .env 中。客户端进程在主题
仓库根目录启动,服务器从那里读取 .env。
Related MCP server: anticms-mcp
工具
工具 | 输入 | 功能 |
| — | 店铺、语言、主题(themeId/merchantThemeId/domain)、令牌作用域/过期时间、页面数量 |
|
| 主题目录(从磁盘读取 AST,mtime 缓存)。 |
|
| 页面列表(slug 升序) |
|
| outline:区块/slot 树(id、type、简短文本);full:draftData |
|
| 不保存即验证;返回 |
|
| 创建草稿;Header/Footer 从 |
|
| GET → 应用操作 → 验证 → PUT(使用 |
|
| 软删除 — 必须经用户确认 |
|
| 1 小时有效的草稿预览链接(storefront + 本地) |
结果以 content[0].text(JSON)+ structuredContent 返回;错误以 isError: true
携带字段/路径信息(便于代理修正)。
update_page 操作
append_section{section}(插入到 Footer 之前)、insert_section{section, before?|after?}(无锚点时如同 append 一样插入到 Footer 之前)、
replace_section{id, section}、remove_section{id}、move_section{id, before?|after?}、
set_props{id, props}(浅合并)、set_slot{id, slot, children}(完全替换 slot;先构建新子节点,失败则保留旧内容)、
set_root_props{props}。
行为说明:
公共组件只读 — 包括其子节点。 带有
sharedComponentId的节点(Header/Footer)及其 zones 下的所有后代(Logo、NavLink、FooterColumn…)不能通过set_props/set_slot/replace_section/remove_section修改;会返回"公共组件 — 请在面板编辑器中编辑"错误。公共根节点本身可以通过remove_section从页面中移除(带警告;不影响 master)。get_page的 outline 中这些节点标记为shared: true。错误/警告区分(operations 模式): 从 GET 获取的文档先进行规范化(props 中残留的内联 slot 数组 → zones;master 已被删除的
SharedComponentRef节点带警告丢弃 — 后端 PUT 时执行相同操作)。代理本轮新增/修改的节点进行严格校验(未知 type、allow 违规、element-at-root → 错误);先前已存在、未被触碰的节点上的违规仅为警告 — 不会因为主题已变更而锁死无关的更新。在document模式以及create_page/validate_document中,所有节点均严格校验。空
operations: [](且无 meta)→ 返回"没有可应用的操作"错误;不发起 PUT。仅提供meta时不发送draftData(状态不会从 published 变为 changed,不会打开不必要的修订);响应中的savedDraft字段会表明这一点。后端的保存警告(信封根部的
warnings: [{code,path,message}],例如丢弃 master 已被删除的 Header 关联)在create_page/update_page响应中以服务器: [code] path: message行返回。
编写格式
代理编写的是区块树而非文档 JSON;id 生成、defaultProps 合并、slot → zone 转换以及多语言快捷方式均在服务器端完成。
{
"type": "FeaturesSection",
"props": { "columns": "3", "background": "dark" },
"variant": "dark", // bileşenin variants anahtarı (varsa)
"slots": {
"contentSlot": [
{ "type": "Title", "props": { "text": { "tr": "Neden biz?", "en": "Why us?" }, "size": "lg" } }
],
"itemsSlot": [
{ "type": "Card", "props": { "href": "/hakkimizda" },
"slots": { "contentSlot": [ { "type": "Paragraph", "props": { "text": "<p>Hızlı teslimat</p>" } } ] } }
]
}
}转换规则:
type不在目录中则报错;根级element类别报错;slot 子节点不在allow内报错。props=defaultProps(−id、−内联 slot 子节点)←variants[variant].props(+_variant)← 用户props。若提供了
slots[slot]则使用;未提供则使用 defaultProps 中的示例子节点;提供[]则为空。全部写入zones["<id>:<slot>"],props[slot] = []。多语言快捷方式:
"文本"→[{code: 默认语言, value}];{tr, en}→[{code,value}];缺少语言警告。link:"/路径"→[{code, value:{url, target:"_self"}}]。upload:URL 字符串 → 外部文件记录。select/radio值不在options中则报错。_前缀的键报错(className自由)。id:8 个字符
[A-Za-z0-9_-],在整个文档中唯一(若提供了有效且唯一的props.id则接受)。
开发
npm install
npm run build # tsc → dist/ (+ dist/bin.js +x)
npm test # vitest (parser, build, validate, operations, api mock, config, uçtan uca MCP)
node scripts/smoke.mjs # dist/bin.js'i stdio ile ayağa kaldırıp initialize + tools/list doğrular测试不会向真实后端发起请求(fetch mock);主题目录从 test/fixtures/theme
下的副本组件读取。
程序化使用(HTTP transport 等):
import { buildServer, ServerContext, loadConfig } from "@tecof/mcp";
const ctx = new ServerContext({ config: loadConfig() });
const server = buildServer({ ctx }); // McpServer — istediğiniz transport'a bağlayınResources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseBqualityDmaintenanceMCP server for integrating coding agents (Claude Code CLI, etc.) with the GIMS Automation system. Enables development of automation scripts, data source types, activator types, and Git synchronization.61MIT
- AlicenseNot gradedqualityDmaintenanceMCP server for generating AntiCMS v3 JSON component templates with validation and field type support.11MIT
- AlicenseBqualityDmaintenanceMCP Server for Git operations, agent templates, and project utilities.992MIT
- AlicenseAqualityBmaintenanceMCP server that lets agents edit real Microsoft Word (.docx) documents - tracked changes, tables, styles, comments, content controls, and document properties - with every edit validated and previewed before saving. Built on the Open XML SDK (no Word automation); reads and writes documents in place through filesystem or SharePoint storage.714MIT
Related MCP Connectors
MCP server for AgentDocs (agentdocs.eu): read, search, write, comment on & share Markdown docs.
MCP server for the PDFGate API. Generate PDFs, manage documents and handle e-signatures.
A MCP server built for developers enabling Git based project management with project and personal…
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/tecof/tecof-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server