ctx/mcp/mod.rs
1//! MCP (Model Context Protocol) server implementation for ctx.
2//!
3//! This module exposes ctx's code intelligence capabilities via the MCP protocol,
4//! allowing AI assistants like Claude to query codebases through standardized tools.
5//!
6//! # Available Tools
7//!
8//! - `search_symbols`: Search for symbols by name pattern
9//! - `get_definition`: Get the source code for a symbol
10//! - `find_references`: Find all references to a symbol
11//! - `get_callers`: Get functions that call a given function
12//! - `get_callees`: Get functions called by a given function
13//! - `get_file`: Read a file's contents
14//! - `get_file_tree`: List files in the project
15//! - `smart_context`: Intelligently select files for a task
16//!
17//! # Usage
18//!
19//! Start the MCP server with:
20//! ```bash
21//! ctx serve --mcp
22//! ```
23//!
24//! Configure Claude Desktop by adding to `claude_desktop_config.json`:
25//! ```json
26//! {
27//! "mcpServers": {
28//! "ctx": {
29//! "command": "ctx",
30//! "args": ["serve", "--mcp"],
31//! "cwd": "/path/to/your/project"
32//! }
33//! }
34//! }
35//! ```
36
37pub mod server;
38pub mod tools;
39
40pub use server::{run_mcp_server, CtxServer};
41
42#[cfg(test)]
43mod tests {
44 use super::*;
45
46 #[test]
47 fn test_mcp_module_exports() {
48 // Basic sanity check that the module compiles and exports work
49 let _ = std::any::TypeId::of::<CtxServer>();
50 }
51}