Token导航 LogoToken导航TokenDH.com
Text To JSON MCP logo
开发工具stdio官方级别未说明来源级核验

Text To JSON MCP

MCP Server

text-to-json-mcp

一个本地运行的MCP服务器,使用Zod模式将文本提示转换为结构化的JSON,帮助开发者和AI助手将非结构化文本转换为定义良好且经过验证的数据结构。

工具数

3

提示词数

0

GitHub Stars

0

资源数

0
文本处理本地运行JavaScriptCursor开发工具Cursor

安装说明

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

作者 / 组织

chiragdarji

提供方

chiragdarji

最后核验

2026/5/17 20:22

运行时

Node.js

快速接入

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

命令预览

npx text-to-json-mcp --help

详细介绍

文本到JSON MCP服务器

一个本地MCP(模型上下文协议)服务器,使用Zod模式将文本提示转换为结构化JSON。该工具可帮助开发人员和人工智能助手将非结构化文本结构化为定义良好、经过验证的数据结构。

特性

  • 将提示转换为JSON:将自然语言提示转换为具有任务、意图、输入、输出和清晰度差距的结构化JSON
  • 查找清晰度差距:识别文本提示中缺失的细节、歧义和需要改进的地方
  • 优化提示:生成更清晰、更具体的输入提示版本
  • 本地优先:完全在本地计算机上运行,不依赖于云
  • IDE集成:与Cursor、VSCode和其他MCP兼容编辑器无缝集成
  • CLI接口:用于快速文本处理和测试的命令行界面

安装

地方发展

# Clone the repository
git clone https://github.com/chiragdarji/text-to-json-mcp.git
cd text-to-json-mcp

# Install dependencies
npm install

# Start development server
npm run dev

全球安装

# Install globally
npm install -g text-to-json-mcp

# Or use npx (recommended)
npx text-to-json-mcp --help

用法

CLI命令

# Convert text to structured JSON
npx text-to-json-mcp convert "Create a user authentication system with login and registration"

# Find clarity gaps in text
npx text-to-json-mcp gaps "Make something good"

# Refine text for better clarity
npx text-to-json-mcp refine "Build a website"

# Start MCP server for IDE integration
npx text-to-json-mcp server

# Show help
npx text-to-json-mcp help

输出示例

输入: "Create a user authentication system with login and registration"

输出:

{
  "success": true,
  "data": {
    "task": "Create a user authentication system with login and registration",
    "intent": "To fulfill the specified requirements and deliver the requested output",
    "inputs": {
      "required": [
        "Input text or prompt",
        "Context or background information"
      ],
      "optional": [
        "Additional context",
        "Preferences or style guidelines"
      ],
      "constraints": [
        "Available time and resources",
        "Technical limitations"
      ]
    },
    "outputs": {
      "primary": "Catalog",
      "secondary": [
        "Documentation or instructions",
        "Quality assurance metrics"
      ],
      "format": "JSON"
    },
    "clarity_gaps": [
      "Missing specific authentication methods (JWT, OAuth, etc.)",
      "Unclear user data requirements and validation",
      "Missing security requirements and password policies"
    ]
  },
  "processing_time_ms": 15
}

MCP集成

光标IDE设置

  1. 安装软件包:
   npm install -g text-to-json-mcp
  1. 在游标中配置MCP:

- 打开光标设置 - 导航到MCP配置 - 添加以下配置:

   {
     "mcpServers": {
       "text-to-json-mcp": {
         "command": "npx",
         "args": ["text-to-json-mcp", "server"],
         "env": {}
       }
     }
   }
  1. 重新启动游标 加载MCP服务器
  1. 在游标中使用:
   /mcp text-to-json-mcp convertPromptToJson "Create a user authentication system with login and registration"

VSCode设置

  1. 安装VSCode的MCP扩展
  2. 在工作区设置中配置MCP服务器
  3. 使用与上述相同的配置格式

API方法

1. convertPromptToJson

将原始文本转换为结构化JSON。

输入: { "text": "your prompt here" }

