[package]
name = "pmcp"
version = "1.16.0"
edition = "2021"
authors = ["PAIML Team"]
description = "High-quality Rust SDK for Model Context Protocol (MCP) with full TypeScript SDK compatibility"
license = "MIT"
repository = "https://github.com/paiml/pmcp"
homepage = "https://github.com/paiml/pmcp"
documentation = "https://docs.rs/pmcp"
readme = "README.md"
keywords = ["mcp", "model-context", "sdk", "ai", "llm"]
categories = ["api-bindings", "asynchronous", "network-programming"]
rust-version = "1.82.0"
exclude = [
    "docs/",
    "packages/",
    "tests/playwright/",
    "benches/*.bak",
    "fuzz/",
    "examples/mcp-apps-chess/",
    "examples/mcp-apps-map/",
    "examples/wasm-client/",
    "examples/wasm-mcp-server/",
    "examples/cloudflare-worker-mcp/",
    "examples/26-server-tester/",
    "examples/27-course-server-minimal/",
    "examples/25-oauth-basic/",
    "examples/test-basic/",
    "examples/wasm/",
    "pmcp-book/",
    "pmcp-course/",
]

[dependencies]
# Core dependencies
serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0", features = ["raw_value", "preserve_order"] }
schemars = { version = "1.0", optional = true }
# pmcp-macros = { version = "0.1.0", path = "pmcp-macros", optional = true }
async-trait = "0.1"
thiserror = "2.0"
anyhow = "1.0"
tracing = "0.1"
http = "1.1"

# Utility dependencies (needed on all platforms)
glob = "0.3"
url = "2.5"
toml = "1.0"
uuid = { version = "1.17", features = ["v4", "serde", "js"] }
chrono = { version = "0.4", features = ["serde"] }
regex = "1.11"
lazy_static = "1.5"
urlencoding = "2.1"
indexmap = { version = "2.10", features = ["serde"] }
smallvec = { version = "1.13", features = ["serde", "union"] }
parking_lot = "0.12"
dashmap = "6.1"
bytes = { version = "1.10", optional = true }
futures = "0.3"
pmcp-widget-utils = { path = "crates/pmcp-widget-utils", version = "0.1.0" }
futures-util = { version = "0.3", optional = true }
futures-channel = { version = "0.3", optional = true }
futures-locks = { version = "0.7", optional = true, default-features = false }
pin-project = "1.1"
http-body-util = "0.1"

# OAuth dependencies
sha2 = "0.10"
base64 = "0.22"
jsonwebtoken = { version = "10.3", optional = true }

# OAuth CLI helper dependencies (feature-gated)
webbrowser = { version = "1", optional = true }
dirs = { version = "6", optional = true }
rand = { version = "0.10", optional = true }
tracing-subscriber = { version = "0.3.20", features = ["env-filter"] }

# Transport dependencies (optional, feature-gated)
tokio-tungstenite = { version = "0.28", optional = true }
hyper = { version = "1.6", features = ["full"], optional = true }
hyper-util = { version = "0.1", features = ["full"], optional = true }
hyper-rustls = { version = "0.27", default-features = false, features = ["http1", "http2", "tls12", "ring", "native-tokio"], optional = true }
rustls = { version = "0.23", default-features = false, features = ["ring", "std", "tls12"], optional = true }
axum = { version = "0.8.5", optional = true }

# File watching dependencies (optional, feature-gated)
notify = { version = "8.2", optional = true }
glob-match = { version = "0.2", optional = true }

# Validation (optional, feature-gated)
jsonschema = { version = "0.38", optional = true }
garde = { version = "0.22", optional = true }

# SIMD support (optional)
rayon = { version = "1.10", optional = true }

# Platform-specific dependencies
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
tokio = { version = "1.46", features = ["full"] }
tokio-stream = { version = "0.1.15" }
tokio-util = { version = "0.7", features = ["rt"] }
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] }

[target.'cfg(target_arch = "wasm32")'.dependencies]
wasm-bindgen = "0.2"
wasm-bindgen-futures = "0.4"
web-sys = { version = "0.3", features = ["console", "Window", "Document", "WebSocket", "MessageEvent", "CloseEvent", "ErrorEvent", "BinaryType", "Headers", "Request", "RequestInit", "Response"] }
js-sys = "0.3"
futures-channel = "0.3"
futures-locks = { version = "0.7", default-features = false }
getrandom = { version = "0.4", features = ["wasm_js"] }

