Context7
ส่งคู่มือการใช้ไลบรารีและเฟรมเวิร์กรุ่นล่าสุดให้ AI อ่านก่อนตอบ ช่วยให้โค้ดที่ AI เขียนไม่ใช้คำสั่งเก่าที่เลิกใช้แล้ว
คำอธิบายจากผู้ทำ (ภาษาอังกฤษตามต้นฉบับ)
JSON contract registry and validator for structured LLM and agent outputs.
สามเรื่องนี้ไม่รวมเป็นคะแนนเดียว เพราะความเห็น การวัด และความนิยม เป็นคนละเรื่องกัน
ตัวนี้ยังไม่ได้เรียบเรียงเป็นภาษาไทย ด้านล่างคือข้อเท็จจริงที่เราอ่านจาก registry
เลือกโปรแกรม AI ที่คุณใช้ แล้วคัดลอกค่าตั้งไปวาง
JSON_CONTRACTS_DIRต้องเตรียมก่อน
คุณใช้แอปไหน
เลือกแอปด้านบน เราจำไว้ให้ ครั้งหน้าปุ่มจะขึ้นว่า “ติดตั้งลง …”
เปิด Claude Desktop → Settings → Developer → Edit Config แล้ววางค่านี้ในไฟล์ claude_desktop_config.json
{
"mcpServers": {
"json-contracts": {
"command": "npx",
"args": [
"-y",
"json-contracts"
],
"env": {
"JSON_CONTRACTS_DIR": "ใส่ค่าของคุณ"
}
}
}
}พิมพ์คำสั่งนี้ใน Terminal
claude mcp add json-contracts --env JSON_CONTRACTS_DIR='ใส่ค่าของคุณ' -- npx -y json-contractsเติมค่าที่เว้นว่างไว้ก่อนรัน
วางในไฟล์ .cursor/mcp.json ของโปรเจกต์ หรือ ~/.cursor/mcp.json
{
"mcpServers": {
"json-contracts": {
"command": "npx",
"args": [
"-y",
"json-contracts"
],
"env": {
"JSON_CONTRACTS_DIR": "ใส่ค่าของคุณ"
}
}
}
}เบราว์เซอร์จะถามก่อนเปิดแอป จากนั้นแอปแสดงค่าตั้งให้ตรวจแล้วกดยืนยัน ช่อง key เว้นว่างไว้ให้คุณใส่เอง
วางในไฟล์ .vscode/mcp.json ของโปรเจกต์
{
"servers": {
"json-contracts": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"json-contracts"
],
"env": {
"JSON_CONTRACTS_DIR": "ใส่ค่าของคุณ"
}
}
}
}เบราว์เซอร์จะถามก่อนเปิดแอป จากนั้นแอปแสดงค่าตั้งให้ตรวจแล้วกดยืนยัน ช่อง key เว้นว่างไว้ให้คุณใส่เอง
ตัวนี้รันในเครื่องคุณ แต่ ChatGPT ต่อได้เฉพาะ server บนอินเทอร์เน็ต ลองเลือกแอปอื่น
ตัวเลือกเก็บในคุกกี้บนเครื่องนี้ ไม่ต้องมีบัญชี
JSON_CONTRACTS_DIR envค่าตั้งนี้สร้างจากข้อมูลใน registry ของผู้ทำ ถ้าไม่ตรงกับ README ให้เชื่อ README
รันในเครื่องคุณ รายการเครื่องมือจะขึ้นในแอป AI หลังติดตั้ง
เราตรวจจากข้อมูลที่ใครก็เปิดดูได้ ยังไม่ได้อ่านโค้ด ข้อที่ไม่เกี่ยวกับตัวนี้ไม่นับในตัวหาร · ตรวจเมื่อ 6 พ.ย. 2569
ชื่อใน registry ยืนยันด้วยบัญชี GitHub json-contracts ซึ่งเป็นเจ้าของ repo
ยังไม่ได้อ่านข้อมูล repo จาก GitHub
ยังไม่ได้อ่านข้อมูล repo จาก GitHub
ตัวนี้รันบนเครื่องคุณ ไม่มี endpoint บนอินเทอร์เน็ต
ตัวนี้รันบนเครื่อง ใช้ค่าที่ตั้งในเครื่องแทน
รันในเครื่องคุณ เราอ่านรายการเครื่องมือได้เฉพาะตัวที่มี endpoint บนอินเทอร์เน็ต
เทียบกับทุก server ที่ยังใช้งานในหมวดนี้ทั้งทะเบียน ดาวนับเฉพาะเมื่อผู้ลงทะเบียนเป็นเจ้าของ repo
จากการตรวจเบื้องต้นของเรา ผ่าน 1 จาก 1 ข้อที่ตรวจได้ เรายังไม่ได้อ่านโค้ด ก่อนใส่กุญแจหรือ token ให้ดูว่า server ขอสิทธิ์อะไร และเลือกกุญแจที่ทำได้เท่าที่จำเป็น
registry ไม่ได้ระบุว่าต้องใช้กุญแจ แต่บางตัวจะขอให้ล็อกอินตอนใช้ครั้งแรก
รันบนเครื่องของคุณ โปรแกรม AI จะเปิด server ขึ้นมาเองเมื่อใช้ ข้อมูลไม่ต้องผ่านเซิร์ฟเวอร์ของผู้ทำ (ยกเว้นตัวที่ไปเรียกบริการออนไลน์ต่อ)
repo บน GitHub มีการแก้โค้ดล่าสุด – และส่งรุ่นล่าสุด (0.1.2) เข้า registry 6 เดือนที่ผ่านมา
โปรแกรมที่รองรับ MCP เช่น Claude Desktop, Claude Code, Cursor และ VS Code ตัวนี้ต้องมี Node.js ในเครื่องด้วย
ในหมวดเดียวกันมี Context7, Codebase Memory, Exa
server หมวดเดียวกันจากผู้ทำคนอื่น เรียงตามดาว
อ่านการ์ด:★ ดาว GitHubiสามเสา: รีวิว · ผลตรวจ · การใช้งานiอัปเดต = วันที่ส่งรุ่นล่าสุดเข้า registryi
ส่งคู่มือการใช้ไลบรารีและเฟรมเวิร์กรุ่นล่าสุดให้ AI อ่านก่อนตอบ ช่วยให้โค้ดที่ AI เขียนไม่ใช้คำสั่งเก่าที่เลิกใช้แล้ว
Codebase knowledge graph for AI agents — 162 languages, sub-ms queries, 99% fewer tokens.
Connect AI agents to Exa for web search, content fetching, and multi-step research.
ส่วนนี้คัดจาก repo ของผู้ทำตามต้นฉบับ PopNx MCP ไม่ได้ตรวจหรือรับรองเนื้อหา ตัด HTML รูปภาพ และสคริปต์ออกแล้ว ลิงก์จะพาออกนอกเว็บ
JSON Contracts is a local MCP contract server for natural-language-to-JSON workflows. It gives agents Git-controlled JSON contracts, rules, examples, and JSON Schema validation tools so any model can reliably convert natural-language requests into schema-valid JSON.
The MCP server does not call an LLM provider. The MCP server does not need API keys. The MCP server does not use BAML, LangChain, Markdown, or a DSL. The MCP server does not use MCP sampling. The MCP server does not generate JSON by itself.
The optional Studio is a separate package/repo for live demos and local contract testing. The MCP stdio server itself does not call LLM providers.
Your user provides natural language. Your agent chooses the model. Your agent performs the natural-language-to-JSON conversion. json-contracts provides the contract and validates the result.
Not this:
json-contracts = generator
This:
json-contracts = schema contract registry + validator
Like TypeScript:
developer writes code
TypeScript validates it
With json-contracts:
agent writes JSON
json-contracts validates it
User
↓ Agent using whatever model the user picked ↓ json-contracts MCP server
Agent generates or repairs JSON itself ↓ App consumes valid JSON
The MCP server never performs natural-language-to-JSON conversion itself. It only provides contracts, validation, and repair guidance.
Install globally:
npm install -g json-contracts
json-contracts --help
Or run without installing:
npx -y json-contracts@latest
The npm package is json-contracts; the installed CLI binary is still json-contracts.
Create a starter contract folder and validate it:
mkdir my-json-contracts
cd my-json-contracts npx -y json-contracts@latest init npx -y json-contracts@latest validate
Then add the MCP config below to your agent host. Point JSON_CONTRACTS_DIR at the json-contracts folder that init created.
Validate contracts in CI without starting MCP:
npx -y json-contracts@latest validate --contracts ./json-contracts
npx -y json-contracts@latest lint --strict --contracts ./json-contracts
By default, the server starts as a local stdio MCP server and loads contracts from:
./json-contracts
{
"mcpServers": { "json-contracts": { "command": "npx", "args": ["-y", "json-contracts@latest"], "env": { "JSON_CONTRACTS_DIR": "./json-contracts" } } } }
Adding a new behavior only requires adding a new .json file to the contracts folder. No MCP config change is required.
Most MCP hosts use the same stdio shape. Adapt paths for your machine and point JSON_CONTRACTS_DIR at your app-owned contracts folder.
{
"mcpServers": { "json-contracts": { "command": "npx", "args": ["-y", "json-contracts@latest"], "env": { "JSON_CONTRACTS_DIR": "/absolute/path/to/json-contracts" } } } }
{
"mcpServers": { "json-contracts": { "command": "npx", "args": ["-y", "json-contracts@latest"], "env": { "JSON_CONTRACTS_DIR": "./json-contracts" } } } }
{
"name": "json-contracts", "command": "npx", "args": ["-y", "json-contracts@latest"], "env": { "JSON_CONTRACTS_DIR": "./json-contracts" } }
If npx startup is too slow or your host requires explicit executables, install globally and use:
{
"command": "json-contracts", "args": [] }
Use json-contracts as a local contract/validation tool beside the model your app already uses.
If your agent host supports MCP, add the server config above and point JSON_CONTRACTS_DIR at the contracts folder your app owns.
If your app has its own agent runtime, connect to the same MCP stdio server and call the tools directly. The important part is the flow, not the host.
Create files such as:
json-contracts/support-ticket.json
json-contracts/real-estate-lead.json json-contracts/chart-generation.json
Each file contains:
schema for the final JSON shaperules for app-specific mapping behaviorexamples for model guidanceoperations for create/edit behaviorcontextDo not hide runtime variables in the user prompt. Pass them as context:
{
"contract": "real-estate-lead", "input": "I'm pre-approved for a 4 bedroom house in Durham NC up to 900k.", "context": { "current_datetime": "2026-05-03T00:00:00Z", "email": "JohnnyAppleseed@gmail.com", "source": "website-lead-form" } }
json-contracts passes context through unchanged. Contracts decide how to use it through rules/examples. The final JSON still must match the schema.
Use this as the system/developer instruction for your agent:
When converting natural language into app JSON, use json-contracts.
Create flow:
Edit flow:
Never skip validation. Never add fields that are not allowed by the schema. Do not copy context fields into output unless the schema allows them and the contract rules say to use them.
At request time, your app should do:
user input + app context
-> get_json_contract or get_edit_contract -> your chosen model generates JSON -> validate_json -> if invalid: get_repair_contract -> model repairs -> validate_json -> app consumes valid JSON
The MCP server does not call the model and does not mutate output. Your app/agent remains in control of model choice, provider keys, context, and business defaults.
Each contract is one .json file in json-contracts/.
The contract name is derived from the filename:
json-contracts/support-ticket.json -> support-ticket
There is no manifest file and no manually maintained resources file. Git handles versioning.
{
"description": "Convert natural language into a support ticket object.", "rules": [ "If the user says urgent, severity must be critical.", "Summary must be under 80 characters.", "Category must be authentication, billing, bug, feature_request, or other." ], "operations": { "create": { "enabled": true }, "edit": { "enabled": true, "return": "full_object", "rules": [ "Start from currentJson.", "Apply only the user's requested change.", "Preserve all unspecified fields exactly.", "Return the complete updated JSON object." ] } }, "schema": { "type": "object", "additionalProperties": false, "properties": { "summary": { "type": "string", "maxLength": 80 }, "severity": { "type": "string", "enum": ["low", "medium", "high", "critical"] }, "category": { "type": "string", "enum": ["authentication", "billing", "bug", "feature_request", "other"] } }, "required": ["summary", "severity", "category"] }, "examples": [ { "input": "Urgent, users cannot log in after SSO update.", "output": { "summary": "Users cannot log in after SSO update", "severity": "critical", "category": "authentication" } } ] }
Rules:
schema is required and must be valid JSON Schema. Omit $schema for the default 2020-12 validator, or set $schema to draft-07 or 2020-12 explicitly.description is optional but recommended.rules is optional and defaults to [].examples is optional and defaults to []. Example output values must validate against schema.operations is optional and defaults to enabled create and edit operations. Operation metadata belongs at the top level, not inside the JSON Schema.name is optional, but the filename is the source of truth.version field is rejected; use Git for versioning.The default json-contracts/ folder includes examples from different app categories where teams commonly rebuild the same AI glue code:
| Contract | Industry/app pattern | Converts natural language into |
|---|---|---|
support-ticket | SaaS support | Triage-ready support tickets. |
create-filter | Internal tools/API builders | API filter objects. |
chart-generation | BI/analytics tools | Dashboard chart generation specs. |
patient-intake | Healthcare intake | Triage and appointment-routing objects. |
ecommerce-return | Ecommerce support | Return, refund, exchange, and warranty requests. |
real-estate-lead | Real estate CRM | Buyer, renter, seller, and lease lead profiles. |
legal-client-intake | Legal tech intake | Matter routing and conflict-check data. |
expense-report | Finance/expense apps | Reimbursement and expense line items. |
Each one uses the same MCP tools: read the contract, let the model create or edit JSON, validate it, and repair if needed. New apps should not need a new bespoke prompt framework just to get reliable JSON.
Every loaded contract is exposed dynamically as:
json-contract://{contractName}
Examples:
json-contract://support-ticket
json-contract://create-filter json-contract://chart-generation
resources/list returns all loaded contracts. resources/read returns the normalized full contract JSON.
list_contractsInput:
{}
Output:
{
"contracts": [ { "name": "support-ticket", "description": "Convert natural language into a support ticket object.", "contractHash": "sha256:...", "schemaHash": "sha256:..." } ] }
read_contractInput:
{
"contract": "support-ticket" }
Returns the selected contract's description, rules, operations, schema, examples, contractHash, and schemaHash.
Hashes are deterministic SHA-256 values over the normalized contract/schema payload. They are for logging, cache keys, and audit trails; contract files still use Git for versioning.
get_json_contractInput:
{
"contract": "support-ticket", "input": "Urgent, users cannot log in after SSO update.", "context": {} }
Output:
{
"contract": "support-ticket", "contractHash": "sha256:...", "schemaHash": "sha256:...", "operation": "create", "instructions": [ "Convert the input into JSON.", "Return JSON only.", "Do not return markdown.", "Do not include commentary.", "Do not include extra keys.", "Match the schema exactly.", "Use enum values exactly.", "Follow all rules.", "Use examples as guidance." ], "description": "Convert natural language into a support ticket object.", "rules": [ "If the user says urgent, severity must be critical.", "Summary must be under 80 characters.", "Category must
ตัดมาแค่ช่วงต้น อ่านต่อใน repo