Business Problem
API documentation is perpetually outdated. Developers change endpoints but forget to update docs. New team members struggle with incorrect examples.
Solution Overview
Connect GitHub MCP Server with OpenAPI MCP Server and Mintlify to automatically generate docs from code, validate examples, and publish updates on every merge.
Implementation Steps
Extract API Schema
Parse OpenAPI specs or code annotations to extract endpoint definitions.
Generate Documentation
Create formatted documentation pages with descriptions, parameters, and examples.
Validate Examples
Test all code examples against the live API to ensure they work.
async function syncDocs() {
const spec = await openapi.loadSpec({ url: `${API_URL}/openapi.json` });
const endpoints = await openapi.listEndpoints();
for (const endpoint of endpoints) {
const doc = generateDocPage(endpoint);
await mintlify.updatePage({ slug: endpoint.path, content: doc });
}
await mintlify.deploy();
}Auto-Publish on Merge
Trigger documentation regeneration when API code merges to main.
Code Examples
function generateDocPage(endpoint) {
return `# ${endpoint.method.toUpperCase()} ${endpoint.path}\n\n${endpoint.description}\n\n## Parameters\n${formatParams(endpoint.parameters)}\n\n## Example\n\`\`\`bash\ncurl -X ${endpoint.method} ${API_URL}${endpoint.path}\n\`\`\``;
}