├── .github └── workflows │ └── release.yml ├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── README.md ├── configuration ├── default_settings.jsonc └── installation_instructions.md ├── extension.toml └── src └── mcp_server_context7.rs /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | on: 2 | push: 3 | tags: 4 | - "v*" 5 | 6 | jobs: 7 | homebrew: 8 | name: Release Zed Extension 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: huacnlee/zed-extension-action@v1 12 | with: 13 | extension-name: mcp-server-context7 14 | # extension-path: extensions/${{ extension-name }} 15 | push-to: akbxr/extensions 16 | env: 17 | # the personal access token should have "repo" & "workflow" scopes 18 | COMMITTER_TOKEN: ${{ secrets.COMMITTER_TOKEN }} 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | debug/ 4 | target/ 5 | 6 | # These are backup files generated by rustfmt 7 | **/*.rs.bk 8 | 9 | # MSVC Windows builds of rustc generate these, which store debugging information 10 | *.pdb 11 | 12 | extension.wasm 13 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 4 4 | 5 | [[package]] 6 | name = "adler2" 7 | version = "2.0.0" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" 10 | 11 | [[package]] 12 | name = "anyhow" 13 | version = "1.0.98" 14 | source = "registry+https://github.com/rust-lang/crates.io-index" 15 | checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" 16 | 17 | [[package]] 18 | name = "auditable-serde" 19 | version = "0.8.0" 20 | source = "registry+https://github.com/rust-lang/crates.io-index" 21 | checksum = "5c7bf8143dfc3c0258df908843e169b5cc5fcf76c7718bd66135ef4a9cd558c5" 22 | dependencies = [ 23 | "semver", 24 | "serde", 25 | "serde_json", 26 | "topological-sort", 27 | ] 28 | 29 | [[package]] 30 | name = "autocfg" 31 | version = "1.4.0" 32 | source = "registry+https://github.com/rust-lang/crates.io-index" 33 | checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" 34 | 35 | [[package]] 36 | name = "bitflags" 37 | version = "2.9.0" 38 | source = "registry+https://github.com/rust-lang/crates.io-index" 39 | checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" 40 | 41 | [[package]] 42 | name = "cfg-if" 43 | version = "1.0.0" 44 | source = "registry+https://github.com/rust-lang/crates.io-index" 45 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 46 | 47 | [[package]] 48 | name = "crc32fast" 49 | version = "1.4.2" 50 | source = "registry+https://github.com/rust-lang/crates.io-index" 51 | checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" 52 | dependencies = [ 53 | "cfg-if", 54 | ] 55 | 56 | [[package]] 57 | name = "displaydoc" 58 | version = "0.2.5" 59 | source = "registry+https://github.com/rust-lang/crates.io-index" 60 | checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" 61 | dependencies = [ 62 | "proc-macro2", 63 | "quote", 64 | "syn", 65 | ] 66 | 67 | [[package]] 68 | name = "dyn-clone" 69 | version = "1.0.19" 70 | source = "registry+https://github.com/rust-lang/crates.io-index" 71 | checksum = "1c7a8fb8a9fbf66c1f703fe16184d10ca0ee9d23be5b4436400408ba54a95005" 72 | 73 | [[package]] 74 | name = "equivalent" 75 | version = "1.0.2" 76 | source = "registry+https://github.com/rust-lang/crates.io-index" 77 | checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" 78 | 79 | [[package]] 80 | name = "flate2" 81 | version = "1.1.1" 82 | source = "registry+https://github.com/rust-lang/crates.io-index" 83 | checksum = "7ced92e76e966ca2fd84c8f7aa01a4aea65b0eb6648d72f7c8f3e2764a67fece" 84 | dependencies = [ 85 | "crc32fast", 86 | "miniz_oxide", 87 | ] 88 | 89 | [[package]] 90 | name = "foldhash" 91 | version = "0.1.5" 92 | source = "registry+https://github.com/rust-lang/crates.io-index" 93 | checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" 94 | 95 | [[package]] 96 | name = "form_urlencoded" 97 | version = "1.2.1" 98 | source = "registry+https://github.com/rust-lang/crates.io-index" 99 | checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" 100 | dependencies = [ 101 | "percent-encoding", 102 | ] 103 | 104 | [[package]] 105 | name = "futures" 106 | version = "0.3.31" 107 | source = "registry+https://github.com/rust-lang/crates.io-index" 108 | checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" 109 | dependencies = [ 110 | "futures-channel", 111 | "futures-core", 112 | "futures-executor", 113 | "futures-io", 114 | "futures-sink", 115 | "futures-task", 116 | "futures-util", 117 | ] 118 | 119 | [[package]] 120 | name = "futures-channel" 121 | version = "0.3.31" 122 | source = "registry+https://github.com/rust-lang/crates.io-index" 123 | checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" 124 | dependencies = [ 125 | "futures-core", 126 | "futures-sink", 127 | ] 128 | 129 | [[package]] 130 | name = "futures-core" 131 | version = "0.3.31" 132 | source = "registry+https://github.com/rust-lang/crates.io-index" 133 | checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" 134 | 135 | [[package]] 136 | name = "futures-executor" 137 | version = "0.3.31" 138 | source = "registry+https://github.com/rust-lang/crates.io-index" 139 | checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" 140 | dependencies = [ 141 | "futures-core", 142 | "futures-task", 143 | "futures-util", 144 | ] 145 | 146 | [[package]] 147 | name = "futures-io" 148 | version = "0.3.31" 149 | source = "registry+https://github.com/rust-lang/crates.io-index" 150 | checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" 151 | 152 | [[package]] 153 | name = "futures-macro" 154 | version = "0.3.31" 155 | source = "registry+https://github.com/rust-lang/crates.io-index" 156 | checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" 157 | dependencies = [ 158 | "proc-macro2", 159 | "quote", 160 | "syn", 161 | ] 162 | 163 | [[package]] 164 | name = "futures-sink" 165 | version = "0.3.31" 166 | source = "registry+https://github.com/rust-lang/crates.io-index" 167 | checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" 168 | 169 | [[package]] 170 | name = "futures-task" 171 | version = "0.3.31" 172 | source = "registry+https://github.com/rust-lang/crates.io-index" 173 | checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" 174 | 175 | [[package]] 176 | name = "futures-util" 177 | version = "0.3.31" 178 | source = "registry+https://github.com/rust-lang/crates.io-index" 179 | checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" 180 | dependencies = [ 181 | "futures-channel", 182 | "futures-core", 183 | "futures-io", 184 | "futures-macro", 185 | "futures-sink", 186 | "futures-task", 187 | "memchr", 188 | "pin-project-lite", 189 | "pin-utils", 190 | "slab", 191 | ] 192 | 193 | [[package]] 194 | name = "hashbrown" 195 | version = "0.15.2" 196 | source = "registry+https://github.com/rust-lang/crates.io-index" 197 | checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" 198 | dependencies = [ 199 | "foldhash", 200 | ] 201 | 202 | [[package]] 203 | name = "heck" 204 | version = "0.5.0" 205 | source = "registry+https://github.com/rust-lang/crates.io-index" 206 | checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" 207 | 208 | [[package]] 209 | name = "icu_collections" 210 | version = "2.0.0" 211 | source = "registry+https://github.com/rust-lang/crates.io-index" 212 | checksum = "200072f5d0e3614556f94a9930d5dc3e0662a652823904c3a75dc3b0af7fee47" 213 | dependencies = [ 214 | "displaydoc", 215 | "potential_utf", 216 | "yoke", 217 | "zerofrom", 218 | "zerovec", 219 | ] 220 | 221 | [[package]] 222 | name = "icu_locale_core" 223 | version = "2.0.0" 224 | source = "registry+https://github.com/rust-lang/crates.io-index" 225 | checksum = "0cde2700ccaed3872079a65fb1a78f6c0a36c91570f28755dda67bc8f7d9f00a" 226 | dependencies = [ 227 | "displaydoc", 228 | "litemap", 229 | "tinystr", 230 | "writeable", 231 | "zerovec", 232 | ] 233 | 234 | [[package]] 235 | name = "icu_normalizer" 236 | version = "2.0.0" 237 | source = "registry+https://github.com/rust-lang/crates.io-index" 238 | checksum = "436880e8e18df4d7bbc06d58432329d6458cc84531f7ac5f024e93deadb37979" 239 | dependencies = [ 240 | "displaydoc", 241 | "icu_collections", 242 | "icu_normalizer_data", 243 | "icu_properties", 244 | "icu_provider", 245 | "smallvec", 246 | "zerovec", 247 | ] 248 | 249 | [[package]] 250 | name = "icu_normalizer_data" 251 | version = "2.0.0" 252 | source = "registry+https://github.com/rust-lang/crates.io-index" 253 | checksum = "00210d6893afc98edb752b664b8890f0ef174c8adbb8d0be9710fa66fbbf72d3" 254 | 255 | [[package]] 256 | name = "icu_properties" 257 | version = "2.0.0" 258 | source = "registry+https://github.com/rust-lang/crates.io-index" 259 | checksum = "2549ca8c7241c82f59c80ba2a6f415d931c5b58d24fb8412caa1a1f02c49139a" 260 | dependencies = [ 261 | "displaydoc", 262 | "icu_collections", 263 | "icu_locale_core", 264 | "icu_properties_data", 265 | "icu_provider", 266 | "potential_utf", 267 | "zerotrie", 268 | "zerovec", 269 | ] 270 | 271 | [[package]] 272 | name = "icu_properties_data" 273 | version = "2.0.0" 274 | source = "registry+https://github.com/rust-lang/crates.io-index" 275 | checksum = "8197e866e47b68f8f7d95249e172903bec06004b18b2937f1095d40a0c57de04" 276 | 277 | [[package]] 278 | name = "icu_provider" 279 | version = "2.0.0" 280 | source = "registry+https://github.com/rust-lang/crates.io-index" 281 | checksum = "03c80da27b5f4187909049ee2d72f276f0d9f99a42c306bd0131ecfe04d8e5af" 282 | dependencies = [ 283 | "displaydoc", 284 | "icu_locale_core", 285 | "stable_deref_trait", 286 | "tinystr", 287 | "writeable", 288 | "yoke", 289 | "zerofrom", 290 | "zerotrie", 291 | "zerovec", 292 | ] 293 | 294 | [[package]] 295 | name = "id-arena" 296 | version = "2.2.1" 297 | source = "registry+https://github.com/rust-lang/crates.io-index" 298 | checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" 299 | 300 | [[package]] 301 | name = "idna" 302 | version = "1.0.3" 303 | source = "registry+https://github.com/rust-lang/crates.io-index" 304 | checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" 305 | dependencies = [ 306 | "idna_adapter", 307 | "smallvec", 308 | "utf8_iter", 309 | ] 310 | 311 | [[package]] 312 | name = "idna_adapter" 313 | version = "1.2.1" 314 | source = "registry+https://github.com/rust-lang/crates.io-index" 315 | checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" 316 | dependencies = [ 317 | "icu_normalizer", 318 | "icu_properties", 319 | ] 320 | 321 | [[package]] 322 | name = "indexmap" 323 | version = "2.9.0" 324 | source = "registry+https://github.com/rust-lang/crates.io-index" 325 | checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" 326 | dependencies = [ 327 | "equivalent", 328 | "hashbrown", 329 | "serde", 330 | ] 331 | 332 | [[package]] 333 | name = "itoa" 334 | version = "1.0.15" 335 | source = "registry+https://github.com/rust-lang/crates.io-index" 336 | checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" 337 | 338 | [[package]] 339 | name = "leb128fmt" 340 | version = "0.1.0" 341 | source = "registry+https://github.com/rust-lang/crates.io-index" 342 | checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" 343 | 344 | [[package]] 345 | name = "litemap" 346 | version = "0.8.0" 347 | source = "registry+https://github.com/rust-lang/crates.io-index" 348 | checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956" 349 | 350 | [[package]] 351 | name = "log" 352 | version = "0.4.27" 353 | source = "registry+https://github.com/rust-lang/crates.io-index" 354 | checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" 355 | 356 | [[package]] 357 | name = "mcp_server_context7" 358 | version = "0.0.2" 359 | dependencies = [ 360 | "schemars", 361 | "serde", 362 | "zed_extension_api", 363 | ] 364 | 365 | [[package]] 366 | name = "memchr" 367 | version = "2.7.4" 368 | source = "registry+https://github.com/rust-lang/crates.io-index" 369 | checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" 370 | 371 | [[package]] 372 | name = "miniz_oxide" 373 | version = "0.8.8" 374 | source = "registry+https://github.com/rust-lang/crates.io-index" 375 | checksum = "3be647b768db090acb35d5ec5db2b0e1f1de11133ca123b9eacf5137868f892a" 376 | dependencies = [ 377 | "adler2", 378 | ] 379 | 380 | [[package]] 381 | name = "once_cell" 382 | version = "1.21.3" 383 | source = "registry+https://github.com/rust-lang/crates.io-index" 384 | checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" 385 | 386 | [[package]] 387 | name = "percent-encoding" 388 | version = "2.3.1" 389 | source = "registry+https://github.com/rust-lang/crates.io-index" 390 | checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" 391 | 392 | [[package]] 393 | name = "pin-project-lite" 394 | version = "0.2.16" 395 | source = "registry+https://github.com/rust-lang/crates.io-index" 396 | checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" 397 | 398 | [[package]] 399 | name = "pin-utils" 400 | version = "0.1.0" 401 | source = "registry+https://github.com/rust-lang/crates.io-index" 402 | checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 403 | 404 | [[package]] 405 | name = "potential_utf" 406 | version = "0.1.2" 407 | source = "registry+https://github.com/rust-lang/crates.io-index" 408 | checksum = "e5a7c30837279ca13e7c867e9e40053bc68740f988cb07f7ca6df43cc734b585" 409 | dependencies = [ 410 | "zerovec", 411 | ] 412 | 413 | [[package]] 414 | name = "prettyplease" 415 | version = "0.2.32" 416 | source = "registry+https://github.com/rust-lang/crates.io-index" 417 | checksum = "664ec5419c51e34154eec046ebcba56312d5a2fc3b09a06da188e1ad21afadf6" 418 | dependencies = [ 419 | "proc-macro2", 420 | "syn", 421 | ] 422 | 423 | [[package]] 424 | name = "proc-macro2" 425 | version = "1.0.95" 426 | source = "registry+https://github.com/rust-lang/crates.io-index" 427 | checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" 428 | dependencies = [ 429 | "unicode-ident", 430 | ] 431 | 432 | [[package]] 433 | name = "quote" 434 | version = "1.0.40" 435 | source = "registry+https://github.com/rust-lang/crates.io-index" 436 | checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" 437 | dependencies = [ 438 | "proc-macro2", 439 | ] 440 | 441 | [[package]] 442 | name = "ryu" 443 | version = "1.0.20" 444 | source = "registry+https://github.com/rust-lang/crates.io-index" 445 | checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" 446 | 447 | [[package]] 448 | name = "schemars" 449 | version = "0.8.22" 450 | source = "registry+https://github.com/rust-lang/crates.io-index" 451 | checksum = "3fbf2ae1b8bc8e02df939598064d22402220cd5bbcca1c76f7d6a310974d5615" 452 | dependencies = [ 453 | "dyn-clone", 454 | "schemars_derive", 455 | "serde", 456 | "serde_json", 457 | ] 458 | 459 | [[package]] 460 | name = "schemars_derive" 461 | version = "0.8.22" 462 | source = "registry+https://github.com/rust-lang/crates.io-index" 463 | checksum = "32e265784ad618884abaea0600a9adf15393368d840e0222d101a072f3f7534d" 464 | dependencies = [ 465 | "proc-macro2", 466 | "quote", 467 | "serde_derive_internals", 468 | "syn", 469 | ] 470 | 471 | [[package]] 472 | name = "semver" 473 | version = "1.0.26" 474 | source = "registry+https://github.com/rust-lang/crates.io-index" 475 | checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" 476 | dependencies = [ 477 | "serde", 478 | ] 479 | 480 | [[package]] 481 | name = "serde" 482 | version = "1.0.219" 483 | source = "registry+https://github.com/rust-lang/crates.io-index" 484 | checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" 485 | dependencies = [ 486 | "serde_derive", 487 | ] 488 | 489 | [[package]] 490 | name = "serde_derive" 491 | version = "1.0.219" 492 | source = "registry+https://github.com/rust-lang/crates.io-index" 493 | checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" 494 | dependencies = [ 495 | "proc-macro2", 496 | "quote", 497 | "syn", 498 | ] 499 | 500 | [[package]] 501 | name = "serde_derive_internals" 502 | version = "0.29.1" 503 | source = "registry+https://github.com/rust-lang/crates.io-index" 504 | checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" 505 | dependencies = [ 506 | "proc-macro2", 507 | "quote", 508 | "syn", 509 | ] 510 | 511 | [[package]] 512 | name = "serde_json" 513 | version = "1.0.140" 514 | source = "registry+https://github.com/rust-lang/crates.io-index" 515 | checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" 516 | dependencies = [ 517 | "itoa", 518 | "memchr", 519 | "ryu", 520 | "serde", 521 | ] 522 | 523 | [[package]] 524 | name = "slab" 525 | version = "0.4.9" 526 | source = "registry+https://github.com/rust-lang/crates.io-index" 527 | checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" 528 | dependencies = [ 529 | "autocfg", 530 | ] 531 | 532 | [[package]] 533 | name = "smallvec" 534 | version = "1.15.0" 535 | source = "registry+https://github.com/rust-lang/crates.io-index" 536 | checksum = "8917285742e9f3e1683f0a9c4e6b57960b7314d0b08d30d1ecd426713ee2eee9" 537 | 538 | [[package]] 539 | name = "spdx" 540 | version = "0.10.8" 541 | source = "registry+https://github.com/rust-lang/crates.io-index" 542 | checksum = "58b69356da67e2fc1f542c71ea7e654a361a79c938e4424392ecf4fa065d2193" 543 | dependencies = [ 544 | "smallvec", 545 | ] 546 | 547 | [[package]] 548 | name = "stable_deref_trait" 549 | version = "1.2.0" 550 | source = "registry+https://github.com/rust-lang/crates.io-index" 551 | checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" 552 | 553 | [[package]] 554 | name = "syn" 555 | version = "2.0.100" 556 | source = "registry+https://github.com/rust-lang/crates.io-index" 557 | checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" 558 | dependencies = [ 559 | "proc-macro2", 560 | "quote", 561 | "unicode-ident", 562 | ] 563 | 564 | [[package]] 565 | name = "synstructure" 566 | version = "0.13.2" 567 | source = "registry+https://github.com/rust-lang/crates.io-index" 568 | checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" 569 | dependencies = [ 570 | "proc-macro2", 571 | "quote", 572 | "syn", 573 | ] 574 | 575 | [[package]] 576 | name = "tinystr" 577 | version = "0.8.1" 578 | source = "registry+https://github.com/rust-lang/crates.io-index" 579 | checksum = "5d4f6d1145dcb577acf783d4e601bc1d76a13337bb54e6233add580b07344c8b" 580 | dependencies = [ 581 | "displaydoc", 582 | "zerovec", 583 | ] 584 | 585 | [[package]] 586 | name = "topological-sort" 587 | version = "0.2.2" 588 | source = "registry+https://github.com/rust-lang/crates.io-index" 589 | checksum = "ea68304e134ecd095ac6c3574494fc62b909f416c4fca77e440530221e549d3d" 590 | 591 | [[package]] 592 | name = "unicode-ident" 593 | version = "1.0.18" 594 | source = "registry+https://github.com/rust-lang/crates.io-index" 595 | checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" 596 | 597 | [[package]] 598 | name = "unicode-xid" 599 | version = "0.2.6" 600 | source = "registry+https://github.com/rust-lang/crates.io-index" 601 | checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" 602 | 603 | [[package]] 604 | name = "url" 605 | version = "2.5.4" 606 | source = "registry+https://github.com/rust-lang/crates.io-index" 607 | checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" 608 | dependencies = [ 609 | "form_urlencoded", 610 | "idna", 611 | "percent-encoding", 612 | ] 613 | 614 | [[package]] 615 | name = "utf8_iter" 616 | version = "1.0.4" 617 | source = "registry+https://github.com/rust-lang/crates.io-index" 618 | checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" 619 | 620 | [[package]] 621 | name = "wasm-encoder" 622 | version = "0.227.1" 623 | source = "registry+https://github.com/rust-lang/crates.io-index" 624 | checksum = "80bb72f02e7fbf07183443b27b0f3d4144abf8c114189f2e088ed95b696a7822" 625 | dependencies = [ 626 | "leb128fmt", 627 | "wasmparser", 628 | ] 629 | 630 | [[package]] 631 | name = "wasm-metadata" 632 | version = "0.227.1" 633 | source = "registry+https://github.com/rust-lang/crates.io-index" 634 | checksum = "ce1ef0faabbbba6674e97a56bee857ccddf942785a336c8b47b42373c922a91d" 635 | dependencies = [ 636 | "anyhow", 637 | "auditable-serde", 638 | "flate2", 639 | "indexmap", 640 | "serde", 641 | "serde_derive", 642 | "serde_json", 643 | "spdx", 644 | "url", 645 | "wasm-encoder", 646 | "wasmparser", 647 | ] 648 | 649 | [[package]] 650 | name = "wasmparser" 651 | version = "0.227.1" 652 | source = "registry+https://github.com/rust-lang/crates.io-index" 653 | checksum = "0f51cad774fb3c9461ab9bccc9c62dfb7388397b5deda31bf40e8108ccd678b2" 654 | dependencies = [ 655 | "bitflags", 656 | "hashbrown", 657 | "indexmap", 658 | "semver", 659 | ] 660 | 661 | [[package]] 662 | name = "wit-bindgen" 663 | version = "0.41.0" 664 | source = "registry+https://github.com/rust-lang/crates.io-index" 665 | checksum = "10fb6648689b3929d56bbc7eb1acf70c9a42a29eb5358c67c10f54dbd5d695de" 666 | dependencies = [ 667 | "wit-bindgen-rt", 668 | "wit-bindgen-rust-macro", 669 | ] 670 | 671 | [[package]] 672 | name = "wit-bindgen-core" 673 | version = "0.41.0" 674 | source = "registry+https://github.com/rust-lang/crates.io-index" 675 | checksum = "92fa781d4f2ff6d3f27f3cc9b74a73327b31ca0dc4a3ef25a0ce2983e0e5af9b" 676 | dependencies = [ 677 | "anyhow", 678 | "heck", 679 | "wit-parser", 680 | ] 681 | 682 | [[package]] 683 | name = "wit-bindgen-rt" 684 | version = "0.41.0" 685 | source = "registry+https://github.com/rust-lang/crates.io-index" 686 | checksum = "c4db52a11d4dfb0a59f194c064055794ee6564eb1ced88c25da2cf76e50c5621" 687 | dependencies = [ 688 | "bitflags", 689 | "futures", 690 | "once_cell", 691 | ] 692 | 693 | [[package]] 694 | name = "wit-bindgen-rust" 695 | version = "0.41.0" 696 | source = "registry+https://github.com/rust-lang/crates.io-index" 697 | checksum = "9d0809dc5ba19e2e98661bf32fc0addc5a3ca5bf3a6a7083aa6ba484085ff3ce" 698 | dependencies = [ 699 | "anyhow", 700 | "heck", 701 | "indexmap", 702 | "prettyplease", 703 | "syn", 704 | "wasm-metadata", 705 | "wit-bindgen-core", 706 | "wit-component", 707 | ] 708 | 709 | [[package]] 710 | name = "wit-bindgen-rust-macro" 711 | version = "0.41.0" 712 | source = "registry+https://github.com/rust-lang/crates.io-index" 713 | checksum = "ad19eec017904e04c60719592a803ee5da76cb51c81e3f6fbf9457f59db49799" 714 | dependencies = [ 715 | "anyhow", 716 | "prettyplease", 717 | "proc-macro2", 718 | "quote", 719 | "syn", 720 | "wit-bindgen-core", 721 | "wit-bindgen-rust", 722 | ] 723 | 724 | [[package]] 725 | name = "wit-component" 726 | version = "0.227.1" 727 | source = "registry+https://github.com/rust-lang/crates.io-index" 728 | checksum = "635c3adc595422cbf2341a17fb73a319669cc8d33deed3a48368a841df86b676" 729 | dependencies = [ 730 | "anyhow", 731 | "bitflags", 732 | "indexmap", 733 | "log", 734 | "serde", 735 | "serde_derive", 736 | "serde_json", 737 | "wasm-encoder", 738 | "wasm-metadata", 739 | "wasmparser", 740 | "wit-parser", 741 | ] 742 | 743 | [[package]] 744 | name = "wit-parser" 745 | version = "0.227.1" 746 | source = "registry+https://github.com/rust-lang/crates.io-index" 747 | checksum = "ddf445ed5157046e4baf56f9138c124a0824d4d1657e7204d71886ad8ce2fc11" 748 | dependencies = [ 749 | "anyhow", 750 | "id-arena", 751 | "indexmap", 752 | "log", 753 | "semver", 754 | "serde", 755 | "serde_derive", 756 | "serde_json", 757 | "unicode-xid", 758 | "wasmparser", 759 | ] 760 | 761 | [[package]] 762 | name = "writeable" 763 | version = "0.6.1" 764 | source = "registry+https://github.com/rust-lang/crates.io-index" 765 | checksum = "ea2f10b9bb0928dfb1b42b65e1f9e36f7f54dbdf08457afefb38afcdec4fa2bb" 766 | 767 | [[package]] 768 | name = "yoke" 769 | version = "0.8.0" 770 | source = "registry+https://github.com/rust-lang/crates.io-index" 771 | checksum = "5f41bb01b8226ef4bfd589436a297c53d118f65921786300e427be8d487695cc" 772 | dependencies = [ 773 | "serde", 774 | "stable_deref_trait", 775 | "yoke-derive", 776 | "zerofrom", 777 | ] 778 | 779 | [[package]] 780 | name = "yoke-derive" 781 | version = "0.8.0" 782 | source = "registry+https://github.com/rust-lang/crates.io-index" 783 | checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6" 784 | dependencies = [ 785 | "proc-macro2", 786 | "quote", 787 | "syn", 788 | "synstructure", 789 | ] 790 | 791 | [[package]] 792 | name = "zed_extension_api" 793 | version = "0.5.0" 794 | source = "registry+https://github.com/rust-lang/crates.io-index" 795 | checksum = "40ef88a8e5aeff67b0996b1795d56338f04c02de95f1f147577944aa37b801d6" 796 | dependencies = [ 797 | "serde", 798 | "serde_json", 799 | "wit-bindgen", 800 | ] 801 | 802 | [[package]] 803 | name = "zerofrom" 804 | version = "0.1.6" 805 | source = "registry+https://github.com/rust-lang/crates.io-index" 806 | checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" 807 | dependencies = [ 808 | "zerofrom-derive", 809 | ] 810 | 811 | [[package]] 812 | name = "zerofrom-derive" 813 | version = "0.1.6" 814 | source = "registry+https://github.com/rust-lang/crates.io-index" 815 | checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" 816 | dependencies = [ 817 | "proc-macro2", 818 | "quote", 819 | "syn", 820 | "synstructure", 821 | ] 822 | 823 | [[package]] 824 | name = "zerotrie" 825 | version = "0.2.2" 826 | source = "registry+https://github.com/rust-lang/crates.io-index" 827 | checksum = "36f0bbd478583f79edad978b407914f61b2972f5af6fa089686016be8f9af595" 828 | dependencies = [ 829 | "displaydoc", 830 | "yoke", 831 | "zerofrom", 832 | ] 833 | 834 | [[package]] 835 | name = "zerovec" 836 | version = "0.11.2" 837 | source = "registry+https://github.com/rust-lang/crates.io-index" 838 | checksum = "4a05eb080e015ba39cc9e23bbe5e7fb04d5fb040350f99f34e338d5fdd294428" 839 | dependencies = [ 840 | "yoke", 841 | "zerofrom", 842 | "zerovec-derive", 843 | ] 844 | 845 | [[package]] 846 | name = "zerovec-derive" 847 | version = "0.11.1" 848 | source = "registry+https://github.com/rust-lang/crates.io-index" 849 | checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f" 850 | dependencies = [ 851 | "proc-macro2", 852 | "quote", 853 | "syn", 854 | ] 855 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "mcp_server_context7" 3 | version = "0.0.2" 4 | edition = "2021" 5 | publish = false 6 | license = "Apache-2.0" 7 | 8 | [lib] 9 | path = "src/mcp_server_context7.rs" 10 | crate-type = ["cdylib"] 11 | 12 | [dependencies] 13 | zed_extension_api = "0.5.0" 14 | serde = "1.0" 15 | schemars = "0.8" 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Context7 MCP Server for Zed 2 | 3 | This extension integrates [Context7](https://context7.com/) as a Model Context Protocol (MCP) server for Zed's Assistant, providing up-to-date documentation for any prompt. 4 | 5 | ## What is Context7? 6 | 7 | Context7 pulls up-to-date, version-specific documentation and code examples straight from the source and places them directly into your prompt context. 8 | 9 | ### ❌ Without Context7 10 | 11 | LLMs rely on outdated or generic information about the libraries you use. You get: 12 | - ❌ Code examples are outdated and based on year-old training data 13 | - ❌ Hallucinated APIs that don't even exist 14 | - ❌ Generic answers for old package versions 15 | 16 | ### ✅ With Context7 17 | 18 | Context7 fetches up-to-date, version-specific documentation and code examples straight from the source — and places them directly into your prompt. 19 | 20 | Add `use context7` to your question in Zed Assistant: 21 | 22 | ``` 23 | How do I use the new Next.js `after` function? use context7 24 | ``` 25 | 26 | ``` 27 | How do I invalidate a query in React Query? use context7 28 | ``` 29 | 30 | ``` 31 | How do I protect a route with NextAuth? use context7 32 | ``` 33 | 34 | ## How It Works 35 | 36 | - 1️⃣ Ask your question naturally 37 | - 2️⃣ Tell the LLM to `use context7` 38 | - 3️⃣ Get working code answers 39 | 40 | No tab-switching, no hallucinated APIs that don't exist, no outdated code generations. 41 | 42 | ## Installation 43 | 44 | This extension can be installed from the Zed extension. 45 | 46 | ## Agent Mode Configuration 47 | 48 | If you're using Zed's agent mode, you need to enable this context server for your assistant: 49 | 50 | 1. Open Zed's assistant settings 51 | 2. Enable the Context7 MCP server. If you see that the status of the tool is a red dot, make sure you toggle it so that becomes green. 52 | 3. Enable the Context7 MCP Server in the active assistant profile. In the chat section, click on the `Write | Ask` button, then click on `tools`, then enable the Context7 MCP Server. 53 | 54 | ## Environment Variables (Optional) 55 | 56 | - `DEFAULT_MINIMUM_TOKENS`: Set the minimum token count for documentation retrieval (default: 10000). 57 | 58 | Examples: 59 | 60 | ```json 61 | { 62 | "context_server": { 63 | "mcp-server-context7": { 64 | "settings": { 65 | "default_minimum_tokens": "10000" 66 | } 67 | } 68 | } 69 | } 70 | ``` 71 | 72 | ## Available Tools 73 | 74 | The Context7 MCP Server provides these tools to the LLM: 75 | 76 | - `resolve-library-id`: Resolves a general library name into a Context7-compatible library ID. 77 | - `libraryName` (optional): Search and rerank results 78 | 79 | - `get-library-docs`: Fetches documentation for a library using a Context7-compatible library ID. 80 | - `context7CompatibleLibraryID` (required) 81 | - `topic` (optional): Focus the docs on a specific topic (e.g., "routing", "hooks") 82 | - `tokens` (optional, default 5000): Max number of tokens to return 83 | 84 | ## Development 85 | 86 | Clone the project and install dependencies: 87 | 88 | ``` 89 | cargo build 90 | ``` 91 | 92 | ## License 93 | 94 | MIT 95 | -------------------------------------------------------------------------------- /configuration/default_settings.jsonc: -------------------------------------------------------------------------------- 1 | { 2 | "default_minimum_tokens": "10000" 3 | } 4 | -------------------------------------------------------------------------------- /configuration/installation_instructions.md: -------------------------------------------------------------------------------- 1 | Optional settings 2 | 3 | default_minimum_tokens: Set the minimum token count for documentation retrieval (default: 10000). 4 | -------------------------------------------------------------------------------- /extension.toml: -------------------------------------------------------------------------------- 1 | id = "mcp-server-context7" 2 | name = "Context7 MCP Server" 3 | description = "Model Context Protocol Server for Context7" 4 | version = "0.0.3" 5 | schema_version = 1 6 | authors = ["Akbxr "] 7 | repository = "https://github.com/akbxr/zed-mcp-server-context7" 8 | 9 | [context_servers.mcp-server-context7] 10 | name = "Context7 MCP Server" 11 | -------------------------------------------------------------------------------- /src/mcp_server_context7.rs: -------------------------------------------------------------------------------- 1 | use schemars::JsonSchema; 2 | use serde::Deserialize; 3 | use std::env; 4 | use zed::settings::ContextServerSettings; 5 | use zed_extension_api::{ 6 | self as zed, serde_json, Command, ContextServerConfiguration, ContextServerId, Project, Result, 7 | }; 8 | 9 | const PACKAGE_NAME: &str = "@upstash/context7-mcp"; 10 | const PACKAGE_VERSION: &str = "latest"; 11 | const SERVER_PATH: &str = "node_modules/@upstash/context7-mcp/dist/index.js"; 12 | const DEFAULT_MIN_TOKENS_ENV: &str = "DEFAULT_MINIMUM_TOKENS"; 13 | 14 | struct Context7ModelContextExtension; 15 | 16 | #[derive(Debug, Deserialize, JsonSchema)] 17 | struct Context7ModelContextExtensionSettings { 18 | #[serde(default)] 19 | default_minimum_tokens: Option, 20 | } 21 | 22 | impl zed::Extension for Context7ModelContextExtension { 23 | fn new() -> Self { 24 | Self 25 | } 26 | 27 | fn context_server_command( 28 | &mut self, 29 | _context_server_id: &ContextServerId, 30 | project: &Project, 31 | ) -> Result { 32 | let version = zed::npm_package_installed_version(PACKAGE_NAME)?; 33 | if version.as_deref() != Some(PACKAGE_VERSION) { 34 | zed::npm_install_package(PACKAGE_NAME, PACKAGE_VERSION)?; 35 | } 36 | 37 | let settings = ContextServerSettings::for_project("mcp-server-context7", project)?; 38 | 39 | let ext_settings: Option = 40 | if let Some(settings_value) = settings.settings { 41 | match serde_json::from_value(settings_value) { 42 | Ok(s) => Some(s), 43 | Err(e) => return Err(format!("Failed to parse settings: {}", e).into()), 44 | } 45 | } else { 46 | None 47 | }; 48 | 49 | let mut env_vars = Vec::new(); 50 | 51 | if let Some(settings) = ext_settings { 52 | if let Some(default_minimum_tokens) = settings.default_minimum_tokens { 53 | env_vars.push((DEFAULT_MIN_TOKENS_ENV.to_string(), default_minimum_tokens)); 54 | } 55 | } 56 | 57 | Ok(Command { 58 | command: zed::node_binary_path()?, 59 | args: vec![env::current_dir() 60 | .unwrap() 61 | .join(SERVER_PATH) 62 | .to_string_lossy() 63 | .to_string()], 64 | env: env_vars, 65 | }) 66 | } 67 | 68 | fn context_server_configuration( 69 | &mut self, 70 | 71 | _context_server_id: &ContextServerId, 72 | 73 | project: &Project, 74 | ) -> Result> { 75 | let installation_instructions = 76 | include_str!("../configuration/installation_instructions.md").to_string(); 77 | 78 | let settings = ContextServerSettings::for_project("mcp-server-context7", project); 79 | 80 | let mut default_settings = 81 | include_str!("../configuration/default_settings.jsonc").to_string(); 82 | 83 | if let Ok(user_settings) = settings { 84 | if let Some(settings_value) = user_settings.settings { 85 | if let Ok(context7_settings) = 86 | serde_json::from_value::(settings_value) 87 | { 88 | if let Some(default_minimum_tokens) = context7_settings.default_minimum_tokens { 89 | default_settings = default_settings 90 | .replace("\"10000\"", &format!("\"{}\"", default_minimum_tokens)); 91 | } 92 | } 93 | } 94 | } 95 | 96 | let settings_schema = serde_json::to_string(&schemars::schema_for!( 97 | Context7ModelContextExtensionSettings 98 | )) 99 | .map_err(|e| e.to_string())?; 100 | 101 | Ok(Some(ContextServerConfiguration { 102 | installation_instructions, 103 | 104 | default_settings, 105 | 106 | settings_schema, 107 | })) 108 | } 109 | } 110 | 111 | zed::register_extension!(Context7ModelContextExtension); 112 | --------------------------------------------------------------------------------