[dev-dependencies]
# Testing
tempfile = "3.19"
proptest = "1.7"
quickcheck = "1.0"
quickcheck_macros = "1.1"
rstest = "0.26"
mockall = "0.14"
pretty_assertions = "1.4"
test-case = "3.3"
criterion = { version = "0.8", features = ["html_reports"] }
insta = { version = "1.43", features = ["json", "redactions"] }
mockito = "1.5.0"
tokio-util = { version = "0.7", features = ["rt"] }

# For examples
clap = { version = "4.5", features = ["derive"] }
env_logger = "0.11"
dashmap = "6.1"  # Already in main deps but needed for examples
pmcp-tasks = { path = "crates/pmcp-tasks" }  # For task examples (60_tasks_*)

[features]
default = ["validation"]
full = ["websocket", "http", "streamable-http", "sse", "validation", "resource-watcher", "rayon", "schema-generation", "jwt-auth", "composition", "mcp-apps"]
composition = ["streamable-http"]
# MCP Apps Extension - Interactive UI support for ChatGPT Apps, MCP-UI, and standard MCP hosts
mcp-apps = []
jwt-auth = ["dep:jsonwebtoken"]
oauth = ["dep:webbrowser", "dep:dirs", "dep:rand"]
sse = ["dep:bytes"]
websocket = ["dep:tokio-tungstenite"]
http = ["dep:hyper", "dep:hyper-util", "dep:bytes"]
streamable-http = ["dep:hyper", "dep:hyper-util", "dep:hyper-rustls", "dep:rustls", "dep:futures-util", "dep:bytes", "dep:axum"]
validation = ["dep:jsonschema", "dep:garde"]
resource-watcher = ["dep:notify", "dep:glob-match"]
schema-generation = ["dep:schemars"]
# macros = ["dep:pmcp-macros", "dep:schemars"]
wasm = ["websocket-wasm", "uuid/js", "dep:futures-channel", "dep:futures-locks"]
websocket-wasm = []
wasm-tokio = []
wasi-http = []  # Future: WASI HTTP support (not yet implemented)

# Example features
authentication_example = []
cancellation_example = []
progress_example = []

# Performance optimizations
unstable = []
simd = []
rayon = ["dep:rayon"]

# Testing support
test-helpers = []

[[bench]]
name = "simple_test"
harness = false

[[bench]]
name = "json_performance"
harness = false

[[bench]]
name = "protocol_serialization"
harness = false

[[bench]]
name = "transport_performance"
harness = false

[[bench]]
name = "client_server_operations"
harness = false

[[bench]]
name = "simd_performance"
harness = false

[profile.release]
codegen-units = 1
opt-level = 3
strip = true

[profile.bench]
codegen-units = 1
opt-level = 3
debug = true

[[example]]
name = "01_client_initialize"
path = "examples/01_client_initialize.rs"

[[example]]
name = "02_server_basic"
path = "examples/02_server_basic.rs"

[[example]]
name = "03_client_tools"
path = "examples/03_client_tools.rs"

[[example]]
name = "04_server_resources"
path = "examples/04_server_resources.rs"

[[example]]
name = "05_client_resources"
path = "examples/05_client_resources.rs"

[[example]]
name = "06_server_prompts"
path = "examples/06_server_prompts.rs"

[[example]]
name = "07_client_prompts"
path = "examples/07_client_prompts.rs"

[[example]]
name = "08_logging"
path = "examples/08_logging.rs"

[[example]]
name = "09_authentication"
path = "examples/09_authentication.rs"
required-features = ["authentication_example"]

[[example]]
name = "10_progress_notifications"
path = "examples/10_progress_notifications.rs"
required-features = ["progress_example"]

[[example]]
name = "11_request_cancellation"
path = "examples/11_request_cancellation.rs"
required-features = ["cancellation_example"]

[[example]]
name = "12_error_handling"
path = "examples/12_error_handling.rs"

[[example]]
name = "13_websocket_transport"
path = "examples/13_websocket_transport.rs"
required-features = ["websocket"]

[[example]]
name = "14_sampling_llm"
path = "examples/14_sampling_llm.rs"

[[example]]
name = "15_middleware"
path = "examples/15_middleware.rs"

[[example]]
name = "16_oauth_server"
path = "examples/16_oauth_server.rs"

[[example]]
name = "17_completable_prompts"
path = "examples/17_completable_prompts.rs"

