DocuMCP Usage Examples
This guide provides comprehensive usage examples for DocuMCP functions, organized by common use cases and scenarios.
📚 Related Documentation
- Prompting Guide
- Repository Analysis Guide
- GitHub Markdown Guide
- TypeScript Documentation
- Model Context Protocol Specification
🎯 Repository Analysis Examples
For detailed repository analysis concepts, see the Repository Analysis Guide.
Basic Repository Analysis
import { analyzeRepository } from "./dist/tools/analyze-repository.js";
// Analyze a simple project
const analysis = await analyzeRepository({
path: "/path/to/my-project",
depth: "standard",
});
console.log(`Found ${analysis.data.structure.totalFiles} files`);
console.log(
`Primary language: ${analysis.data.recommendations.primaryLanguage}`,
);
Advanced Repository Analysis
// Deep analysis with historical context
const deepAnalysis = await analyzeRepository({
path: "/path/to/complex-project",
depth: "deep",
});
// Access detailed information
const { structure, dependencies, documentation } = deepAnalysis.data;
console.log(`Languages: ${Object.keys(structure.languages).join(", ")}`);
console.log(`Has tests: ${structure.hasTests}`);
console.log(`Has CI: ${structure.hasCI}`);
console.log(`Documentation complexity: ${documentation.estimatedComplexity}`);
🔧 SSG Recommendation Examples
Learn more about prompting and recommendations in the Prompting Guide.
Basic SSG Recommendation
import { recommendSSG } from "./dist/tools/recommend-ssg.js";
// Get recommendation based on analysis
const recommendation = await recommendSSG({
analysisId: "analysis_abc123_def456",
userId: "developer123",
});
console.log(`Recommended SSG: ${recommendation.data.recommended}`);
console.log(`Confidence: ${recommendation.data.confidence * 100}%`);
console.log(`Reasoning: ${recommendation.data.reasoning.join(", ")}`);
Personalized SSG Recommendation
// With user preferences
const personalized = await recommendSSG({
analysisId: "analysis_abc123_def456",
userId: "developer123",
preferences: {
priority: "performance",
ecosystem: "javascript",
},
});
// Compare alternatives
recommendation.data.alternatives.forEach((alt) => {
console.log(`${alt.name}: ${alt.score} (${alt.pros.join(", ")})`);
});
🚀 Deployment Examples
deploy_site generates deployment configuration files — it does not deploy directly or require any credentials. Credentials (e.g. VERCEL_TOKEN) live in GitHub Actions secrets, not in the MCP server.
Generate GitHub Pages deployment workflow
{
"tool": "deploy_site",
"arguments": {
"repository": "/path/to/project",
"ssg": "docusaurus",
"target": "github-pages"
}
}
Generates .github/workflows/deploy-docs.yml — commit it and GitHub Actions deploys automatically.
Generate Vercel deployment configuration
{
"tool": "deploy_site",
"arguments": {
"repository": "/path/to/project",
"ssg": "docusaurus",
"target": "vercel"
}
}
Generates vercel.json + .github/workflows/deploy-docs.yml. After committing:
- Run
vercel linklocally to create.vercel/project.json - Add
VERCEL_TOKEN,VERCEL_ORG_ID,VERCEL_PROJECT_IDas GitHub Actions secrets - Push — GitHub Actions deploys to Vercel automatically
See the Deploy to Vercel guide for the full walkthrough.
Related
- Prompting Guide — how to phrase prompts effectively
- Repository Analysis Guide — understanding analysis results
- Deploy to Vercel — full Vercel deployment walkthrough
- Tutorials: First Deployment — step-by-step guide
- API Reference — complete tool documentation
- Model Context Protocol — MCP specification