- it turns on.
- it uses Clade Code best (so far), if on Cursor then please use any Claude models at least/GPT o models, GPT-5 is dogshit at being a guide, haiku can answer knowledge-based questions well enough
- it talks to the user properly (acts as an expert and acts moreso as “your guide” rather than “your one-shotter”)
- it uses the proper tools to search for each range of knowledge, refers back to a tool every time it tries to go to new knowledge space (aka every question)
- i think for beginners who wants a guide on Cedar, the MCP does a good enough job to get the user to get from 0-20% comfortably (give or take 3%)
- product completion wise, it feels like its at around 85-90% (90% of the rest of the work is refining the I/O)
- Quick Start - Get running in 2 minutes
- IDE Integration - Claude Code & Cursor setup
- Architecture Overview - System design
- Complete Tool Reference - All tools explained
- Documentation System - How search works
- Development Guide - Extend the system
Cedar CLI creates COMPLETE projects! The npx cedar-os-cli plant-seed command doesn't just install packages - it creates a full working application with:
- Demo frontend (Next.js/React) with Cedar pre-integrated
- Mastra backend already initialized with Cedar-OS
- All Cedar packages and dependencies pre-installed
- Working example components and configuration
DO NOT create a Next.js project first - plant-seed handles everything!
# Create and activate virtualenv (recommended)
python -m venv .venv
source .venv/bin/activate # zsh/bash
# Install (editable for console scripts)
pip install -e .
# Or install dependencies directly
pip install mcp pydantic python-dotenv supabase openai# As a module
python -m cedar_mcp
# Or as console script (after pip install -e .)
cedar-modular-mcp
# With debug logging
CEDAR_LOG_LEVEL=DEBUG python -m cedar_mcpOption 1: Global Installation (available in all projects)
# Install globally for all Claude Code sessions
claude mcp add cedar --scope user python -- -m cedar_mcp
# Verify installation
claude mcp listOption 2: Project-Specific Installation
# Install only for current project
claude mcp add cedar --scope project python -- -m cedar_mcp
# This creates a .mcp.json file in your project rootOption 3: Manual Configuration
Add to ~/.claude.json (global) or .mcp.json (project):
{
"mcpServers": {
"cedar": {
"type": "stdio",
"command": "python",
"args": ["-m", "cedar_mcp"],
"env": {
"CEDAR_LOG_LEVEL": "info",
"CEDAR_DOCS_PATH": "/path/to/local/docs"
}
}
}
}Add to ~/.cursor/mcp.json:
{
"mcpServers": {
"cedar-agentic-server": {
"command": "/ABS/PATH/TO/REPO/cedar-test/.venv/bin/python",
"args": ["-m", "cedar_mcp"],
"env": {
"CEDAR_ENV": "development",
"CEDAR_LOG_LEVEL": "info",
"PYTHONPATH": "/ABS/PATH/TO/REPO/cedar-test",
"CEDAR_DOCS_PATH": "/ABS/PATH/TO/LOCAL/DOCS"
}
}
}
}After configuration, restart your IDE. The Cedar MCP server will start automatically.
The Cedar MCP Server can be deployed to Railway as a web service with HTTP/WebSocket endpoints:
-
Push to GitHub
git add . git commit -m "Add Railway deployment" git push origin main
-
Deploy on Railway
- Go to Railway.app
- Click "New Project" → "Deploy from GitHub repo"
- Select your repository
- Railway will auto-detect the Python project
-
Configure Environment Variables in Railway Dashboard
Required:
CEDAR_LOG_LEVEL=INFO CEDAR_MCP_SIMPLIFIED_OUTPUT=trueOptional (for semantic search):
SUPABASE_URL=your_supabase_url SUPABASE_KEY=your_supabase_key OPENAI_API_KEY=your_openai_key -
Access Your Deployed Server
Railway provides a URL like
https://your-app.up.railway.appTest endpoints:
# Health check curl https://your-app.up.railway.app/health # List tools curl https://your-app.up.railway.app/tools # Execute tool curl -X POST https://your-app.up.railway.app/tool \ -H "Content-Type: application/json" \ -d '{"tool": "searchDocs", "arguments": {"query": "voice setup"}}'
The repository includes Railway-specific files:
railway.json- Railway deployment configurationcedar_mcp/web_server.py- HTTP/WebSocket wrapper for MCPDEPLOYMENT.md- Detailed deployment guide
Note: The web wrapper translates HTTP/WebSocket requests to MCP protocol calls, making the stdio-based MCP server accessible via web endpoints.
Create a .env file in the cedar-test directory:
# Optional: Semantic Search Configuration
SUPABASE_URL=your_supabase_url
SUPABASE_KEY=your_supabase_key
OPENAI_API_KEY=your_openai_key
# Optional: Custom Documentation Paths
CEDAR_DOCS_PATH=/path/to/cedar_llms_full.txt
MASTRA_DOCS_PATH=/path/to/mastra_llms_full.txt
# Output Configuration
CEDAR_MCP_SIMPLIFIED_OUTPUT=true # Simplifies tool output
# Logging
CEDAR_LOG_LEVEL=INFO # debug, info, warning, errorThe Cedar MCP (Model Context Protocol) Server is an intelligent assistant system designed to provide expert guidance for Cedar-OS implementations. It serves as an authoritative knowledge base and implementation advisor for developers working with Cedar-OS, a comprehensive framework for building AI-powered applications with voice, chat, and interactive features.
- Expert Knowledge System: Comprehensive documentation search with semantic and keyword-based retrieval
- Intelligent Installation Guidance: Project analysis and adaptive installation recommendations
- Specialized Domain Experts: Dedicated tools for Voice, Spells, and Mastra backend features
- Documentation Enforcement: Mandatory documentation verification to prevent hallucination
- Multi-Source Documentation: Supports both Cedar-OS and Mastra documentation
- Semantic Search: Optional vector-based search using Supabase and OpenAI embeddings
- Project-Aware Recommendations: Analyzes existing project structure to provide contextual advice
The MCP server acts as a bridge between AI assistants (like Claude) and the Cedar-OS documentation ecosystem, ensuring that:
- All responses are grounded in actual documentation
- Installation approaches are tailored to project requirements
- Common mistakes are prevented through proactive guidance
- Expert knowledge is consistently accessible
cedar_mcp/
│
├── Core Layer (server.py)
│ ├── MCP Server Instance
│ ├── Tool Registration
│ ├── Request Routing
│ └── Documentation Enforcement
│
├── Services Layer (services/)
│ ├── Documentation Indexing (docs.py)
│ ├── Semantic Search (semantic_search.py)
│ ├── Feature Resolution (feature.py)
│ └── Requirements Clarification (clarify.py)
│
├── Tools Layer (tools/)
│ ├── Search Tools
│ │ ├── SearchDocs (search_docs.py)
│ │ └── SearchMastraDocs (search_mastra_docs.py)
│ │
│ ├── Specialist Tools
│ │ ├── VoiceSpecialist (voice_specialist.py)
│ │ ├── SpellsSpecialist (spells_specialist.py)
│ │ └── MastraSpecialist (mastra_specialist.py)
│ │
│ ├── Installation Tools
│ │ └── CheckInstall (check_install.py)
│ │
│ └── Planning Tools
│ ├── GetRelevantFeature (get_relevant_feature.py)
│ ├── ClarifyRequirements (clarify_requirements.py)
│ └── ConfirmRequirements (confirm_requirements.py)
│
└── Configuration Layer (shared.py)
├── Constants & Rules
├── Expert Persona Configuration
├── Installation Guidelines
└── Utility Functions
- Separation of Concerns: Clear boundaries between services (business logic) and tools (MCP interface)
- Documentation-First: All responses must be grounded in searchable documentation
- Adaptive Intelligence: Tools analyze context and provide tailored recommendations
- Fail-Safe Patterns: Multiple fallback strategies for installation and implementation
- Expert Emulation: System behaves as a senior Cedar architect would
cedar-test/
├── cedar_mcp/
│ ├── __init__.py # Package initialization
│ ├── __main__.py # Entry point for module execution
│ ├── server.py # Main MCP server (315 lines)
│ ├── shared.py # Shared constants and utilities (450 lines)
│ ├── services/ # Business logic layer
│ │ ├── clarify.py # Requirements clarification
│ │ ├── docs.py # Documentation indexing and search
│ │ ├── feature.py # Feature mapping logic
│ │ ├── mastra_docs.py # Mastra documentation service
│ │ └── semantic_search.py # Vector search integration
│ └── tools/ # MCP tools layer
│ ├── check_install.py
│ ├── clarify_requirements.py
│ ├── confirm_requirements.py
│ ├── get_relevant_feature.py
│ ├── mastra_specialist.py
│ ├── search_docs.py
│ ├── search_mastra_docs.py
│ ├── spells_specialist.py
│ └── voice_specialist.py
├── docs/ # Documentation files
│ ├── cedar_llms_full.txt
│ └── mastra_llms_full.txt
├── pyproject.toml # Entrypoints & build config
├── requirements.txt # Runtime dependencies
└── README.md # This file
| Tool Name | Purpose | Mandatory Usage | Description |
|---|---|---|---|
checkInstall |
Installation analysis | YES - At conversation start | Analyzes project structure and recommends best Cedar installation approach |
searchDocs |
Cedar documentation search | YES - Before any Cedar answer | Primary documentation search with keyword and semantic capabilities |
searchMastraDocs |
Mastra documentation search | YES - For Mastra questions | Searches Mastra backend documentation |
voiceSpecialist |
Voice feature expertise | YES - For voice questions | Expert guidance for voice implementation |
spellsSpecialist |
Spells/interaction expertise | YES - For Spells questions | Guidance for AI-powered interactions |
mastraSpecialist |
Backend expertise | YES - For Mastra questions | Mastra backend and agent guidance |
getRelevantFeature |
Feature mapping | Optional | Maps user goals to Cedar features |
clarifyRequirements |
Requirement questions | Optional | Generates clarifying questions |
confirmRequirements |
Requirement validation | Optional | Validates and plans implementation |
Primary documentation search interface with mandatory usage enforcement.
Input Schema:
{
"query": "string", // Search query
"limit": 5, // Result limit (optional)
"use_semantic": true, // Use vector search (optional)
"doc_type": "auto" // "cedar" | "mastra" | "auto"
}Output:
{
"results": [
{
"source": "file path",
"heading": "section heading",
"content": "documentation excerpt",
"matchCount": 10,
"matchedTokens": {"token": count},
"citations": {
"approxSpan": {"start": 123, "end": 145}
}
}
]
}Intelligent project analysis and installation recommendation.
Project Analysis Features:
- Directory structure examination
- Package.json dependency analysis
- Framework detection (Next.js, React, Vue)
- Cedar/Mastra presence checking
- Backend component identification
Installation Strategies:
- Empty Directory →
npx cedar-os-cli plant-seed --yes - Existing Cedar →
npm install - Existing Next.js/React →
npx cedar-os-cli add-sapling --yes - Backend Only →
npx cedar-os-cli plant-seed --yes - Unknown Structure → Adaptive recommendation
Input Schema:
{
"command": "string", // Command to analyze (optional)
"packages": ["array"], // Package list (optional)
"context": "string" // Context description (optional)
}Expert guidance for voice feature implementation.
Specializations:
- Voice components (VoiceIndicator, VoiceButton, VoiceSettings)
- Microphone permission handling
- Real-time audio processing
- WebRTC integration
- OpenAI Realtime API
- Browser compatibility
Actions:
search: Find voice documentationguide: Implementation guidancetroubleshoot: Diagnose issuesexplore: Discover capabilities
Input Schema:
{
"action": "search", // "search" | "guide" | "troubleshoot" | "explore"
"query": "string", // Your question
"focus": "general" // "components" | "permissions" | "integration" | "setup"
}Expert guidance for Cedar Spells (AI-powered interactions).
Specializations:
- Spell architecture and lifecycle
- Radial menus and gestures
- Hotkey configurations
- QuestioningSpell and TooltipMenuSpell
- Custom spell creation
- Event handling patterns
Core Concepts:
- Activation modes: TOGGLE, HOLD, TRIGGER
- Event types: Hotkey, MouseEvent, SelectionEvent
- Lifecycle: onActivate, onDeactivate
- Component integration with useSpell hook
Input Schema:
{
"action": "search", // "search" | "guide" | "troubleshoot" | "explore"
"query": "string", // Your question
"focus": "general" // "creating" | "activation" | "components" | "lifecycle" | "patterns"
}Expert guidance for Mastra backend integration.
Specializations:
- Agent architecture
- Workflow design
- Tool integration
- Memory systems
- MCP setup
- Authentication
Input Schema:
{
"query": "string", // Search query
"limit": 5 // Result limit
}Maps user goals to Cedar features.
Feature Categories:
- AI Chat System
- Voice Interaction
- Floating Chat Widget
- AI Content Assistant
- AI Actions (Spells)
- Contextual AI
- Agent Backend
- State Management
- Interactive UI
- Search & Q&A
Input Schema:
{
"goal": "string", // What you want to achieve
"context": "string" // Optional project context
}Generates clarifying questions for requirements.
Question Categories:
- Scope and user goals
- Framework constraints
- Integration needs
- UI/UX requirements
Input Schema:
{
"goal": "string",
"known_constraints": ["array"]
}Validates requirements and generates implementation plan.
Input Schema:
{
"confirmations": {
"requirement_id": true/false
}
}-
Cedar Documentation (
cedar_llms_full.txt)- Comprehensive Cedar-OS component documentation
- API references and implementation examples
- Best practices and patterns
- Voice, Chat, Spells, and UI components
-
Mastra Documentation (
mastra_llms_full.txt)- Backend framework documentation
- Agent and workflow guides
- Tool development documentation
- Memory and persistence strategies
- Requires Supabase and OpenAI configuration
- Uses vector embeddings for conceptual matching
- 512-dimension embeddings with text-embedding-3-small
- Similarity threshold filtering
- Intelligent tokenization with stop-word filtering
- Weighted scoring (headings 3x body text)
- Pattern matching with suffix variants
- Special weighting for domain-specific terms
The system provides multi-level citations:
- Source File: Path to documentation file
- Heading: Section within documentation
- Line Numbers: Exact line references [file:L123-L145]
- URL: Original documentation URL when available
- Token Matches: Shows which search terms matched
The server embeds curated content from Cedar-OS docs:
- Introduction to Cedar
- Getting Started guides
- Chat implementation
- Agent Input Context
- Agentic State management
- Voice features
- Spells system
You can augment with local docs via CEDAR_DOCS_PATH.
-
Initial Setup Check
User: "I want to add Cedar to my project" AI: [Calls checkInstall] → Analyzes project → Recommends approach -
Feature Implementation
User: "Add voice features to my chat" AI: [Calls voiceSpecialist] → Searches documentation → Provides implementation guide -
Troubleshooting
User: "RadialMenu not appearing" AI: [Calls spellsSpecialist with action="troubleshoot"] → Diagnoses issue
- Always Start with checkInstall: Ensures proper Cedar setup
- Use Specialist Tools: Get domain-specific guidance
- Verify with Documentation: All advice should reference docs
- Follow Installation Sequence: Try recommended approach first
1. checkInstall → Empty directory detected
2. Recommends: npx cedar-os-cli plant-seed --yes
3. Creates complete project structure
1. checkInstall → Existing Next.js detected
2. Recommends: npx cedar-os-cli add-sapling --yes
3. Preserves existing code, adds Cedar
1. voiceSpecialist("search", "VoiceButton setup")
2. Returns documentation with examples
3. voiceSpecialist("guide", "microphone permissions")
4. Provides implementation steps
The main server class that orchestrates all MCP operations.
Key Responsibilities:
- Initialize and manage documentation indexes (Cedar and Mastra)
- Register and coordinate all tools
- Enforce documentation search requirements
- Track tool usage and validation
- Handle MCP protocol communication
Critical Features:
- Dual Documentation Support: Maintains separate indexes for Cedar and Mastra docs
- Tool Registration System: Dynamic registration of all available tools
- Requirements Gate: Optional confirmation system for guided workflows
- Semantic Search Integration: Automatic detection and use of vector search when available
- Documentation Enforcement: Tracks and validates documentation searches
Central configuration hub containing all constants, rules, and shared utilities.
Major Components:
-
Installation Commands & Rules
- Primary install: "npx cedar-os-cli plant-seed --yes"
- Comprehensive adaptive installation guide
- Smart detection of project type
-
Expert Persona Configuration
- Behavioral guidelines for AI assistant
- Emphasis on searching before creating
- Component location awareness
-
Error Handling Patterns
- Common error signatures requiring documentation search
- Protocol for handling Cedar-related errors
-
Implementation Rules
- Critical facts about Cedar component locations
- Mandatory scanning procedures
- Import verification requirements
Sophisticated documentation indexing and search system.
Features:
- Multi-format support (.txt, .md, .json)
- Dual parsing modes for Cedar and Mastra
- Intelligent chunking with metadata
- Hybrid search (semantic + keyword)
- Line-level citations
Vector-based search using Supabase and OpenAI.
Components:
- OpenAI text-embedding-3-small model
- Supabase vector database
- Cosine similarity matching
- Graceful fallback to keyword search
Maps user goals to relevant Cedar features through keyword and use case matching.
Generates clarifying questions and validates setup requirements.
- Create tool class in
tools/directory - Implement required methods:
list_tool(): Returns MCP tool definitionhandle(): Processes tool invocation
- Register in server.py
_init_tools()method - Add to tool_handlers dictionary
Example template:
class NewSpecialistTool:
name = "newSpecialist"
def __init__(self, docs_index: DocsIndex):
self.docs_index = docs_index
def list_tool(self) -> McpTool:
return McpTool(
name=self.name,
description="[MANDATORY] Tool description",
inputSchema={...}
)
async def handle(self, arguments: Dict[str, Any]) -> List[TextContent]:
# Implementation
pass- Place documentation file in
docs/directory - Update path resolution in server.py
- Implement parser in DocsIndex if needed
- Configure environment variable for path
- Keyword Search: Modify tokenization in
DocsIndex.search() - Semantic Search: Adjust embedding parameters in
SemanticSearchService - Ranking: Update scoring algorithm in search methods
Follow established patterns:
try:
# Main logic
result = await operation()
except SpecificException as e:
logger.error(f"Specific error: {e}")
# Return error response
except Exception as e:
logger.exception(f"Unexpected error: {e}")
# Fallback behaviorThe server implements the standard MCP protocol:
- list_tools(): Returns all available tools
- call_tool(name, arguments): Executes specific tool
- list_resources(): Lists available resources
- read_resource(uri): Reads specific resource
cedar://docs: Cedar documentation metadatamastra://docs: Mastra documentation metadata
Standard response structure:
interface ToolResponse {
action?: string; // Action performed
results?: Array<any>; // Main results
error?: string; // Error message if failed
note?: string; // Additional notes
INSTRUCTION?: string; // Usage instructions
[key: string]: any; // Additional fields
}interface SearchResult {
source: string; // Documentation source
heading?: string; // Section heading
content: string; // Content excerpt
url?: string; // Original URL
matchCount?: number; // Keyword match count
matchedTokens?: Record<string, number>; // Token hit map
similarity?: number; // Semantic similarity score
citations?: {
source: string;
approxSpan: {
start: number;
end: number;
};
tokenLines: Record<string, number[]>;
};
}When configured with Supabase and OpenAI:
- Automatic Detection: System detects availability of credentials
- Hybrid Approach: Tries semantic first, falls back to keyword
- Vector Storage: Uses Supabase vector database
- Embedding Model: OpenAI text-embedding-3-small (512 dimensions)
System maintains separate indexes for different documentation sources:
- Cedar Index: Primary Cedar-OS documentation
- Mastra Index: Backend framework documentation
- Extensible: Easy to add new documentation sources
CheckInstallTool provides sophisticated project analysis:
- Framework Detection: Identifies Next.js, React, Vue, etc.
- Dependency Analysis: Checks for Cedar/Mastra presence
- Structure Recognition: Understands project organization
- Adaptive Recommendations: Tailors approach to project state
Multiple layers ensure documentation-based responses:
- Tool Descriptions: Marked as "MANDATORY"
- Server Tracking: Logs documentation searches
- Result Instructions: Include "BASE ANSWER ON DOCUMENTATION"
- Expert Persona: Emphasizes documentation verification
-
"Not in docs" responses
- Ensure documentation files are properly loaded
- Check file paths in environment variables
- Verify documentation parsing in logs
-
Semantic search not working
- Verify Supabase and OpenAI credentials
- Check network connectivity
- Review error logs for API issues
-
Tools not appearing
- Ensure proper tool registration in server.py
- Check MCP client configuration
- Verify server is running without errors
-
Installation recommendations incorrect
- Update project analysis logic in CheckInstallTool
- Verify directory structure detection
- Check package.json parsing
Enable detailed logging:
CEDAR_LOG_LEVEL=DEBUG python -m cedar_mcpTest individual tools:
from cedar_mcp.tools.search_docs import SearchDocsTool
from cedar_mcp.services.docs import DocsIndex
# Initialize
docs_index = DocsIndex("path/to/docs.txt")
tool = SearchDocsTool(docs_index)
# Test search
import asyncio
results = asyncio.run(tool.handle({"query": "voice setup"}))
print(results)- Documentation Indexing: Chunks are created once at startup
- Search Caching: Consider implementing result caching
- Concurrent Tool Calls: Tools can be called in parallel
- Simplified Output: Reduces payload size significantly
- Memory Usage: Proportional to documentation size
- Search Performance: O(n) for keyword search, O(log n) for vector
- Tool Execution: Async design allows concurrent operations
- Store keys in environment variables
- Never commit
.envfiles - Use secure key rotation practices
- All tool inputs are validated against schemas
- Path traversal prevention in file operations
- SQL injection prevention in database queries
- Documentation content is truncated to prevent oversized responses
- Sensitive information filtered from error messages
# .env
CEDAR_LOG_LEVEL=INFO
CEDAR_MCP_SIMPLIFIED_OUTPUT=true# .env
CEDAR_LOG_LEVEL=INFO
CEDAR_MCP_SIMPLIFIED_OUTPUT=true
SUPABASE_URL=https://xxxxx.supabase.co
SUPABASE_KEY=eyJhbGciOiJIUzI1NiIs...
OPENAI_API_KEY=sk-...
CEDAR_DOCS_PATH=/custom/path/to/cedar_docs.txt
MASTRA_DOCS_PATH=/custom/path/to/mastra_docs.txt# .env
CEDAR_LOG_LEVEL=DEBUG
CEDAR_MCP_SIMPLIFIED_OUTPUT=false
# Verbose output for debugging- MCP requires an initialization handshake; prefer running inside Claude Code or Cursor to interact with tools
- Stop the server with Ctrl+C
- The server includes built-in Cedar documentation, so it can answer without network access
- You can augment with local docs via
CEDAR_DOCS_PATH
For issues, questions, or contributions:
- GitHub Issues: [Repository Issues URL]
- Documentation: Cedar-OS Documentation
- Community: Cedar Community Forum
This documentation represents the complete architecture and functionality of the Cedar MCP Server. For the latest updates, refer to the source code and inline documentation.