输出:具有任务、意图、输入、输出和清晰度差距的结构化JSON。

2. findClarityGaps

识别提示中缺少的细节或歧义。

输入: { "text": "your prompt here" }

输出:类别、描述、建议和严重程度方面的一系列清晰度差距。

3. refinePrompt

建议输入提示的更清晰版本。

输入: { "text": "your prompt here" }

输出:原始提示、精炼提示和改进列表。

发展

项目结构

text-to-json-mcp/
├── src/
│   └── index.js          # Main MCP server implementation
├── utils/
│   ├── gapAnalysis.js    # Text analysis utilities
│   └── promptProcessor.js # Prompt processing logic
├── schema.js             # Zod schema definitions
├── cli.js                # CLI entrypoint
├── package.json          # Package configuration
├── README.md             # This file
├── LICENSE               # MIT license
└── mcp.json             # Example MCP configuration

可用脚本

npm start          # Start the MCP server
npm run dev        # Start with nodemon for development
npm test           # Run tests
npm run lint       # Run ESLint
npm run format     # Format code with Prettier

添加新方法

  1. 在中定义架构 schema.js
  2. 在适当的实用程序文件中实现逻辑
  3. 在中添加方法处理程序 src/index.js
  4. 更新中的CLI界面 cli.js
  5. 添加测试和文档

向NPM发布

先决条件

  1. NPM账户:在以下网址创建帐户
  2. 登录: npm login 在您的终端
  3. 包名:确保包名称可用

发布步骤

# 1. Test the package locally
npm install -g .

# 2. Test CLI functionality
text-to-json-mcp --help

# 3. Update version (patch, minor, or major)
npm version patch

# 4. Publish to npm
npm publish --access public

版本管理

npm version patch   # 1.0.0 → 1.0.1 (bug fixes)
npm version minor   # 1.0.0 → 1.1.0 (new features)
npm version major   # 1.0.0 → 2.0.0 (breaking changes)

用例

  • AI快速工程:在发送给AI模型之前,对提示进行结构化和验证
  • 需求分析:将自然语言要求转换为结构化格式
  • 文档:根据文本描述生成一致的文档模板
  • 质量保证:识别不清楚或不完整的规格
  • 团队协作:规范开发团队之间的沟通格式
  • 实时开发:活动编码会话期间的结构要求和任务

实时软件开发示例

示例1:主动编码过程中的特征开发

场景:当您的团队领导要求您添加新功能时,您正在构建用户身份验证系统。

原始请求: *“我们需要在身份验证系统中添加密码重置功能。用户应该能够通过电子邮件请求重置链接并设置新密码。确保它是安全的,并遵循我们现有的模式。”*

在Cursor中使用文本到json-mcp:

/mcp text-to-json-mcp convertPromptToJson "We need to add password reset functionality to the auth system. Users should be able to request a reset link via email and set a new password. Make sure it's secure and follows our existing patterns."

结构化输出:

{
  "success": true,
  "data": {
    "task": "Add password reset functionality to the auth system",
    "intent": "To fulfill the specified requirements and deliver the requested output",
    "inputs": {
      "required": [
        "Input text or prompt",
        "Context or background information"
      ],
      "optional": [
        "Additional context",
        "Preferences or style guidelines"
      ],
      "constraints": [
        "Available time and resources",
        "Technical limitations"
      ]
    },
    "outputs": {
      "primary": "System",
      "secondary": [
        "Documentation or instructions",
        "Quality assurance metrics"
      ],
      "format": "JSON"
    },
    "clarity_gaps": [
      "Missing specific security requirements (token expiration, rate limiting)",
      "Unclear email template requirements",
      "Missing integration points with existing auth flow"
    ]
  },
  "processing_time_ms": 12
}

下一步-找出清晰度差距:

/mcp text-to-json-mcp findClarityGaps "We need to add password reset functionality to the auth system. Users should be able to request a reset link via email and set a new password. Make sure it's secure and follows our existing patterns."

差距分析输出:

