Custom Context MCP Server
自定义上下文 MCP 服务器
该模型上下文协议 (MCP) 服务器提供根据 JSON 模板构建和提取文本数据的工具。
特征
文本到 JSON 的转换
根据带有占位符的 JSON 模板对文本进行分组和结构化
将 AI 生成的文本中的信息提取为结构化的 JSON 格式
支持任意带有嵌套占位符的 JSON 结构
从文本中智能提取键值对
将 AI 输出处理为下游应用程序的结构化数据
Related MCP server: Unstructured Document Processor MCP
入门
安装
npm install运行服务器
npm start对于使用热重载进行开发:
npm run dev:watch用法
该 MCP 服务器提供了两个主要工具:
1. 按 JSON 分组文本( group-text-by-json )
该工具采用带有占位符的 JSON 模板,并生成提示,让 AI 根据模板的结构对文本进行分组。
{
"template": "{ \"type\": \"<type>\", \"text\": \"<text>\" }"
}该工具分析模板,提取占位符键,并返回提示,引导AI以键值格式提取信息。
2.文本转JSON( text-to-json )
该工具获取上一步分组的文本输出,并根据原始模板将其转换为结构化的 JSON 对象。
{
"template": "{ \"type\": \"<type>\", \"text\": \"<text>\" }",
"text": "type: pen\ntext: This is a blue pen"
}它从文本中提取键值对并根据模板对其进行构造。
示例工作流程
定义带有占位符的 JSON 模板:
{ "item": { "name": "<name>", "price": "<price>", "description": "<description>" } }使用
group-text-by-json为 AI 创建提示:该工具识别占位符键:名称、价格、描述
生成提示,指示 AI 按这些键对信息进行分组
将提示发送给 AI 模型并接收分组文本:
name: Blue Pen price: $2.99 description: A smooth-writing ballpoint pen with blue ink使用
text-to-json将分组文本转换为 JSON:结果:GXP8
模板格式
模板可以在有效的 JSON 结构中的任何位置包含占位符:
使用尖括号定义占位符:
<name>、<type>、<price>等。模板必须是有效的 JSON 字符串
占位符可以位于任何嵌套级别
支持复杂的嵌套结构
带有嵌套占位符的示例模板:
{
"product": {
"details": {
"name": "<name>",
"category": "<category>"
},
"pricing": {
"amount": "<price>",
"currency": "USD"
}
},
"metadata": {
"timestamp": "2023-09-01T12:00:00Z"
}
}实现细节
服务器的工作原理是:
分析 JSON 模板以提取占位符键
生成提示,引导 AI 模型通过这些键提取信息
解析 AI 生成的文本以提取键值对
根据原始模板结构重建JSON对象
发展
先决条件
Node.js v18 或更高版本
npm 或 yarn
构建并运行
# Install dependencies
npm install
# Build the project
npm run build
# Run the server
npm start
# Development with hot reloading
npm run dev:watch自定义热重载
该项目包括一个自定义热重载设置,它结合了:
nodemon :监视 src 目录中的文件更改并重建 TypeScript 文件
browser-sync :当构建文件发生更改时自动刷新浏览器
并发执行:同时运行两个服务并同步输出
该设置配置如下:
nodemon.json:控制 TypeScript 监视和重建package.json:同时使用 nodemon 和 browser-sync 运行
要使用自定义热重载功能:
npm run dev:watch这将创建一个开发环境,其中:
TypeScript 文件更改时会自动重建
MCP 服务器将使用更新后的代码重新启动
连接的浏览器刷新以显示最新更改
与 MCP Inspector 一起使用
您可以使用 MCP Inspector 进行调试:
npm run dev这将使用 MCP Inspector 运行服务器,以便对请求和响应进行可视化调试。
Available Tools
2 toolsgroup-text-by-jsonC
Gives a prompt text for AI to group text based on JSON placeholders. This tool accepts a JSON template with placeholders.
| Name | Required | Description | Default |
|---|---|---|---|
| template | Yes | JSON template with placeholders |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the tool 'gives a prompt text' but does not explain what happens next—e.g., whether it returns a prompt for AI processing, requires additional steps, or has any side effects like rate limits or authentication needs. This leaves key behavioral traits unspecified.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise with two sentences that directly address the tool's function and input. It avoids unnecessary details and is front-loaded with the core purpose. However, it could be more structured by explicitly separating usage guidelines or behavioral context.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the lack of annotations and output schema, the description is incomplete. It does not explain what the tool returns (e.g., the prompt text format or any output structure), nor does it cover behavioral aspects like error handling or prerequisites. For a tool with no structured support, the description should provide more context to be fully helpful.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description adds minimal meaning beyond the input schema, which has 100% coverage for the single parameter 'template.' It restates that the tool 'accepts a JSON template with placeholders,' mirroring the schema's description. Since schema coverage is high, the baseline score is 3, as the description does not significantly enhance parameter understanding.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states the tool 'gives a prompt text for AI to group text based on JSON placeholders,' which provides a vague purpose. It mentions the action ('gives a prompt text') and resource ('JSON placeholders'), but lacks specificity about what 'group text' means or how the prompt is used. It does not clearly distinguish from sibling tool 'text-to-json,' leaving ambiguity in its exact function.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description offers no guidance on when to use this tool versus alternatives. It does not mention the sibling tool 'text-to-json' or provide context for choosing between them. Without explicit usage instructions or exclusions, users must infer when this tool is appropriate, leading to potential misuse.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
text-to-jsonB
Converts groupped text from group-text-by-json tool to JSON. This tool accepts a JSON template with placeholders and groupped text from group-text-by-json tool.
| Name | Required | Description | Default |
|---|---|---|---|
| template | Yes | JSON template with placeholders | |
| text | Yes | Groupped text from groupTextByJson tool |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. It describes the conversion process but lacks details on error handling, output format, or any constraints (e.g., template syntax, validation rules). For a tool with no annotations, this leaves significant gaps in understanding how it behaves beyond the basic operation.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise with two sentences that directly state the tool's function and inputs. It avoids unnecessary words and is front-loaded with the core purpose. However, the repetition of 'group-text-by-json tool' could be slightly streamlined, and it lacks structural elements like bullet points for clarity.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity (data transformation with two parameters), lack of annotations, and no output schema, the description is incomplete. It covers the basic operation but misses details on output format, error cases, or example usage. While it mentions the sibling tool, more context on the overall workflow would improve completeness for effective agent use.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema already documents both parameters ('template' and 'text') with clear descriptions. The description adds minimal value by repeating that it accepts a 'JSON template with placeholders' and 'groupped text from groupTextByJson tool', but doesn't provide additional semantics beyond what the schema states. This meets the baseline for high schema coverage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: converting grouped text to JSON using a template. It specifies the verb 'converts' and the resource 'groupped text from group-text-by-json tool', making the action and input source explicit. However, it doesn't fully distinguish from its sibling 'group-text-by-json' beyond mentioning it as the source, missing an opportunity to clarify the workflow relationship more distinctly.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage by specifying that it accepts input from 'group-text-by-json tool', suggesting a sequential workflow. However, it lacks explicit guidance on when to use this tool versus alternatives (e.g., direct JSON creation tools) or any prerequisites beyond having the grouped text. No exclusions or clear when-not-to-use scenarios are provided.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
2 tool updates
v1.0.0- First observed
group-text-by-json - First observed
text-to-json
TDQS
Scored across 2 tools
The two tools have clearly distinct purposes: group-text-by-json prepares text for grouping based on a JSON template, while text-to-json converts that grouped text into JSON. There is no overlap or ambiguity between them, as they represent sequential steps in a workflow.
Both tools follow a consistent verb-noun pattern with hyphens (group-text-by-json and text-to-json), clearly indicating their actions and targets. The naming is predictable and readable across the set.
With only 2 tools, the server feels thin for its apparent purpose of custom context management. This minimal set may limit functionality and require agents to work around gaps, as typical context-related operations might include more than just grouping and conversion.
The tool surface is severely incomplete for a custom context server. It lacks core operations such as creating, updating, deleting, or retrieving context entries, and only covers a narrow text-to-JSON conversion workflow, leaving significant gaps that will likely cause agent failures.
Maintenance
Related MCP Connectors
A Model Context Protocol server for Wix AI tools
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Model Context Protocol server for the Apideck Unified API. Connect any MCP-compatible agent framework to 100+ accounting systems, HRIS platforms, file storage providers, and more through one integration. More information https://www.apideck.com/mcp-server
Hosted MCP server: convert PDFs to clean, LLM-ready Markdown with tables, formulas and OCR.
Related MCP Servers
- AlicenseCqualityFmaintenanceA Model Context Protocol server implementation that enables LLMs to query and manipulate JSON data using JSONPath syntax with extended operations for filtering, sorting, transforming, and aggregating data.236 npm90MIT
- FlicenseBqualityDmaintenanceA Model Context Protocol server that enables LLMs to extract and use content from unstructured documents across a wide variety of file formats.111-
- FlicenseAqualityDmaintenanceA Model Context Protocol server for querying large JSON files using JSONPath expressions, enabling LLMs to efficiently search and extract information from large JSON data.311-
- -licenseBqualityNot gradedmaintenanceA Model Context Protocol server that enables AI models to extract structured data from websites through the extract\_structured\_data tool.121 npm-