[[example]]
name = "18_resource_watcher"
path = "examples/18_resource_watcher.rs"
required-features = ["resource-watcher"]

[[example]]
name = "19_elicit_input"
path = "examples/19_elicit_input.rs"

[[example]]
name = "20_oidc_discovery"
path = "examples/20_oidc_discovery.rs"

# [[example]]
# name = "21_macro_tools"
# path = "examples/21_macro_tools.rs"
# required-features = ["macros"]

[[example]]
name = "22_streamable_http_server_stateful"
path = "examples/22_streamable_http_server_stateful.rs"
required-features = ["streamable-http"]

[[example]]
name = "23_streamable_http_server_stateless"
path = "examples/23_streamable_http_server_stateless.rs"
required-features = ["streamable-http"]

[[example]]
name = "24_streamable_http_client"
path = "examples/24_streamable_http_client.rs"
required-features = ["streamable-http"]

[[example]]
name = "27_websocket_server_enhanced"
path = "examples/27_websocket_server_enhanced.rs"
required-features = ["websocket"]

[[example]]
name = "28_sse_optimized"
path = "examples/28_sse_optimized.rs"
required-features = ["sse"]

[[example]]
name = "29_connection_pool"
path = "examples/29_connection_pool.rs"
required-features = ["full"]

[[example]]
name = "30_enhanced_middleware"
path = "examples/30_enhanced_middleware.rs"
required-features = ["full"]

[[example]]
name = "31_advanced_error_recovery"
path = "examples/31_advanced_error_recovery.rs"
required-features = ["full"]

[[example]]
name = "32_typed_tools"
path = "examples/32_typed_tools.rs"
required-features = ["schema-generation"]

[[example]]
name = "33_advanced_typed_tools"
path = "examples/33_advanced_typed_tools.rs"
required-features = ["schema-generation"]

[[example]]
name = "34_serverbuilder_typed"
path = "examples/34_serverbuilder_typed.rs"
required-features = ["schema-generation"]

[[example]]
name = "35_wasm_typed_tools"
path = "examples/35_wasm_typed_tools.rs"
required-features = ["schema-generation"]

[[example]]
name = "36_typed_tool_v2_example"
path = "examples/36_typed_tool_v2_example.rs"
required-features = ["schema-generation"]

[[example]]
name = "37_description_variants_example"
path = "examples/37_description_variants_example.rs"
required-features = ["schema-generation"]

[[example]]
name = "49_tool_with_sampling_server"
path = "examples/49_tool_with_sampling_server.rs"
required-features = ["full"]

[[example]]
name = "50_workflow_minimal"
path = "examples/50_workflow_minimal.rs"

[[example]]
name = "51_workflow_error_messages"
path = "examples/51_workflow_error_messages.rs"

[[example]]
name = "52_workflow_dsl_cookbook"
path = "examples/52_workflow_dsl_cookbook.rs"

[[example]]
name = "53_typed_tools_workflow_integration"
path = "examples/53_typed_tools_workflow_integration.rs"
required-features = ["schema-generation"]

[[example]]
name = "55_server_middleware"
path = "examples/55_server_middleware.rs"
required-features = ["streamable-http"]

[[example]]
name = "56_dynamic_resources"
path = "examples/56_dynamic_resources.rs"

[[example]]
name = "57_tool_middleware_oauth"
path = "examples/57_tool_middleware_oauth.rs"

[[example]]
name = "conference_venue_map"
path = "examples/conference_venue_map.rs"
required-features = ["schema-generation"]

[[example]]
name = "hotel_gallery"
path = "examples/hotel_gallery.rs"
required-features = ["schema-generation"]

[[example]]
name = "60_tasks_basic"
path = "examples/60_tasks_basic.rs"

[[bench]]
name = "comprehensive_benchmarks"
harness = false
[workspace]
members = ["pmcp-macros", "crates/mcp-tester", "crates/mcp-preview", "crates/pmcp-tasks", "crates/mcp-e2e-tests", "crates/pmcp-widget-utils", "examples/25-oauth-basic", "examples/test-basic", "cargo-pmcp"]
# WASM examples and standalone examples are excluded from regular workspace tests
exclude = ["fuzz", "examples/cloudflare-worker-mcp", "examples/26-server-tester", "examples/27-course-server-minimal", "examples/wasm-client", "examples/mcp-apps-chess", "examples/mcp-apps-map", "examples/mcp-apps-dataviz"]

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
