Skip to main content

spn_mcp/
lib.rs

1//! spn-mcp: Dynamic REST-to-MCP wrapper library
2//!
3//! This crate provides the core functionality for wrapping REST APIs as MCP tools.
4//!
5//! # Architecture
6//!
7//! ```text
8//! ~/.spn/apis/*.yaml → config::load_all_apis() → ApiConfig
9//!                                                    ↓
10//!                                            server::DynamicHandler
11//!                                                    ↓
12//!                                               MCP Server (stdio)
13//! ```
14//!
15//! # Configuration Format
16//!
17//! API configurations are YAML files in `~/.spn/apis/`:
18//!
19//! ```yaml
20//! name: example
21//! base_url: https://api.example.com/v1
22//! auth:
23//!   type: bearer
24//!   credential: example
25//! tools:
26//!   - name: get_data
27//!     method: GET
28//!     path: /data
29//! ```
30
31pub mod config;
32pub mod error;
33pub mod openapi;
34pub mod server;
35
36pub use config::{ApiConfig, AuthConfig, AuthType, ToolDef};
37pub use error::{Error, Result};
38pub use openapi::{parse_openapi, OpenApiError, OpenApiSpec};