{
  "success": true,
  "gaps": [
    {
      "category": "missing_constraints",
      "description": "Missing constraint: \"secure\"",
      "suggestion": "Specify limits, boundaries, or specific criteria for \"secure\"",
      "severity": "high"
    },
    {
      "category": "unclear_output",
      "description": "Unclear output: \"system\"",
      "suggestion": "Specify the exact format, structure, and content of the \"system\"",
      "severity": "medium"
    }
  ],
  "overall_clarity_score": 70
}

最后一步-细化请求:

/mcp text-to-json-mcp refinePrompt "We need to add password reset functionality to the auth system. Users should be able to request a reset link via email and set a new password. Make sure it's secure and follows our existing patterns."

精炼输出:

{
  "success": true,
  "original_prompt": "We need to add password reset functionality to the auth system...",
  "refined_prompt": "Context: This request is for adding password reset functionality to an existing authentication system. We need to add password reset functionality to the auth system. Users should be able to request a reset link via email and set a new password. The output should be in [specific format] with [specific structure] and include [specific content]. Constraints: [specify time limits, resource constraints, technical limitations].",
  "improvements": [
    {
      "type": "clarity",
      "description": "Added context section",
      "before": "We need to add password reset functionality...",
      "after": "Context: This request is for adding password reset functionality to an existing authentication system. We need to add password reset functionality..."
    },
    {
      "type": "structure",
      "description": "Added specific output requirements",
      "before": "Make sure it's secure and follows our existing patterns.",
      "after": "The output should be in [specific format] with [specific structure] and include [specific content]."
    },
    {
      "type": "completeness",
      "description": "Added constraints section",
      "before": "Make sure it's secure and follows our existing patterns.",
      "after": "Constraints: [specify time limits, resource constraints, technical limitations]."
    }
  ]
}

示例2:调试会话期间的错误修复

场景:您正在调试一个生产问题,需要快速为您的团队构建问题描述。

原始请求: *“登录API为某些用户返回了500个错误。当他们的电子邮件地址中有特殊字符时,似乎会发生这种情况。我们需要尽快修复此问题,因为它会阻止客户访问。”*

将文本转换为json-mcp:

/mcp text-to-json-mcp convertPromptToJson "The login API is returning 500 errors for some users. It seems to happen when they have special characters in their email addresses. We need to fix this ASAP because it's blocking customer access."

结构化输出:

{
  "success": true,
  "data": {
    "task": "Fix login API 500 errors for users with special characters in email addresses",
    "intent": "To resolve production blocking issue and restore customer access",
    "inputs": {
      "required": [
        "Input text or prompt",
        "Context or background information"
      ],
      "optional": [
        "Additional context",
        "Preferences or style guidelines"
      ],
      "constraints": [
        "Available time and resources",
        "Technical limitations"
      ]
    },
    "outputs": {
      "primary": "API",
      "secondary": [
        "Documentation or instructions",
        "Quality assurance metrics"
      ],
      "format": "JSON"
    },
    "clarity_gaps": [
      "Missing specific error details and stack traces",
      "Unclear which special characters are problematic",
      "Missing user impact metrics and urgency level"
    ]
  },
  "processing_time_ms": 8
}

示例3:代码审查反馈结构

场景:您正在审查一个pull请求,并希望系统地组织您的反馈。

原始请求: *此服务层中的错误处理不一致。有些方法返回null,有些方法抛出异常,有些方法返回空对象。我们应该在所有方法中对此进行标准化*

将文本转换为json-mcp:

/mcp text-to-json-mcp convertPromptToJson "The error handling in this service layer is inconsistent. Some methods return null, others throw exceptions, and some return empty objects. We should standardize this across all methods."

结构化输出:

{
  "success": true,
  "data": {
    "task": "Standardize error handling across service layer methods",
    "intent": "To create consistent error handling patterns for better maintainability",
    "inputs": {
      "required": [
        "Input text or prompt",
        "Context or background information"
      ],
      "optional": [
        "Additional context",
        "Preferences or style guidelines"
      ],
      "constraints": [
        "Available time and resources",
        "Technical limitations"
      ]
    },
    "outputs": {
      "primary": "Layer",
      "secondary": [
        "Documentation or instructions",
        "Quality assurance metrics"
      ],
      "format": "JSON"
    },
    "clarity_gaps": [
      "Missing specific error handling strategy (null vs exceptions vs empty objects)",
      "Unclear scope of methods to be updated",
      "Missing migration plan for existing code"
    ]
  },
  "processing_time_ms": 10
}

示例4:Sprint计划和任务分解

场景:在冲刺计划期间,您需要快速构建利益相关者的新功能请求。

原始请求: *“我们需要一个仪表板,显示用户分析,包括登录频率、功能使用和保留指标。它应该是实时的,可以导出到CSV。设计团队希望它与我们的新设计系统相匹配。”*

将文本转换为json-mcp:

/mcp text-to-json-mcp convertPromptToJson "We need a dashboard that shows user analytics including login frequency, feature usage, and retention metrics. It should be real-time and exportable to CSV. The design team wants it to match our new design system."

结构化输出:

{
  "success": true,
  "data": {
    "task": "Create user analytics dashboard with real-time data and CSV export",
    "intent": "To provide stakeholders with comprehensive user behavior insights",
    "inputs": {
      "required": [
        "Input text or prompt",
        "Context or background information"
      ],
      "optional": [
        "Additional context",
        "Preferences or style guidelines"
      ],
      "constraints": [
        "Available time and resources",
        "Technical limitations"
      ]
    },
    "outputs": {
      "primary": "Dashboard",
      "secondary": [
        "Documentation or instructions",
        "Quality assurance metrics"
      ],
      "format": "JSON"
    },
    "clarity_gaps": [
      "Missing specific metrics calculation methods",
      "Unclear real-time update frequency requirements",
      "Missing design system component specifications",
      "Missing data retention and privacy requirements"
    ]
  },
  "processing_time_ms": 15
}

实时使用的好处

  1. 直接结构:在几秒钟内将模糊的请求转化为可操作的任务
  2. 差距识别:在开始开发之前发现缺失的需求
  3. 团队沟通:在代码审查期间提供结构化反馈
  4. Sprint计划:将功能分解为清晰、可衡量的任务
  5. 文档:为项目管理工具生成一致的任务描述
  6. 质量保证:在不清楚的规格成为bug之前识别它们
  7. 入职:帮助新团队成员快速了解需求
  8. 利益相关者协调:确保每个人对请求都有相同的理解

与开发工作流集成

  • 站立时:快速构建功能请求和错误报告
  • 代码评审:结构反馈和改进建议
  • Sprint计划:将史诗分解为可操作的故事
  • 缺陷类选:结构问题描述,以便更好地跟踪
  • API设计:结构端点要求和规范
  • 测试:结构测试用例要求和验收标准

贡献

  1. 分叉存储库
  2. 创建要素分支: git checkout -b feature/amazing-feature
  3. 提交您的更改: git commit -m 'Add amazing feature'
  4. 推到分支: git push origin feature/amazing-feature
  5. 打开拉取请求

许可证

此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。

支持

  • 问题:
  • 讨论:
  • 文档:

路线图

  • \[\]支持多种输出格式(YAML、XML等)
  • \[\]自定义架构定义
  • \[\]批处理能力
  • \[\]与流行的AI平台集成
  • \[\]面向非技术用户的Web界面
  • \[\]自定义分析器的插件系统

目录标签

目录标签

文本处理本地运行JavaScriptCursor开发工具本地部署JSON转换IDE集成

支持客户端

Cursor

接入字段

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

stdio

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

oauth

运行时(runtime,运行环境)

Node.js

来源包(packageName,安装包名)

text-to-json-mcp

工具数量(toolCount,工具数)

3

资源数量(resourceCount,资源数)

0

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

0

权限和风险

stdiooauth部署方式未说明

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

安装前确认

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

来源信息

继续浏览同类 MCP