MCP API Reference
Maguyva.ai provides a comprehensive Model Context Protocol (MCP) API that enables intelligent code search, analysis, and workflow assistance. This reference guide covers all available API methods and their usage.
API Overview
The Maguyva.ai MCP API is organized into four main categories:
- 🔍 Core Search Tools - Advanced search capabilities across your codebase
- 📊 Code Analysis Tools - Deep code analysis and relationship mapping
- 📈 Namespace Management - Organize and monitor your code repositories
- 🔧 Utility Tools - AI-powered workflow assistance
Core Search Tools
1. code_search
Intelligent Composite Search - Automatically selects the best search strategy based on your query.
mcp__maguyva__code_search(
query: str | List[float] | int, # Search query (string/embedding/symbol_id)
mode: str = "auto", # auto|semantic|fuzzy|hybrid|vector|text|graph
namespace: str = "default", # Target namespace
limit: int = 10, # Results limit (1-100)
threshold: float = 0.6, # Similarity threshold (0.0-1.0)
include_context: bool = True, # Include context information
search_mode: str = "auto", # fast|balanced|deep|custom
ef_search: int = None, # Custom HNSW parameter
rrf_k: int = 60 # RRF fusion parameter
)Parameters:
query- Your search input (text, embedding vector, or symbol ID)mode- Search strategy:auto- Automatically selects best modesemantic- Meaning-based searchfuzzy- Approximate text matchinghybrid- Combines multiple strategiesvector- Pure embedding searchtext- Exact text matchinggraph- Symbol relationship traversal
namespace- Repository or project identifierlimit- Maximum number of results (1-100)threshold- Minimum similarity score (0.0-1.0)include_context- Add surrounding code contextsearch_mode- Performance vs accuracy trade-offef_search- Advanced HNSW tuning parameterrrf_k- Reciprocal Rank Fusion parameter for hybrid search
Example Use Cases:
- Finding all implementations of a specific function
- Searching for code similar to a given example
- Locating all references to a particular API
2. vector_search
Pure Semantic Search - Direct embedding-based similarity search for precise semantic matching.
mcp__maguyva__vector_search(
query_embedding: bytes | List[int], # Binary embedding vector
namespace: str, # Namespace UUID
ef_preset: str = "balanced", # fast|balanced|deep
limit: int = 20, # Results limit
similarity_threshold: float = 0.7, # Min similarity score
include_metadata: bool = True # Include result metadata
)Parameters:
query_embedding- Pre-computed embedding vectornamespace- Target namespace UUIDef_preset- Search accuracy preset:fast- Quick results, lower accuracybalanced- Good trade-off (default)deep- Higher accuracy, slower
limit- Maximum results to returnsimilarity_threshold- Minimum cosine similarity (0.0-1.0)include_metadata- Return additional file/symbol metadata
Example Use Cases:
- Finding semantically similar code patterns
- Identifying duplicate or near-duplicate implementations
- Discovering related functionality across the codebase
3. text_search
Trigram Text Search - Fast text-based search with fuzzy matching capabilities.
mcp__maguyva__text_search(
query: str, # Search text
namespace: str, # Namespace UUID
mode: str = "fuzzy", # fuzzy|exact|regex
case_sensitive: bool = False, # Case sensitivity
language_filter: str = None, # Filter by language
limit: int = 15, # Results limit
include_preview: bool = True # Include content preview
)Parameters:
query- Text to search fornamespace- Target namespace UUIDmode- Search matching mode:fuzzy- Approximate matching (typo-tolerant)exact- Exact string matchingregex- Regular expression search
case_sensitive- Enable case-sensitive matchinglanguage_filter- Limit to specific programming languagelimit- Maximum resultsinclude_preview- Show code preview snippets
Example Use Cases:
- Finding specific error messages or log statements
- Searching for variable or function names
- Locating comments or documentation strings
4. graph_search
Symbol Relationship Traversal - Navigate code relationships and dependencies.
mcp__maguyva__graph_search(
start_symbol: int, # Starting symbol ID
namespace: str, # Namespace UUID
relationships: List[str] = ["CALLS", "IMPORTS", "REFERS"],
direction: str = "out", # out|in|both
max_depth: int = 2, # Traversal depth (1-5)
limit: int = 50 # Max results
)Parameters:
start_symbol- Symbol ID to start traversal fromnamespace- Target namespace UUIDrelationships- Types of relationships to follow:CALLS- Function/method callsIMPORTS- Import statementsREFERS- References and usagesEXTENDS- Inheritance relationshipsIMPLEMENTS- Interface implementations
direction- Traversal direction:out- From symbol to dependenciesin- From dependencies to symbolboth- Bidirectional traversal
max_depth- How many levels to traverse (1-5)limit- Maximum results to return
Example Use Cases:
- Finding all functions that call a specific method
- Tracing dependency chains
- Understanding impact of code changes
Code Analysis Tools
5. find_symbol_comprehensive
Enhanced Symbol Finding - Comprehensive symbol search with reference tracking.
mcp__maguyva__find_symbol_comprehensive(
symbol_name: str, # Symbol to find
symbol_kind: str = None, # function|class|variable|method
namespace: str, # Target namespace
include_references: bool = True, # Include usage references
max_references: int = 50, # Limit references
include_definitions: bool = True # Include definitions
)Parameters:
symbol_name- Name of the symbol to findsymbol_kind- Type of symbol:function- Standalone functionsclass- Class definitionsvariable- Variables and constantsmethod- Class methodsinterface- Interface definitionsenum- Enumeration types
namespace- Target namespaceinclude_references- Find where symbol is usedmax_references- Limit number of referencesinclude_definitions- Include symbol definitions
Example Use Cases:
- Finding all usages of a function or class
- Refactoring symbol names
- Understanding symbol scope and visibility
6. analyze_code_relationships
Dependency Analysis - Analyze relationships and dependencies in your code.
mcp__maguyva__analyze_code_relationships(
target: str, # File path or symbol
analysis_type: str = "dependencies", # dependencies|callers|imports|inheritance
namespace: str, # Target namespace
max_depth: int = 3, # Analysis depth
include_external: bool = False, # Include external deps
include_tests: bool = True # Include test files
)Parameters:
target- File path or symbol name to analyzeanalysis_type- Type of analysis:dependencies- What this code depends oncallers- What calls this codeimports- Import relationshipsinheritance- Class hierarchy
namespace- Target namespacemax_depth- How deep to analyze (1-5)include_external- Include external library dependenciesinclude_tests- Include test file relationships
Example Use Cases:
- Understanding code dependencies before refactoring
- Identifying potential breaking changes
- Mapping module relationships
7. get_code_context
Task-Oriented Context - Get relevant code context for specific tasks.
mcp__maguyva__get_code_context(
task_description: str, # What you're trying to do
namespace: str, # Target namespace
max_files: int = 20, # Max files to analyze
include_dependencies: bool = True, # Include related code
context_type: str = "implementation",# implementation|debugging|testing
include_examples: bool = True # Include usage examples
)Parameters:
task_description- Natural language description of your tasknamespace- Target namespacemax_files- Maximum files to includeinclude_dependencies- Add dependent codecontext_type- Type of context needed:implementation- For writing new codedebugging- For fixing issuestesting- For writing testsrefactoring- For code improvements
include_examples- Include usage examples
Example Use Cases:
- Getting all relevant code for implementing a feature
- Understanding code context for debugging
- Finding examples for writing tests
8. get_file_content
File Retrieval - Retrieve file contents with optional metadata.
mcp__maguyva__get_file_content(
file_path: str, # File to retrieve
namespace: str, # Target namespace
include_metadata: bool = True, # Include file metadata
line_range: List[int] = None, # [start, end] lines
syntax_highlight: bool = False # Apply syntax highlighting
)Parameters:
file_path- Path to the filenamespace- Target namespaceinclude_metadata- Return file metadata (size, language, etc.)line_range- Specific lines to retrieve [start, end]syntax_highlight- Apply syntax highlighting to output
Example Use Cases:
- Retrieving specific file contents
- Getting code snippets from large files
- Examining file metadata
Namespace Management Tools
9. list_available_namespaces
Namespace Discovery - List and filter available namespaces.
mcp__maguyva__list_available_namespaces(
filter_pattern: str = None, # Filter namespaces
include_stats: bool = True, # Include basic stats
sort_by: str = "name", # name|size|created_at|updated_at
limit: int = 100, # Max results
offset: int = 0 # Pagination offset
)Parameters:
filter_pattern- Regex pattern to filter namespacesinclude_stats- Include statistics (file count, size, etc.)sort_by- Sort order:name- Alphabeticalsize- By total sizecreated_at- Creation dateupdated_at- Last modified
limit- Maximum resultsoffset- For pagination
Example Use Cases:
- Discovering available repositories
- Finding specific project namespaces
- Monitoring namespace usage
10. get_namespace_stats
Namespace Statistics - Get detailed statistics for a namespace.
mcp__maguyva__get_namespace_stats(
namespace: str, # Target namespace
include_health: bool = True, # Health metrics
include_search_stats: bool = True, # Search performance
include_vector_stats: bool = True, # Vector index stats
include_growth_trends: bool = False # Historical trends
)Parameters:
namespace- Target namespaceinclude_health- System health metricsinclude_search_stats- Search performance datainclude_vector_stats- Vector index statisticsinclude_growth_trends- Historical growth data
Returns:
- File and symbol counts
- Index health status
- Search performance metrics
- Storage utilization
- Growth trends (if requested)
Example Use Cases:
- Monitoring namespace health
- Optimizing search performance
- Tracking codebase growth
Utility Tools
11. get_workflow_suggestions
AI Workflow Assistance - Get intelligent suggestions for your current task.
mcp__maguyva__get_workflow_suggestions(
context: str, # Current task context
current_files: List[str] = None, # Files being worked on
task_type: str = "development", # development|debugging|testing|refactoring
namespace: str, # Target namespace
max_suggestions: int = 5, # Max suggestions
include_examples: bool = True # Include code examples
)Parameters:
context- Description of what you’re working oncurrent_files- Files currently open or being editedtask_type- Type of work:development- Writing new featuresdebugging- Fixing bugstesting- Writing testsrefactoring- Improving code
namespace- Target namespacemax_suggestions- Maximum suggestions to returninclude_examples- Include code examples with suggestions
Returns:
- Suggested next steps
- Relevant files to examine
- Code patterns to follow
- Potential issues to watch for
- Example implementations
Example Use Cases:
- Getting guidance on implementing features
- Finding relevant examples in the codebase
- Understanding best practices for the project
Common Usage Patterns
Finding and Understanding Code
# Find all implementations of a function
results = mcp__maguyva__find_symbol_comprehensive(
symbol_name="processPayment",
symbol_kind="function",
namespace="your-namespace"
)
# Get context for understanding the code
context = mcp__maguyva__get_code_context(
task_description="understand payment processing flow",
namespace="your-namespace",
context_type="debugging"
)Analyzing Dependencies
# Analyze what a module depends on
deps = mcp__maguyva__analyze_code_relationships(
target="src/payments/processor.py",
analysis_type="dependencies",
namespace="your-namespace"
)
# Find what calls a specific function
callers = mcp__maguyva__analyze_code_relationships(
target="processPayment",
analysis_type="callers",
namespace="your-namespace"
)Intelligent Search
# Semantic search for similar code
results = mcp__maguyva__code_search(
query="validate user input and sanitize data",
mode="semantic",
namespace="your-namespace"
)
# Fast text search with fuzzy matching
results = mcp__maguyva__text_search(
query="TODO",
mode="fuzzy",
namespace="your-namespace"
)Best Practices
Choose the Right Search Mode: Use
automode for general searches, but specify a mode when you know exactly what you need.Optimize Performance: Use
fastpresets for interactive searches,deepfor comprehensive analysis.Leverage Context: Always include context when available - it significantly improves result relevance.
Use Namespaces: Properly organize your code into namespaces for better performance and organization.
Combine Tools: Use multiple API methods together for comprehensive analysis (e.g., find symbol, then analyze relationships).
Rate Limits and Performance
- Search operations: Optimized for sub-second response times
- Analysis operations: May take 1-5 seconds depending on scope
- File operations: Near-instant for individual files
- Batch operations: Consider pagination for large result sets
Error Handling
All API methods return structured responses with:
success: Boolean indicating operation successdata: Result data when successfulerror: Error message if operation failedmetadata: Additional information about the operation
Always check the success field before processing results.
Getting Started
To start using the MCP API:
- Connect to your Maguyva.ai instance
- Authenticate with your API credentials
- Select your target namespace
- Begin with simple searches and gradually explore advanced features
For detailed integration instructions, see the MCP installation guide.