chore(workspace): add lib/mcp to workspace, regenerate lockfile, add mcp defaults to default.yaml
zhenyi committed
Modified config/default.yaml config/default.yaml +24 −0 View config/default.yaml
@@ -455,3 +455,27 @@
455455 timeout: 10 # seconds
456456 console_log: true # keep local console output while exporting
457457 log_level: "" # empty -> "info"; apps fall back to their own richer default
458
459# -----------------------------------------------------------------------------
460# MCP (Model Context Protocol) server.
461# Single Streamable HTTP endpoint with two authentication tracks:
462# * External: `Authorization: Bearer <user-access-key>` (verified against
463# `user_access_keys`; scope gates write tools).
464# * Internal: `X-Mcp-Internal-Key: <secret>` or `Authorization: Bearer
465# <secret>`, allowed only from the platform whitelist (RFC 1918 +
466# Docker/Podman bridge networks + common Kubernetes pod/service CIDRs;
467# see `lib/mcp/ip_filter.rs::BUILTIN_INTERNAL_CIDRS`). Extras below append.
468# Routes (default):
469# * POST /api/v1/mcp — dual-track (external / whitelisted-internal)
470# * POST /api/v1/internal/mcp — internal-only (non-whitelisted IP -> 403)
471# Runtime overrides: APP__MCP__INTERNAL_SECRET_KEY / APP__MCP__INTERNAL_ALLOWED_CIDRS.
472# -----------------------------------------------------------------------------
473mcp:
474 enabled: true
475 external_path: "mcp" # -> POST /api/v1/mcp
476 internal_path: "internal/mcp" # -> POST /api/v1/internal/mcp
477 internal_secret_key: null # >= 16 chars when set; null disables the internal track
478 internal_allowed_cidrs: [] # e.g. ["10.200.0.0/16", "2001:db8::/32"]
479 trust_proxy: false # true ONLY when a real trusted proxy strips inbound spoof headers
480 system_user_id: null # acting user UUID for internal-track tool calls
481 max_request_bytes: 1048576
Modified Cargo.lock Cargo.lock +191 −0 View Cargo.lock
@@ -1120,6 +1120,7 @@
11201120dependencies = [
11211121 "config 0.15.25",
11221122 "dotenvy",
1123 "ipnet",
11231124 "lombok",
11241125 "serde",
11251126 "serde_json",
@@ -1442,6 +1443,16 @@
14421443]
14431444
14441445[[package]]
1446name = "darling"
1447version = "0.24.0"
1448source = "registry+https://github.com/rust-lang/crates.io-index"
1449checksum = "88490bf1b990d87eaaa7ac8aa887f629a08e7359765b4911faf63c3763347d23"
1450dependencies = [
1451 "darling_core 0.24.0",
1452 "darling_macro 0.24.0",
1453]
1454
1455[[package]]
14451456name = "darling_core"
14461457version = "0.20.11"
14471458source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1469,6 +1480,19 @@
14691480]
14701481
14711482[[package]]
1483name = "darling_core"
1484version = "0.24.0"
1485source = "registry+https://github.com/rust-lang/crates.io-index"
1486checksum = "084e274f91c482280130e1e34e0b8d6e66776a060d7b6de7b84289ca778868c4"
1487dependencies = [
1488 "ident_case",
1489 "proc-macro2",
1490 "quote",
1491 "strsim",
1492 "syn 3.0.3",
1493]
1494
1495[[package]]
14721496name = "darling_macro"
14731497version = "0.20.11"
14741498source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1491,6 +1515,17 @@
14911515]
14921516
14931517[[package]]
1518name = "darling_macro"
1519version = "0.24.0"
1520source = "registry+https://github.com/rust-lang/crates.io-index"
1521checksum = "68f5792fa0d41cd2325ce0ffa64f0a340eaebd4971a3a0c5e1ffd2cc488a355e"
1522dependencies = [
1523 "darling_core 0.24.0",
1524 "quote",
1525 "syn 3.0.3",
1526]
1527
1528[[package]]
14941529name = "dashmap"
14951530version = "6.2.1"
14961531source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1732,6 +1767,12 @@
17321767checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813"
17331768
17341769[[package]]
1770name = "dyn-clone"
1771version = "1.0.20"
1772source = "registry+https://github.com/rust-lang/crates.io-index"
1773checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555"
1774
1775[[package]]
17351776name = "ecdsa"
17361777version = "0.16.9"
17371778source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -4491,6 +4532,35 @@
44914532checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3"
44924533
44934534[[package]]
4535name = "mcp"
4536version = "1.94.0"
4537dependencies = [
4538 "async-trait",
4539 "axum",
4540 "config 1.94.0",
4541 "db",
4542 "export",
4543 "hex",
4544 "http",
4545 "ipnet",
4546 "issues",
4547 "project",
4548 "repo",
4549 "rmcp",
4550 "serde",
4551 "serde_json",
4552 "sha2 0.10.9",
4553 "space",
4554 "subtle",
4555 "thiserror 2.0.19",
4556 "tokio",
4557 "tokio-util",
4558 "tower",
4559 "tracing",
4560 "uuid",
4561]
4562
4563[[package]]
44944564name = "md-5"
44954565version = "0.11.0"
44964566source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -5220,6 +5290,12 @@
52205290checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
52215291
52225292[[package]]
5293name = "pastey"
5294version = "0.2.3"
5295source = "registry+https://github.com/rust-lang/crates.io-index"
5296checksum = "2ee67f1008b1ba2321834326597b8e186293b049a023cdef258527550b9935b4"
5297
5298[[package]]
52235299name = "pathdiff"
52245300version = "0.2.3"
52255301source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -6014,6 +6090,26 @@
60146090]
60156091
60166092[[package]]
6093name = "ref-cast"
6094version = "1.0.26"
6095source = "registry+https://github.com/rust-lang/crates.io-index"
6096checksum = "216e8f773d7923bcba9ceb86a86c93cabb3903a11872fc3f138c49630e50b96d"
6097dependencies = [
6098 "ref-cast-impl",
6099]
6100
6101[[package]]
6102name = "ref-cast-impl"
6103version = "1.0.26"
6104source = "registry+https://github.com/rust-lang/crates.io-index"
6105checksum = "2c9283685feec7d69af75fb0e858d5e7378f33fe4fc699383b2916ab9273e03c"
6106dependencies = [
6107 "proc-macro2",
6108 "quote",
6109 "syn 3.0.3",
6110]
6111
6112[[package]]
60176113name = "regex"
60186114version = "1.13.1"
60196115source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -6233,6 +6329,50 @@
62336329]
62346330
62356331[[package]]
6332name = "rmcp"
6333version = "3.1.2"
6334source = "registry+https://github.com/rust-lang/crates.io-index"
6335checksum = "c8dddc5b1924b9a59fba420166160ca2c4663a4e01803e52eda33070f56d63c8"
6336dependencies = [
6337 "async-trait",
6338 "base64 0.23.1",
6339 "bytes",
6340 "chrono",
6341 "futures",
6342 "http",
6343 "http-body",
6344 "http-body-util",
6345 "pastey",
6346 "pin-project-lite",
6347 "rand 0.10.2",
6348 "rmcp-macros",
6349 "schemars",
6350 "serde",
6351 "serde_json",
6352 "sse-stream",
6353 "thiserror 2.0.19",
6354 "tokio",
6355 "tokio-stream",
6356 "tokio-util",
6357 "tower-service",
6358 "tracing",
6359 "uuid",
6360]
6361
6362[[package]]
6363name = "rmcp-macros"
6364version = "3.1.2"
6365source = "registry+https://github.com/rust-lang/crates.io-index"
6366checksum = "6898e24cd16342b59bfa8a53c2c04b9cf62fc8a2cfea57b9c038b09984bfc521"
6367dependencies = [
6368 "darling 0.24.0",
6369 "proc-macro2",
6370 "quote",
6371 "serde_json",
6372 "syn 3.0.3",
6373]
6374
6375[[package]]
62366376name = "rsa"
62376377version = "0.9.10"
62386378source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -6529,6 +6669,32 @@
65296669]
65306670
65316671[[package]]
6672name = "schemars"
6673version = "1.2.2"
6674source = "registry+https://github.com/rust-lang/crates.io-index"
6675checksum = "687274d293b6cdc6e73e0fee520bf2049650090d7164f87672d212a3c530cf4a"
6676dependencies = [
6677 "chrono",
6678 "dyn-clone",
6679 "ref-cast",
6680 "schemars_derive",
6681 "serde",
6682 "serde_json",
6683]
6684
6685[[package]]
6686name = "schemars_derive"
6687version = "1.2.2"
6688source = "registry+https://github.com/rust-lang/crates.io-index"
6689checksum = "d98c67716b46af2f0b8cf752abc930f6f9aecfbf671ecfb531db8a31dbe4e2ba"
6690dependencies = [
6691 "proc-macro2",
6692 "quote",
6693 "serde_derive_internals",
6694 "syn 3.0.3",
6695]
6696
6697[[package]]
65326698name = "scopeguard"
65336699version = "1.2.0"
65346700source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -6797,6 +6963,17 @@
67976963]
67986964
67996965[[package]]
6966name = "serde_derive_internals"
6967version = "0.30.0"
6968source = "registry+https://github.com/rust-lang/crates.io-index"
6969checksum = "f852137cce035d6a4df67ccce505ff6b3e9fd3a10e3e52b24dc71e650bb1a9bd"
6970dependencies = [
6971 "proc-macro2",
6972 "quote",
6973 "syn 3.0.3",
6974]
6975
6976[[package]]
68006977name = "serde_json"
68016978version = "1.0.151"
68026979source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -7326,6 +7503,19 @@
73267503]
73277504
73287505[[package]]
7506name = "sse-stream"
7507version = "0.2.5"
7508source = "registry+https://github.com/rust-lang/crates.io-index"
7509checksum = "c123f296ade4ec4b8b0f6162116e6629f5146922ca5ab40ca9d3c2e73ab4761e"
7510dependencies = [
7511 "bytes",
7512 "futures-util",
7513 "http-body",
7514 "http-body-util",
7515 "pin-project-lite",
7516]
7517
7518[[package]]
73297519name = "ssh-cipher"
73307520version = "0.3.0"
73317521source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -8398,6 +8588,7 @@
83988588 "export",
83998589 "issues",
84008590 "jwt",
8591 "mcp",
84018592 "once_cell",
84028593 "payment",
84038594 "project",
Modified Cargo.toml Cargo.toml +2 −1 View Cargo.toml
@@ -25,7 +25,7 @@
2525 "dvcs/gitsync",
2626 "dvcs/codesearch",
2727 "lib/issues",
28 "lib/jwt", "lib/obs",
28 "lib/jwt", "lib/obs", "lib/mcp",
2929 "lib/payment",
3030 "lib/project",
3131 "lib/queue",
@@ -70,6 +70,7 @@
7070webapi = { path = "lib/webapi" }
7171webhook = { path = "lib/webhook" }
7272obs = { path = "lib/obs" }
73mcp = { path = "lib/mcp" }
7374storagelayer = { path = "chat/storagelayer" }
7475chatlayer = { path = "chat/chatlayer" }
7576glayer = { path = "chat/glayer" }