Official · MODEL CONTEXT PROTOCOL
omer ayhan custom context mcp
This Model Context Protocol (MCP) server provides tools for structuring and extracting data from text according to JSON templates.
连接能力
omer ayhan custom context mcp 为 AI Agent 提供什么
- Group and structure text based on JSON templates with placeholders
- Extract information from AI-generated text into structured JSON formats
- Support for any arbitrary JSON structure with nested placeholders
- Intelligent extraction of key-value pairs from text
- Process AI outputs into structured data for downstream applications
- **Define a JSON template with placeholders:**
- **Use `group-text-by-json` to create a prompt for AI:**
- The tool identifies placeholder keys: name, price, description
- Generates a prompt instructing the AI to group information by these keys
- **Send the prompt to an AI model and receive grouped text:**
- **Use `text-to-json` to convert the grouped text to JSON:**
- Result:
- Use angle brackets to define placeholders: `<name>`, `<type>`, `<price>`, etc.
- The template must be a valid JSON string
- Placeholders can be at any level of nesting
- Supports complex nested structures
- Analyzing JSON templates to extract placeholder keys
- Generating prompts that guide AI models to extract information by these keys
- Parsing AI-generated text to extract key-value pairs
- Reconstructing JSON objects based on the original template structure
- Node.js v18 or higher
- npm or yarn
- **nodemon**: Watches for file changes in the src directory and rebuilds TypeScript files
- **browser-sync**: Automatically refreshes the browser when build files change
- **Concurrent execution**: Runs both services simultaneously with output synchronization
- `nodemon.json`: Controls TypeScript watching and rebuilding
- `package.json`: Uses concurrently to run nodemon and browser-sync together
- TypeScript files are automatically rebuilt when changed
- The MCP server restarts with the updated code
- Connected browsers refresh to show the latest changes
安全
MCP 收录不等于安全审核
MCP 服务器可能获得模型上下文、凭据、本地文件或调用外部系统的权限。连接 Agent 前,请检查代码、环境变量、网络行为、软件包来源与维护状态。
README
仓库文档
This Model Context Protocol (MCP) server provides tools for structuring and extracting data from text according to JSON templates.
- Group and structure text based on JSON templates with placeholders
- Extract information from AI-generated text into structured JSON formats
- Support for any arbitrary JSON structure with nested placeholders
- Intelligent extraction of key-value pairs from text
- Process AI outputs into structured data for downstream applications
npm installnpm startFor development with hot reloading:
npm run dev:watchThis MCP server provides two main tools:
This tool takes a JSON template with placeholders and generates a prompt for an AI to group text according to the template's structure.
{
"template": "{ \"type\": \"<type>\", \"text\": \"<text>\" }"
}The tool analyzes the template, extracts placeholder keys, and returns a prompt that guides the AI to extract information in a key-value format.
This tool takes the grouped text output from the previous step and converts it into a structured JSON object based on the original template.
{
"template": "{ \"type\": \"<type>\", \"text\": \"<text>\" }",
"text": "type: pen\ntext: This is a blue pen"
}It extracts key-value pairs from the text and structures them according to the template.
-
Define a JSON template with placeholders:
{ "item": { "name": "<name>", "price": "<price>", "description": "<description>" } } -
Use
group-text-by-jsonto create a prompt for AI:- The tool identifies placeholder keys: name, price, description
- Generates a prompt instructing the AI to group information by these keys
-
Send the prompt to an AI model and receive grouped text:
name: Blue Pen price: $2.99 description: A smooth-writing ballpoint pen with blue ink -
Use
text-to-jsonto convert the grouped text to JSON:- Result:
{ "item": { "name": "Blue Pen", "price": "$2.99", "description": "A smooth-writing ballpoint pen with blue ink" } }
Templates can include placeholders anywhere within a valid JSON structure:
- Use angle brackets to define placeholders:
<name>,<type>,<price>, etc. - The template must be a valid JSON string
- Placeholders can be at any level of nesting
- Supports complex nested structures
Example template with nested placeholders:
{
"product": {
"details": {
"name": "<name>",
"category": "<category>"
},
"pricing": {
"amount": "<price>",
"currency": "USD"
}
},
"metadata": {
"timestamp": "2023-09-01T12:00:00Z"
}
}The server works by:
- Analyzing JSON templates to extract placeholder keys
- Generating prompts that guide AI models to extract information by these keys
- Parsing AI-generated text to extract key-value pairs
- Reconstructing JSON objects based on the original template structure
- Node.js v18 or higher
- npm or yarn
# Install dependencies
npm install
# Build the project
npm run build
# Run the server
npm start
# Development with hot reloading
npm run dev:watchThis project includes a custom hot reloading setup that combines:
- nodemon: Watches for file changes in the src directory and rebuilds TypeScript files
- browser-sync: Automatically refreshes the browser when build files change
- Concurrent execution: Runs both services simultaneously with output synchronization
The setup is configured in:
nodemon.json: Controls TypeScript watching and rebuildingpackage.json: Uses concurrently to run nodemon and browser-sync together
To use the custom hot reloading feature:
npm run dev:watchThis creates a development environment where:
- TypeScript files are automatically rebuilt when changed
- The MCP server restarts with the updated code
- Connected browsers refresh to show the latest changes
You can use the MCP Inspector for debugging:
npm run devThis runs the server with the MCP Inspector for visual debugging of requests and responses.
社区