@vicoa/cli 1.3.19-win32-x64 → 1.3.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (250) hide show
  1. package/README.md +82 -0
  2. package/bin/vicoa.js +38 -0
  3. package/package.json +29 -10
  4. package/bin/_internal/81d243bd2c585b0f4821__mypyc.cp312-win_amd64.pyd +0 -0
  5. package/bin/_internal/VCRUNTIME140.dll +0 -0
  6. package/bin/_internal/VCRUNTIME140_1.dll +0 -0
  7. package/bin/_internal/_asyncio.pyd +0 -0
  8. package/bin/_internal/_bz2.pyd +0 -0
  9. package/bin/_internal/_cffi_backend.cp312-win_amd64.pyd +0 -0
  10. package/bin/_internal/_ctypes.pyd +0 -0
  11. package/bin/_internal/_decimal.pyd +0 -0
  12. package/bin/_internal/_hashlib.pyd +0 -0
  13. package/bin/_internal/_lzma.pyd +0 -0
  14. package/bin/_internal/_multiprocessing.pyd +0 -0
  15. package/bin/_internal/_overlapped.pyd +0 -0
  16. package/bin/_internal/_queue.pyd +0 -0
  17. package/bin/_internal/_socket.pyd +0 -0
  18. package/bin/_internal/_ssl.pyd +0 -0
  19. package/bin/_internal/_uuid.pyd +0 -0
  20. package/bin/_internal/_wmi.pyd +0 -0
  21. package/bin/_internal/_zoneinfo.pyd +0 -0
  22. package/bin/_internal/aiohttp/_http_parser.cp312-win_amd64.pyd +0 -0
  23. package/bin/_internal/aiohttp/_http_writer.cp312-win_amd64.pyd +0 -0
  24. package/bin/_internal/aiohttp/_websocket/mask.cp312-win_amd64.pyd +0 -0
  25. package/bin/_internal/aiohttp/_websocket/reader_c.cp312-win_amd64.pyd +0 -0
  26. package/bin/_internal/api-ms-win-core-console-l1-1-0.dll +0 -0
  27. package/bin/_internal/api-ms-win-core-datetime-l1-1-0.dll +0 -0
  28. package/bin/_internal/api-ms-win-core-debug-l1-1-0.dll +0 -0
  29. package/bin/_internal/api-ms-win-core-errorhandling-l1-1-0.dll +0 -0
  30. package/bin/_internal/api-ms-win-core-fibers-l1-1-0.dll +0 -0
  31. package/bin/_internal/api-ms-win-core-fibers-l1-1-1.dll +0 -0
  32. package/bin/_internal/api-ms-win-core-file-l1-1-0.dll +0 -0
  33. package/bin/_internal/api-ms-win-core-file-l1-2-0.dll +0 -0
  34. package/bin/_internal/api-ms-win-core-file-l2-1-0.dll +0 -0
  35. package/bin/_internal/api-ms-win-core-handle-l1-1-0.dll +0 -0
  36. package/bin/_internal/api-ms-win-core-heap-l1-1-0.dll +0 -0
  37. package/bin/_internal/api-ms-win-core-interlocked-l1-1-0.dll +0 -0
  38. package/bin/_internal/api-ms-win-core-kernel32-legacy-l1-1-1.dll +0 -0
  39. package/bin/_internal/api-ms-win-core-libraryloader-l1-1-0.dll +0 -0
  40. package/bin/_internal/api-ms-win-core-localization-l1-2-0.dll +0 -0
  41. package/bin/_internal/api-ms-win-core-memory-l1-1-0.dll +0 -0
  42. package/bin/_internal/api-ms-win-core-namedpipe-l1-1-0.dll +0 -0
  43. package/bin/_internal/api-ms-win-core-processenvironment-l1-1-0.dll +0 -0
  44. package/bin/_internal/api-ms-win-core-processthreads-l1-1-0.dll +0 -0
  45. package/bin/_internal/api-ms-win-core-processthreads-l1-1-1.dll +0 -0
  46. package/bin/_internal/api-ms-win-core-profile-l1-1-0.dll +0 -0
  47. package/bin/_internal/api-ms-win-core-rtlsupport-l1-1-0.dll +0 -0
  48. package/bin/_internal/api-ms-win-core-string-l1-1-0.dll +0 -0
  49. package/bin/_internal/api-ms-win-core-synch-l1-1-0.dll +0 -0
  50. package/bin/_internal/api-ms-win-core-synch-l1-2-0.dll +0 -0
  51. package/bin/_internal/api-ms-win-core-sysinfo-l1-1-0.dll +0 -0
  52. package/bin/_internal/api-ms-win-core-sysinfo-l1-2-0.dll +0 -0
  53. package/bin/_internal/api-ms-win-core-timezone-l1-1-0.dll +0 -0
  54. package/bin/_internal/api-ms-win-core-util-l1-1-0.dll +0 -0
  55. package/bin/_internal/api-ms-win-crt-conio-l1-1-0.dll +0 -0
  56. package/bin/_internal/api-ms-win-crt-convert-l1-1-0.dll +0 -0
  57. package/bin/_internal/api-ms-win-crt-environment-l1-1-0.dll +0 -0
  58. package/bin/_internal/api-ms-win-crt-filesystem-l1-1-0.dll +0 -0
  59. package/bin/_internal/api-ms-win-crt-heap-l1-1-0.dll +0 -0
  60. package/bin/_internal/api-ms-win-crt-locale-l1-1-0.dll +0 -0
  61. package/bin/_internal/api-ms-win-crt-math-l1-1-0.dll +0 -0
  62. package/bin/_internal/api-ms-win-crt-process-l1-1-0.dll +0 -0
  63. package/bin/_internal/api-ms-win-crt-runtime-l1-1-0.dll +0 -0
  64. package/bin/_internal/api-ms-win-crt-stdio-l1-1-0.dll +0 -0
  65. package/bin/_internal/api-ms-win-crt-string-l1-1-0.dll +0 -0
  66. package/bin/_internal/api-ms-win-crt-time-l1-1-0.dll +0 -0
  67. package/bin/_internal/api-ms-win-crt-utility-l1-1-0.dll +0 -0
  68. package/bin/_internal/attrs-26.1.0.dist-info/INSTALLER +0 -1
  69. package/bin/_internal/attrs-26.1.0.dist-info/METADATA +0 -199
  70. package/bin/_internal/attrs-26.1.0.dist-info/RECORD +0 -55
  71. package/bin/_internal/attrs-26.1.0.dist-info/WHEEL +0 -4
  72. package/bin/_internal/attrs-26.1.0.dist-info/licenses/LICENSE +0 -21
  73. package/bin/_internal/base_library.zip +0 -0
  74. package/bin/_internal/certifi/cacert.pem +0 -3933
  75. package/bin/_internal/certifi/py.typed +0 -0
  76. package/bin/_internal/charset_normalizer/cd.cp312-win_amd64.pyd +0 -0
  77. package/bin/_internal/charset_normalizer/md.cp312-win_amd64.pyd +0 -0
  78. package/bin/_internal/click-8.3.2.dist-info/INSTALLER +0 -1
  79. package/bin/_internal/click-8.3.2.dist-info/METADATA +0 -84
  80. package/bin/_internal/click-8.3.2.dist-info/RECORD +0 -40
  81. package/bin/_internal/click-8.3.2.dist-info/WHEEL +0 -4
  82. package/bin/_internal/click-8.3.2.dist-info/licenses/LICENSE.txt +0 -28
  83. package/bin/_internal/cryptography/hazmat/bindings/_rust.pyd +0 -0
  84. package/bin/_internal/cryptography-47.0.0.dist-info/INSTALLER +0 -1
  85. package/bin/_internal/cryptography-47.0.0.dist-info/METADATA +0 -112
  86. package/bin/_internal/cryptography-47.0.0.dist-info/RECORD +0 -195
  87. package/bin/_internal/cryptography-47.0.0.dist-info/WHEEL +0 -4
  88. package/bin/_internal/cryptography-47.0.0.dist-info/licenses/LICENSE +0 -3
  89. package/bin/_internal/cryptography-47.0.0.dist-info/licenses/LICENSE.APACHE +0 -202
  90. package/bin/_internal/cryptography-47.0.0.dist-info/licenses/LICENSE.BSD +0 -27
  91. package/bin/_internal/cryptography-47.0.0.dist-info/sboms/cryptography-rust.cyclonedx.json +0 -1363
  92. package/bin/_internal/cryptography-47.0.0.dist-info/sboms/sbom.json +0 -43
  93. package/bin/_internal/fastmcp-2.9.2.dist-info/INSTALLER +0 -1
  94. package/bin/_internal/fastmcp-2.9.2.dist-info/METADATA +0 -465
  95. package/bin/_internal/fastmcp-2.9.2.dist-info/RECORD +0 -149
  96. package/bin/_internal/fastmcp-2.9.2.dist-info/WHEEL +0 -4
  97. package/bin/_internal/fastmcp-2.9.2.dist-info/entry_points.txt +0 -2
  98. package/bin/_internal/fastmcp-2.9.2.dist-info/licenses/LICENSE +0 -201
  99. package/bin/_internal/frozenlist/_frozenlist.cp312-win_amd64.pyd +0 -0
  100. package/bin/_internal/integrations/cli_wrappers/IMPORTANT_USE_CASES.md +0 -33
  101. package/bin/_internal/integrations/github/claude-code-action/CLAUDE.md +0 -136
  102. package/bin/_internal/integrations/github/claude-code-action/CODE_OF_CONDUCT.md +0 -128
  103. package/bin/_internal/integrations/github/claude-code-action/CONTRIBUTING.md +0 -116
  104. package/bin/_internal/integrations/github/claude-code-action/LICENSE +0 -21
  105. package/bin/_internal/integrations/github/claude-code-action/README.md +0 -53
  106. package/bin/_internal/integrations/github/claude-code-action/ROADMAP.md +0 -20
  107. package/bin/_internal/integrations/github/claude-code-action/SECURITY.md +0 -15
  108. package/bin/_internal/integrations/github/claude-code-action/action.yml +0 -294
  109. package/bin/_internal/integrations/github/claude-code-action/base-action/CLAUDE.md +0 -60
  110. package/bin/_internal/integrations/github/claude-code-action/base-action/CODE_OF_CONDUCT.md +0 -128
  111. package/bin/_internal/integrations/github/claude-code-action/base-action/CONTRIBUTING.md +0 -136
  112. package/bin/_internal/integrations/github/claude-code-action/base-action/LICENSE +0 -21
  113. package/bin/_internal/integrations/github/claude-code-action/base-action/MIRROR_DISCLAIMER.md +0 -11
  114. package/bin/_internal/integrations/github/claude-code-action/base-action/README.md +0 -521
  115. package/bin/_internal/integrations/github/claude-code-action/base-action/action.yml +0 -149
  116. package/bin/_internal/integrations/github/claude-code-action/base-action/bun.lock +0 -54
  117. package/bin/_internal/integrations/github/claude-code-action/base-action/examples/issue-triage.yml +0 -108
  118. package/bin/_internal/integrations/github/claude-code-action/base-action/package.json +0 -23
  119. package/bin/_internal/integrations/github/claude-code-action/base-action/scripts/install-hooks.sh +0 -13
  120. package/bin/_internal/integrations/github/claude-code-action/base-action/scripts/pre-push +0 -46
  121. package/bin/_internal/integrations/github/claude-code-action/base-action/src/index.ts +0 -82
  122. package/bin/_internal/integrations/github/claude-code-action/base-action/src/prepare-prompt.ts +0 -82
  123. package/bin/_internal/integrations/github/claude-code-action/base-action/src/run-claude.ts +0 -257
  124. package/bin/_internal/integrations/github/claude-code-action/base-action/src/run-vicoa.ts +0 -301
  125. package/bin/_internal/integrations/github/claude-code-action/base-action/src/setup-claude-code-settings.ts +0 -68
  126. package/bin/_internal/integrations/github/claude-code-action/base-action/src/validate-env.ts +0 -54
  127. package/bin/_internal/integrations/github/claude-code-action/base-action/test-local.sh +0 -12
  128. package/bin/_internal/integrations/github/claude-code-action/base-action/test-mcp-local.sh +0 -18
  129. package/bin/_internal/integrations/github/claude-code-action/base-action/tsconfig.json +0 -30
  130. package/bin/_internal/integrations/github/claude-code-action/bun.lock +0 -384
  131. package/bin/_internal/integrations/github/claude-code-action/docs/capabilities-and-limitations.md +0 -33
  132. package/bin/_internal/integrations/github/claude-code-action/docs/cloud-providers.md +0 -99
  133. package/bin/_internal/integrations/github/claude-code-action/docs/configuration.md +0 -345
  134. package/bin/_internal/integrations/github/claude-code-action/docs/custom-automations.md +0 -113
  135. package/bin/_internal/integrations/github/claude-code-action/docs/experimental.md +0 -128
  136. package/bin/_internal/integrations/github/claude-code-action/docs/faq.md +0 -205
  137. package/bin/_internal/integrations/github/claude-code-action/docs/migration-guide.md +0 -261
  138. package/bin/_internal/integrations/github/claude-code-action/docs/security.md +0 -38
  139. package/bin/_internal/integrations/github/claude-code-action/docs/setup.md +0 -146
  140. package/bin/_internal/integrations/github/claude-code-action/docs/usage.md +0 -213
  141. package/bin/_internal/integrations/github/claude-code-action/examples/auto-fix-ci/auto-fix-ci.yml +0 -97
  142. package/bin/_internal/integrations/github/claude-code-action/examples/auto-fix-ci/commands/fix-ci.md +0 -127
  143. package/bin/_internal/integrations/github/claude-code-action/examples/auto-fix-ci-signed/auto-fix-ci-signed.yml +0 -97
  144. package/bin/_internal/integrations/github/claude-code-action/examples/auto-fix-ci-signed/commands/fix-ci-signed.md +0 -148
  145. package/bin/_internal/integrations/github/claude-code-action/examples/issue-deduplication.yml +0 -63
  146. package/bin/_internal/integrations/github/claude-code-action/examples/issue-triage.yml +0 -75
  147. package/bin/_internal/integrations/github/claude-code-action/examples/vicoa.yml +0 -75
  148. package/bin/_internal/integrations/github/claude-code-action/package.json +0 -31
  149. package/bin/_internal/integrations/github/claude-code-action/scripts/install-hooks.sh +0 -13
  150. package/bin/_internal/integrations/github/claude-code-action/scripts/pre-commit +0 -46
  151. package/bin/_internal/integrations/github/claude-code-action/scripts/setup-network-restrictions.sh +0 -123
  152. package/bin/_internal/integrations/github/claude-code-action/src/create-prompt/index.ts +0 -799
  153. package/bin/_internal/integrations/github/claude-code-action/src/create-prompt/types.ts +0 -102
  154. package/bin/_internal/integrations/github/claude-code-action/src/entrypoints/collect-inputs.ts +0 -58
  155. package/bin/_internal/integrations/github/claude-code-action/src/entrypoints/format-turns.ts +0 -465
  156. package/bin/_internal/integrations/github/claude-code-action/src/entrypoints/prepare.ts +0 -98
  157. package/bin/_internal/integrations/github/claude-code-action/src/entrypoints/update-comment-link.ts +0 -245
  158. package/bin/_internal/integrations/github/claude-code-action/src/github/api/client.ts +0 -23
  159. package/bin/_internal/integrations/github/claude-code-action/src/github/api/config.ts +0 -4
  160. package/bin/_internal/integrations/github/claude-code-action/src/github/api/queries/github.ts +0 -117
  161. package/bin/_internal/integrations/github/claude-code-action/src/github/context.ts +0 -277
  162. package/bin/_internal/integrations/github/claude-code-action/src/github/data/fetcher.ts +0 -233
  163. package/bin/_internal/integrations/github/claude-code-action/src/github/data/formatter.ts +0 -144
  164. package/bin/_internal/integrations/github/claude-code-action/src/github/operations/branch-cleanup.ts +0 -132
  165. package/bin/_internal/integrations/github/claude-code-action/src/github/operations/branch.ts +0 -163
  166. package/bin/_internal/integrations/github/claude-code-action/src/github/operations/comment-logic.ts +0 -203
  167. package/bin/_internal/integrations/github/claude-code-action/src/github/operations/comments/common.ts +0 -33
  168. package/bin/_internal/integrations/github/claude-code-action/src/github/operations/comments/create-initial.ts +0 -111
  169. package/bin/_internal/integrations/github/claude-code-action/src/github/operations/comments/update-claude-comment.ts +0 -70
  170. package/bin/_internal/integrations/github/claude-code-action/src/github/operations/comments/update-with-branch.ts +0 -57
  171. package/bin/_internal/integrations/github/claude-code-action/src/github/operations/git-config.ts +0 -62
  172. package/bin/_internal/integrations/github/claude-code-action/src/github/token.ts +0 -108
  173. package/bin/_internal/integrations/github/claude-code-action/src/github/types.ts +0 -98
  174. package/bin/_internal/integrations/github/claude-code-action/src/github/utils/image-downloader.ts +0 -246
  175. package/bin/_internal/integrations/github/claude-code-action/src/github/utils/sanitizer.ts +0 -100
  176. package/bin/_internal/integrations/github/claude-code-action/src/github/validation/actor.ts +0 -64
  177. package/bin/_internal/integrations/github/claude-code-action/src/github/validation/permissions.ts +0 -47
  178. package/bin/_internal/integrations/github/claude-code-action/src/github/validation/trigger.ts +0 -148
  179. package/bin/_internal/integrations/github/claude-code-action/src/mcp/github-actions-server.ts +0 -279
  180. package/bin/_internal/integrations/github/claude-code-action/src/mcp/github-comment-server.ts +0 -101
  181. package/bin/_internal/integrations/github/claude-code-action/src/mcp/github-file-ops-server.ts +0 -677
  182. package/bin/_internal/integrations/github/claude-code-action/src/mcp/github-inline-comment-server.ts +0 -184
  183. package/bin/_internal/integrations/github/claude-code-action/src/mcp/install-mcp-server.ts +0 -201
  184. package/bin/_internal/integrations/github/claude-code-action/src/modes/agent/index.ts +0 -152
  185. package/bin/_internal/integrations/github/claude-code-action/src/modes/agent/parse-tools.ts +0 -22
  186. package/bin/_internal/integrations/github/claude-code-action/src/modes/detector.ts +0 -66
  187. package/bin/_internal/integrations/github/claude-code-action/src/modes/registry.ts +0 -54
  188. package/bin/_internal/integrations/github/claude-code-action/src/modes/tag/index.ts +0 -187
  189. package/bin/_internal/integrations/github/claude-code-action/src/modes/types.ts +0 -100
  190. package/bin/_internal/integrations/github/claude-code-action/src/prepare/index.ts +0 -20
  191. package/bin/_internal/integrations/github/claude-code-action/src/prepare/types.ts +0 -20
  192. package/bin/_internal/integrations/github/claude-code-action/src/utils/retry.ts +0 -40
  193. package/bin/_internal/integrations/github/claude-code-action/tsconfig.json +0 -30
  194. package/bin/_internal/integrations/n8n/LICENSE +0 -21
  195. package/bin/_internal/integrations/n8n/README.md +0 -298
  196. package/bin/_internal/integrations/n8n/package-lock.json +0 -2989
  197. package/bin/_internal/integrations/n8n/package.json +0 -68
  198. package/bin/_internal/integrations/n8n/src/credentials/OmnaraApi.credentials.ts +0 -52
  199. package/bin/_internal/integrations/n8n/src/nodes/Omnara/Omnara.node.json +0 -35
  200. package/bin/_internal/integrations/n8n/src/nodes/Omnara/Omnara.node.ts +0 -304
  201. package/bin/_internal/integrations/n8n/src/nodes/Omnara/actions/message/index.ts +0 -37
  202. package/bin/_internal/integrations/n8n/src/nodes/Omnara/actions/message/send.operation.ts +0 -151
  203. package/bin/_internal/integrations/n8n/src/nodes/Omnara/actions/message/sendAndWait.operation.ts +0 -252
  204. package/bin/_internal/integrations/n8n/src/nodes/Omnara/actions/session/end.operation.ts +0 -56
  205. package/bin/_internal/integrations/n8n/src/nodes/Omnara/actions/session/index.ts +0 -29
  206. package/bin/_internal/integrations/n8n/src/nodes/Omnara/vicoa.png +0 -0
  207. package/bin/_internal/integrations/n8n/src/utils/GenericFunctions.ts +0 -93
  208. package/bin/_internal/integrations/n8n/src/utils/sendAndWait/configureWaitTillDate.ts +0 -42
  209. package/bin/_internal/integrations/n8n/src/utils/sendAndWait/descriptions.ts +0 -20
  210. package/bin/_internal/integrations/n8n/src/utils/sendAndWaitWebhook.ts +0 -72
  211. package/bin/_internal/integrations/n8n/tsconfig.json +0 -20
  212. package/bin/_internal/jiter/jiter.cp312-win_amd64.pyd +0 -0
  213. package/bin/_internal/libcrypto-3.dll +0 -0
  214. package/bin/_internal/libffi-8.dll +0 -0
  215. package/bin/_internal/libssl-3.dll +0 -0
  216. package/bin/_internal/mcp-1.9.4.dist-info/INSTALLER +0 -1
  217. package/bin/_internal/mcp-1.9.4.dist-info/METADATA +0 -939
  218. package/bin/_internal/mcp-1.9.4.dist-info/RECORD +0 -154
  219. package/bin/_internal/mcp-1.9.4.dist-info/WHEEL +0 -4
  220. package/bin/_internal/mcp-1.9.4.dist-info/entry_points.txt +0 -2
  221. package/bin/_internal/mcp-1.9.4.dist-info/licenses/LICENSE +0 -21
  222. package/bin/_internal/multidict/_multidict.cp312-win_amd64.pyd +0 -0
  223. package/bin/_internal/propcache/_helpers_c.cp312-win_amd64.pyd +0 -0
  224. package/bin/_internal/pydantic_core/_pydantic_core.cp312-win_amd64.pyd +0 -0
  225. package/bin/_internal/pyexpat.pyd +0 -0
  226. package/bin/_internal/python3.dll +0 -0
  227. package/bin/_internal/python312.dll +0 -0
  228. package/bin/_internal/select.pyd +0 -0
  229. package/bin/_internal/setuptools/_vendor/importlib_metadata-8.7.1.dist-info/INSTALLER +0 -1
  230. package/bin/_internal/setuptools/_vendor/importlib_metadata-8.7.1.dist-info/METADATA +0 -133
  231. package/bin/_internal/setuptools/_vendor/importlib_metadata-8.7.1.dist-info/RECORD +0 -21
  232. package/bin/_internal/setuptools/_vendor/importlib_metadata-8.7.1.dist-info/REQUESTED +0 -0
  233. package/bin/_internal/setuptools/_vendor/importlib_metadata-8.7.1.dist-info/WHEEL +0 -5
  234. package/bin/_internal/setuptools/_vendor/importlib_metadata-8.7.1.dist-info/licenses/LICENSE +0 -73
  235. package/bin/_internal/setuptools/_vendor/importlib_metadata-8.7.1.dist-info/top_level.txt +0 -1
  236. package/bin/_internal/setuptools/_vendor/jaraco/text/Lorem ipsum.txt +0 -2
  237. package/bin/_internal/ucrtbase.dll +0 -0
  238. package/bin/_internal/unicodedata.pyd +0 -0
  239. package/bin/_internal/vicoa/_bin/README.md +0 -28
  240. package/bin/_internal/vicoa-1.3.19.dist-info/INSTALLER +0 -1
  241. package/bin/_internal/vicoa-1.3.19.dist-info/METADATA +0 -312
  242. package/bin/_internal/vicoa-1.3.19.dist-info/RECORD +0 -11
  243. package/bin/_internal/vicoa-1.3.19.dist-info/REQUESTED +0 -0
  244. package/bin/_internal/vicoa-1.3.19.dist-info/WHEEL +0 -5
  245. package/bin/_internal/vicoa-1.3.19.dist-info/direct_url.json +0 -1
  246. package/bin/_internal/vicoa-1.3.19.dist-info/entry_points.txt +0 -2
  247. package/bin/_internal/vicoa-1.3.19.dist-info/licenses/LICENSE +0 -201
  248. package/bin/_internal/vicoa-1.3.19.dist-info/top_level.txt +0 -3
  249. package/bin/_internal/yarl/_quoting_c.cp312-win_amd64.pyd +0 -0
  250. package/bin/vicoa.exe +0 -0
@@ -1,939 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: mcp
3
- Version: 1.9.4
4
- Summary: Model Context Protocol SDK
5
- Project-URL: Homepage, https://modelcontextprotocol.io
6
- Project-URL: Repository, https://github.com/modelcontextprotocol/python-sdk
7
- Project-URL: Issues, https://github.com/modelcontextprotocol/python-sdk/issues
8
- Author: Anthropic, PBC.
9
- Maintainer-email: David Soria Parra <davidsp@anthropic.com>, Justin Spahr-Summers <justin@anthropic.com>
10
- License: MIT
11
- License-File: LICENSE
12
- Keywords: automation,git,llm,mcp
13
- Classifier: Development Status :: 4 - Beta
14
- Classifier: Intended Audience :: Developers
15
- Classifier: License :: OSI Approved :: MIT License
16
- Classifier: Programming Language :: Python :: 3
17
- Classifier: Programming Language :: Python :: 3.10
18
- Classifier: Programming Language :: Python :: 3.11
19
- Classifier: Programming Language :: Python :: 3.12
20
- Classifier: Programming Language :: Python :: 3.13
21
- Requires-Python: >=3.10
22
- Requires-Dist: anyio>=4.5
23
- Requires-Dist: httpx-sse>=0.4
24
- Requires-Dist: httpx>=0.27
25
- Requires-Dist: pydantic-settings>=2.5.2
26
- Requires-Dist: pydantic<3.0.0,>=2.7.2
27
- Requires-Dist: python-multipart>=0.0.9
28
- Requires-Dist: sse-starlette>=1.6.1
29
- Requires-Dist: starlette>=0.27
30
- Requires-Dist: uvicorn>=0.23.1; sys_platform != 'emscripten'
31
- Provides-Extra: cli
32
- Requires-Dist: python-dotenv>=1.0.0; extra == 'cli'
33
- Requires-Dist: typer>=0.12.4; extra == 'cli'
34
- Provides-Extra: rich
35
- Requires-Dist: rich>=13.9.4; extra == 'rich'
36
- Provides-Extra: ws
37
- Requires-Dist: websockets>=15.0.1; extra == 'ws'
38
- Description-Content-Type: text/markdown
39
-
40
- # MCP Python SDK
41
-
42
- <div align="center">
43
-
44
- <strong>Python implementation of the Model Context Protocol (MCP)</strong>
45
-
46
- [![PyPI][pypi-badge]][pypi-url]
47
- [![MIT licensed][mit-badge]][mit-url]
48
- [![Python Version][python-badge]][python-url]
49
- [![Documentation][docs-badge]][docs-url]
50
- [![Specification][spec-badge]][spec-url]
51
- [![GitHub Discussions][discussions-badge]][discussions-url]
52
-
53
- </div>
54
-
55
- <!-- omit in toc -->
56
- ## Table of Contents
57
-
58
- - [MCP Python SDK](#mcp-python-sdk)
59
- - [Overview](#overview)
60
- - [Installation](#installation)
61
- - [Adding MCP to your python project](#adding-mcp-to-your-python-project)
62
- - [Running the standalone MCP development tools](#running-the-standalone-mcp-development-tools)
63
- - [Quickstart](#quickstart)
64
- - [What is MCP?](#what-is-mcp)
65
- - [Core Concepts](#core-concepts)
66
- - [Server](#server)
67
- - [Resources](#resources)
68
- - [Tools](#tools)
69
- - [Prompts](#prompts)
70
- - [Images](#images)
71
- - [Context](#context)
72
- - [Running Your Server](#running-your-server)
73
- - [Development Mode](#development-mode)
74
- - [Claude Desktop Integration](#claude-desktop-integration)
75
- - [Direct Execution](#direct-execution)
76
- - [Mounting to an Existing ASGI Server](#mounting-to-an-existing-asgi-server)
77
- - [Examples](#examples)
78
- - [Echo Server](#echo-server)
79
- - [SQLite Explorer](#sqlite-explorer)
80
- - [Advanced Usage](#advanced-usage)
81
- - [Low-Level Server](#low-level-server)
82
- - [Writing MCP Clients](#writing-mcp-clients)
83
- - [MCP Primitives](#mcp-primitives)
84
- - [Server Capabilities](#server-capabilities)
85
- - [Documentation](#documentation)
86
- - [Contributing](#contributing)
87
- - [License](#license)
88
-
89
- [pypi-badge]: https://img.shields.io/pypi/v/mcp.svg
90
- [pypi-url]: https://pypi.org/project/mcp/
91
- [mit-badge]: https://img.shields.io/pypi/l/mcp.svg
92
- [mit-url]: https://github.com/modelcontextprotocol/python-sdk/blob/main/LICENSE
93
- [python-badge]: https://img.shields.io/pypi/pyversions/mcp.svg
94
- [python-url]: https://www.python.org/downloads/
95
- [docs-badge]: https://img.shields.io/badge/docs-modelcontextprotocol.io-blue.svg
96
- [docs-url]: https://modelcontextprotocol.io
97
- [spec-badge]: https://img.shields.io/badge/spec-spec.modelcontextprotocol.io-blue.svg
98
- [spec-url]: https://spec.modelcontextprotocol.io
99
- [discussions-badge]: https://img.shields.io/github/discussions/modelcontextprotocol/python-sdk
100
- [discussions-url]: https://github.com/modelcontextprotocol/python-sdk/discussions
101
-
102
- ## Overview
103
-
104
- The Model Context Protocol allows applications to provide context for LLMs in a standardized way, separating the concerns of providing context from the actual LLM interaction. This Python SDK implements the full MCP specification, making it easy to:
105
-
106
- - Build MCP clients that can connect to any MCP server
107
- - Create MCP servers that expose resources, prompts and tools
108
- - Use standard transports like stdio, SSE, and Streamable HTTP
109
- - Handle all MCP protocol messages and lifecycle events
110
-
111
- ## Installation
112
-
113
- ### Adding MCP to your python project
114
-
115
- We recommend using [uv](https://docs.astral.sh/uv/) to manage your Python projects.
116
-
117
- If you haven't created a uv-managed project yet, create one:
118
-
119
- ```bash
120
- uv init mcp-server-demo
121
- cd mcp-server-demo
122
- ```
123
-
124
- Then add MCP to your project dependencies:
125
-
126
- ```bash
127
- uv add "mcp[cli]"
128
- ```
129
-
130
- Alternatively, for projects using pip for dependencies:
131
- ```bash
132
- pip install "mcp[cli]"
133
- ```
134
-
135
- ### Running the standalone MCP development tools
136
-
137
- To run the mcp command with uv:
138
-
139
- ```bash
140
- uv run mcp
141
- ```
142
-
143
- ## Quickstart
144
-
145
- Let's create a simple MCP server that exposes a calculator tool and some data:
146
-
147
- ```python
148
- # server.py
149
- from mcp.server.fastmcp import FastMCP
150
-
151
- # Create an MCP server
152
- mcp = FastMCP("Demo")
153
-
154
-
155
- # Add an addition tool
156
- @mcp.tool()
157
- def add(a: int, b: int) -> int:
158
- """Add two numbers"""
159
- return a + b
160
-
161
-
162
- # Add a dynamic greeting resource
163
- @mcp.resource("greeting://{name}")
164
- def get_greeting(name: str) -> str:
165
- """Get a personalized greeting"""
166
- return f"Hello, {name}!"
167
- ```
168
-
169
- You can install this server in [Claude Desktop](https://claude.ai/download) and interact with it right away by running:
170
- ```bash
171
- mcp install server.py
172
- ```
173
-
174
- Alternatively, you can test it with the MCP Inspector:
175
- ```bash
176
- mcp dev server.py
177
- ```
178
-
179
- ## What is MCP?
180
-
181
- The [Model Context Protocol (MCP)](https://modelcontextprotocol.io) lets you build servers that expose data and functionality to LLM applications in a secure, standardized way. Think of it like a web API, but specifically designed for LLM interactions. MCP servers can:
182
-
183
- - Expose data through **Resources** (think of these sort of like GET endpoints; they are used to load information into the LLM's context)
184
- - Provide functionality through **Tools** (sort of like POST endpoints; they are used to execute code or otherwise produce a side effect)
185
- - Define interaction patterns through **Prompts** (reusable templates for LLM interactions)
186
- - And more!
187
-
188
- ## Core Concepts
189
-
190
- ### Server
191
-
192
- The FastMCP server is your core interface to the MCP protocol. It handles connection management, protocol compliance, and message routing:
193
-
194
- ```python
195
- # Add lifespan support for startup/shutdown with strong typing
196
- from contextlib import asynccontextmanager
197
- from collections.abc import AsyncIterator
198
- from dataclasses import dataclass
199
-
200
- from fake_database import Database # Replace with your actual DB type
201
-
202
- from mcp.server.fastmcp import FastMCP
203
-
204
- # Create a named server
205
- mcp = FastMCP("My App")
206
-
207
- # Specify dependencies for deployment and development
208
- mcp = FastMCP("My App", dependencies=["pandas", "numpy"])
209
-
210
-
211
- @dataclass
212
- class AppContext:
213
- db: Database
214
-
215
-
216
- @asynccontextmanager
217
- async def app_lifespan(server: FastMCP) -> AsyncIterator[AppContext]:
218
- """Manage application lifecycle with type-safe context"""
219
- # Initialize on startup
220
- db = await Database.connect()
221
- try:
222
- yield AppContext(db=db)
223
- finally:
224
- # Cleanup on shutdown
225
- await db.disconnect()
226
-
227
-
228
- # Pass lifespan to server
229
- mcp = FastMCP("My App", lifespan=app_lifespan)
230
-
231
-
232
- # Access type-safe lifespan context in tools
233
- @mcp.tool()
234
- def query_db() -> str:
235
- """Tool that uses initialized resources"""
236
- ctx = mcp.get_context()
237
- db = ctx.request_context.lifespan_context["db"]
238
- return db.query()
239
- ```
240
-
241
- ### Resources
242
-
243
- Resources are how you expose data to LLMs. They're similar to GET endpoints in a REST API - they provide data but shouldn't perform significant computation or have side effects:
244
-
245
- ```python
246
- from mcp.server.fastmcp import FastMCP
247
-
248
- mcp = FastMCP("My App")
249
-
250
-
251
- @mcp.resource("config://app")
252
- def get_config() -> str:
253
- """Static configuration data"""
254
- return "App configuration here"
255
-
256
-
257
- @mcp.resource("users://{user_id}/profile")
258
- def get_user_profile(user_id: str) -> str:
259
- """Dynamic user data"""
260
- return f"Profile data for user {user_id}"
261
- ```
262
-
263
- ### Tools
264
-
265
- Tools let LLMs take actions through your server. Unlike resources, tools are expected to perform computation and have side effects:
266
-
267
- ```python
268
- import httpx
269
- from mcp.server.fastmcp import FastMCP
270
-
271
- mcp = FastMCP("My App")
272
-
273
-
274
- @mcp.tool()
275
- def calculate_bmi(weight_kg: float, height_m: float) -> float:
276
- """Calculate BMI given weight in kg and height in meters"""
277
- return weight_kg / (height_m**2)
278
-
279
-
280
- @mcp.tool()
281
- async def fetch_weather(city: str) -> str:
282
- """Fetch current weather for a city"""
283
- async with httpx.AsyncClient() as client:
284
- response = await client.get(f"https://api.weather.com/{city}")
285
- return response.text
286
- ```
287
-
288
- ### Prompts
289
-
290
- Prompts are reusable templates that help LLMs interact with your server effectively:
291
-
292
- ```python
293
- from mcp.server.fastmcp import FastMCP
294
- from mcp.server.fastmcp.prompts import base
295
-
296
- mcp = FastMCP("My App")
297
-
298
-
299
- @mcp.prompt()
300
- def review_code(code: str) -> str:
301
- return f"Please review this code:\n\n{code}"
302
-
303
-
304
- @mcp.prompt()
305
- def debug_error(error: str) -> list[base.Message]:
306
- return [
307
- base.UserMessage("I'm seeing this error:"),
308
- base.UserMessage(error),
309
- base.AssistantMessage("I'll help debug that. What have you tried so far?"),
310
- ]
311
- ```
312
-
313
- ### Images
314
-
315
- FastMCP provides an `Image` class that automatically handles image data:
316
-
317
- ```python
318
- from mcp.server.fastmcp import FastMCP, Image
319
- from PIL import Image as PILImage
320
-
321
- mcp = FastMCP("My App")
322
-
323
-
324
- @mcp.tool()
325
- def create_thumbnail(image_path: str) -> Image:
326
- """Create a thumbnail from an image"""
327
- img = PILImage.open(image_path)
328
- img.thumbnail((100, 100))
329
- return Image(data=img.tobytes(), format="png")
330
- ```
331
-
332
- ### Context
333
-
334
- The Context object gives your tools and resources access to MCP capabilities:
335
-
336
- ```python
337
- from mcp.server.fastmcp import FastMCP, Context
338
-
339
- mcp = FastMCP("My App")
340
-
341
-
342
- @mcp.tool()
343
- async def long_task(files: list[str], ctx: Context) -> str:
344
- """Process multiple files with progress tracking"""
345
- for i, file in enumerate(files):
346
- ctx.info(f"Processing {file}")
347
- await ctx.report_progress(i, len(files))
348
- data, mime_type = await ctx.read_resource(f"file://{file}")
349
- return "Processing complete"
350
- ```
351
-
352
- ### Authentication
353
-
354
- Authentication can be used by servers that want to expose tools accessing protected resources.
355
-
356
- `mcp.server.auth` implements an OAuth 2.0 server interface, which servers can use by
357
- providing an implementation of the `OAuthAuthorizationServerProvider` protocol.
358
-
359
- ```python
360
- from mcp import FastMCP
361
- from mcp.server.auth.provider import OAuthAuthorizationServerProvider
362
- from mcp.server.auth.settings import (
363
- AuthSettings,
364
- ClientRegistrationOptions,
365
- RevocationOptions,
366
- )
367
-
368
-
369
- class MyOAuthServerProvider(OAuthAuthorizationServerProvider):
370
- # See an example on how to implement at `examples/servers/simple-auth`
371
- ...
372
-
373
-
374
- mcp = FastMCP(
375
- "My App",
376
- auth_server_provider=MyOAuthServerProvider(),
377
- auth=AuthSettings(
378
- issuer_url="https://myapp.com",
379
- revocation_options=RevocationOptions(
380
- enabled=True,
381
- ),
382
- client_registration_options=ClientRegistrationOptions(
383
- enabled=True,
384
- valid_scopes=["myscope", "myotherscope"],
385
- default_scopes=["myscope"],
386
- ),
387
- required_scopes=["myscope"],
388
- ),
389
- )
390
- ```
391
-
392
- See [OAuthAuthorizationServerProvider](src/mcp/server/auth/provider.py) for more details.
393
-
394
- ## Running Your Server
395
-
396
- ### Development Mode
397
-
398
- The fastest way to test and debug your server is with the MCP Inspector:
399
-
400
- ```bash
401
- mcp dev server.py
402
-
403
- # Add dependencies
404
- mcp dev server.py --with pandas --with numpy
405
-
406
- # Mount local code
407
- mcp dev server.py --with-editable .
408
- ```
409
-
410
- ### Claude Desktop Integration
411
-
412
- Once your server is ready, install it in Claude Desktop:
413
-
414
- ```bash
415
- mcp install server.py
416
-
417
- # Custom name
418
- mcp install server.py --name "My Analytics Server"
419
-
420
- # Environment variables
421
- mcp install server.py -v API_KEY=abc123 -v DB_URL=postgres://...
422
- mcp install server.py -f .env
423
- ```
424
-
425
- ### Direct Execution
426
-
427
- For advanced scenarios like custom deployments:
428
-
429
- ```python
430
- from mcp.server.fastmcp import FastMCP
431
-
432
- mcp = FastMCP("My App")
433
-
434
- if __name__ == "__main__":
435
- mcp.run()
436
- ```
437
-
438
- Run it with:
439
- ```bash
440
- python server.py
441
- # or
442
- mcp run server.py
443
- ```
444
-
445
- Note that `mcp run` or `mcp dev` only supports server using FastMCP and not the low-level server variant.
446
-
447
- ### Streamable HTTP Transport
448
-
449
- > **Note**: Streamable HTTP transport is superseding SSE transport for production deployments.
450
-
451
- ```python
452
- from mcp.server.fastmcp import FastMCP
453
-
454
- # Stateful server (maintains session state)
455
- mcp = FastMCP("StatefulServer")
456
-
457
- # Stateless server (no session persistence)
458
- mcp = FastMCP("StatelessServer", stateless_http=True)
459
-
460
- # Stateless server (no session persistence, no sse stream with supported client)
461
- mcp = FastMCP("StatelessServer", stateless_http=True, json_response=True)
462
-
463
- # Run server with streamable_http transport
464
- mcp.run(transport="streamable-http")
465
- ```
466
-
467
- You can mount multiple FastMCP servers in a FastAPI application:
468
-
469
- ```python
470
- # echo.py
471
- from mcp.server.fastmcp import FastMCP
472
-
473
- mcp = FastMCP(name="EchoServer", stateless_http=True)
474
-
475
-
476
- @mcp.tool(description="A simple echo tool")
477
- def echo(message: str) -> str:
478
- return f"Echo: {message}"
479
- ```
480
-
481
- ```python
482
- # math.py
483
- from mcp.server.fastmcp import FastMCP
484
-
485
- mcp = FastMCP(name="MathServer", stateless_http=True)
486
-
487
-
488
- @mcp.tool(description="A simple add tool")
489
- def add_two(n: int) -> int:
490
- return n + 2
491
- ```
492
-
493
- ```python
494
- # main.py
495
- import contextlib
496
- from fastapi import FastAPI
497
- from mcp.echo import echo
498
- from mcp.math import math
499
-
500
-
501
- # Create a combined lifespan to manage both session managers
502
- @contextlib.asynccontextmanager
503
- async def lifespan(app: FastAPI):
504
- async with contextlib.AsyncExitStack() as stack:
505
- await stack.enter_async_context(echo.mcp.session_manager.run())
506
- await stack.enter_async_context(math.mcp.session_manager.run())
507
- yield
508
-
509
-
510
- app = FastAPI(lifespan=lifespan)
511
- app.mount("/echo", echo.mcp.streamable_http_app())
512
- app.mount("/math", math.mcp.streamable_http_app())
513
- ```
514
-
515
- For low level server with Streamable HTTP implementations, see:
516
- - Stateful server: [`examples/servers/simple-streamablehttp/`](examples/servers/simple-streamablehttp/)
517
- - Stateless server: [`examples/servers/simple-streamablehttp-stateless/`](examples/servers/simple-streamablehttp-stateless/)
518
-
519
- The streamable HTTP transport supports:
520
- - Stateful and stateless operation modes
521
- - Resumability with event stores
522
- - JSON or SSE response formats
523
- - Better scalability for multi-node deployments
524
-
525
- ### Mounting to an Existing ASGI Server
526
-
527
- > **Note**: SSE transport is being superseded by [Streamable HTTP transport](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#streamable-http).
528
-
529
- By default, SSE servers are mounted at `/sse` and Streamable HTTP servers are mounted at `/mcp`. You can customize these paths using the methods described below.
530
-
531
- You can mount the SSE server to an existing ASGI server using the `sse_app` method. This allows you to integrate the SSE server with other ASGI applications.
532
-
533
- ```python
534
- from starlette.applications import Starlette
535
- from starlette.routing import Mount, Host
536
- from mcp.server.fastmcp import FastMCP
537
-
538
-
539
- mcp = FastMCP("My App")
540
-
541
- # Mount the SSE server to the existing ASGI server
542
- app = Starlette(
543
- routes=[
544
- Mount('/', app=mcp.sse_app()),
545
- ]
546
- )
547
-
548
- # or dynamically mount as host
549
- app.router.routes.append(Host('mcp.acme.corp', app=mcp.sse_app()))
550
- ```
551
-
552
- When mounting multiple MCP servers under different paths, you can configure the mount path in several ways:
553
-
554
- ```python
555
- from starlette.applications import Starlette
556
- from starlette.routing import Mount
557
- from mcp.server.fastmcp import FastMCP
558
-
559
- # Create multiple MCP servers
560
- github_mcp = FastMCP("GitHub API")
561
- browser_mcp = FastMCP("Browser")
562
- curl_mcp = FastMCP("Curl")
563
- search_mcp = FastMCP("Search")
564
-
565
- # Method 1: Configure mount paths via settings (recommended for persistent configuration)
566
- github_mcp.settings.mount_path = "/github"
567
- browser_mcp.settings.mount_path = "/browser"
568
-
569
- # Method 2: Pass mount path directly to sse_app (preferred for ad-hoc mounting)
570
- # This approach doesn't modify the server's settings permanently
571
-
572
- # Create Starlette app with multiple mounted servers
573
- app = Starlette(
574
- routes=[
575
- # Using settings-based configuration
576
- Mount("/github", app=github_mcp.sse_app()),
577
- Mount("/browser", app=browser_mcp.sse_app()),
578
- # Using direct mount path parameter
579
- Mount("/curl", app=curl_mcp.sse_app("/curl")),
580
- Mount("/search", app=search_mcp.sse_app("/search")),
581
- ]
582
- )
583
-
584
- # Method 3: For direct execution, you can also pass the mount path to run()
585
- if __name__ == "__main__":
586
- search_mcp.run(transport="sse", mount_path="/search")
587
- ```
588
-
589
- For more information on mounting applications in Starlette, see the [Starlette documentation](https://www.starlette.io/routing/#submounting-routes).
590
-
591
- ## Examples
592
-
593
- ### Echo Server
594
-
595
- A simple server demonstrating resources, tools, and prompts:
596
-
597
- ```python
598
- from mcp.server.fastmcp import FastMCP
599
-
600
- mcp = FastMCP("Echo")
601
-
602
-
603
- @mcp.resource("echo://{message}")
604
- def echo_resource(message: str) -> str:
605
- """Echo a message as a resource"""
606
- return f"Resource echo: {message}"
607
-
608
-
609
- @mcp.tool()
610
- def echo_tool(message: str) -> str:
611
- """Echo a message as a tool"""
612
- return f"Tool echo: {message}"
613
-
614
-
615
- @mcp.prompt()
616
- def echo_prompt(message: str) -> str:
617
- """Create an echo prompt"""
618
- return f"Please process this message: {message}"
619
- ```
620
-
621
- ### SQLite Explorer
622
-
623
- A more complex example showing database integration:
624
-
625
- ```python
626
- import sqlite3
627
-
628
- from mcp.server.fastmcp import FastMCP
629
-
630
- mcp = FastMCP("SQLite Explorer")
631
-
632
-
633
- @mcp.resource("schema://main")
634
- def get_schema() -> str:
635
- """Provide the database schema as a resource"""
636
- conn = sqlite3.connect("database.db")
637
- schema = conn.execute("SELECT sql FROM sqlite_master WHERE type='table'").fetchall()
638
- return "\n".join(sql[0] for sql in schema if sql[0])
639
-
640
-
641
- @mcp.tool()
642
- def query_data(sql: str) -> str:
643
- """Execute SQL queries safely"""
644
- conn = sqlite3.connect("database.db")
645
- try:
646
- result = conn.execute(sql).fetchall()
647
- return "\n".join(str(row) for row in result)
648
- except Exception as e:
649
- return f"Error: {str(e)}"
650
- ```
651
-
652
- ## Advanced Usage
653
-
654
- ### Low-Level Server
655
-
656
- For more control, you can use the low-level server implementation directly. This gives you full access to the protocol and allows you to customize every aspect of your server, including lifecycle management through the lifespan API:
657
-
658
- ```python
659
- from contextlib import asynccontextmanager
660
- from collections.abc import AsyncIterator
661
-
662
- from fake_database import Database # Replace with your actual DB type
663
-
664
- from mcp.server import Server
665
-
666
-
667
- @asynccontextmanager
668
- async def server_lifespan(server: Server) -> AsyncIterator[dict]:
669
- """Manage server startup and shutdown lifecycle."""
670
- # Initialize resources on startup
671
- db = await Database.connect()
672
- try:
673
- yield {"db": db}
674
- finally:
675
- # Clean up on shutdown
676
- await db.disconnect()
677
-
678
-
679
- # Pass lifespan to server
680
- server = Server("example-server", lifespan=server_lifespan)
681
-
682
-
683
- # Access lifespan context in handlers
684
- @server.call_tool()
685
- async def query_db(name: str, arguments: dict) -> list:
686
- ctx = server.request_context
687
- db = ctx.lifespan_context["db"]
688
- return await db.query(arguments["query"])
689
- ```
690
-
691
- The lifespan API provides:
692
- - A way to initialize resources when the server starts and clean them up when it stops
693
- - Access to initialized resources through the request context in handlers
694
- - Type-safe context passing between lifespan and request handlers
695
-
696
- ```python
697
- import mcp.server.stdio
698
- import mcp.types as types
699
- from mcp.server.lowlevel import NotificationOptions, Server
700
- from mcp.server.models import InitializationOptions
701
-
702
- # Create a server instance
703
- server = Server("example-server")
704
-
705
-
706
- @server.list_prompts()
707
- async def handle_list_prompts() -> list[types.Prompt]:
708
- return [
709
- types.Prompt(
710
- name="example-prompt",
711
- description="An example prompt template",
712
- arguments=[
713
- types.PromptArgument(
714
- name="arg1", description="Example argument", required=True
715
- )
716
- ],
717
- )
718
- ]
719
-
720
-
721
- @server.get_prompt()
722
- async def handle_get_prompt(
723
- name: str, arguments: dict[str, str] | None
724
- ) -> types.GetPromptResult:
725
- if name != "example-prompt":
726
- raise ValueError(f"Unknown prompt: {name}")
727
-
728
- return types.GetPromptResult(
729
- description="Example prompt",
730
- messages=[
731
- types.PromptMessage(
732
- role="user",
733
- content=types.TextContent(type="text", text="Example prompt text"),
734
- )
735
- ],
736
- )
737
-
738
-
739
- async def run():
740
- async with mcp.server.stdio.stdio_server() as (read_stream, write_stream):
741
- await server.run(
742
- read_stream,
743
- write_stream,
744
- InitializationOptions(
745
- server_name="example",
746
- server_version="0.1.0",
747
- capabilities=server.get_capabilities(
748
- notification_options=NotificationOptions(),
749
- experimental_capabilities={},
750
- ),
751
- ),
752
- )
753
-
754
-
755
- if __name__ == "__main__":
756
- import asyncio
757
-
758
- asyncio.run(run())
759
- ```
760
-
761
- Caution: The `mcp run` and `mcp dev` tool doesn't support low-level server.
762
-
763
- ### Writing MCP Clients
764
-
765
- The SDK provides a high-level client interface for connecting to MCP servers using various [transports](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports):
766
-
767
- ```python
768
- from mcp import ClientSession, StdioServerParameters, types
769
- from mcp.client.stdio import stdio_client
770
-
771
- # Create server parameters for stdio connection
772
- server_params = StdioServerParameters(
773
- command="python", # Executable
774
- args=["example_server.py"], # Optional command line arguments
775
- env=None, # Optional environment variables
776
- )
777
-
778
-
779
- # Optional: create a sampling callback
780
- async def handle_sampling_message(
781
- message: types.CreateMessageRequestParams,
782
- ) -> types.CreateMessageResult:
783
- return types.CreateMessageResult(
784
- role="assistant",
785
- content=types.TextContent(
786
- type="text",
787
- text="Hello, world! from model",
788
- ),
789
- model="gpt-3.5-turbo",
790
- stopReason="endTurn",
791
- )
792
-
793
-
794
- async def run():
795
- async with stdio_client(server_params) as (read, write):
796
- async with ClientSession(
797
- read, write, sampling_callback=handle_sampling_message
798
- ) as session:
799
- # Initialize the connection
800
- await session.initialize()
801
-
802
- # List available prompts
803
- prompts = await session.list_prompts()
804
-
805
- # Get a prompt
806
- prompt = await session.get_prompt(
807
- "example-prompt", arguments={"arg1": "value"}
808
- )
809
-
810
- # List available resources
811
- resources = await session.list_resources()
812
-
813
- # List available tools
814
- tools = await session.list_tools()
815
-
816
- # Read a resource
817
- content, mime_type = await session.read_resource("file://some/path")
818
-
819
- # Call a tool
820
- result = await session.call_tool("tool-name", arguments={"arg1": "value"})
821
-
822
-
823
- if __name__ == "__main__":
824
- import asyncio
825
-
826
- asyncio.run(run())
827
- ```
828
-
829
- Clients can also connect using [Streamable HTTP transport](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#streamable-http):
830
-
831
- ```python
832
- from mcp.client.streamable_http import streamablehttp_client
833
- from mcp import ClientSession
834
-
835
-
836
- async def main():
837
- # Connect to a streamable HTTP server
838
- async with streamablehttp_client("example/mcp") as (
839
- read_stream,
840
- write_stream,
841
- _,
842
- ):
843
- # Create a session using the client streams
844
- async with ClientSession(read_stream, write_stream) as session:
845
- # Initialize the connection
846
- await session.initialize()
847
- # Call a tool
848
- tool_result = await session.call_tool("echo", {"message": "hello"})
849
- ```
850
-
851
- ### OAuth Authentication for Clients
852
-
853
- The SDK includes [authorization support](https://modelcontextprotocol.io/specification/2025-03-26/basic/authorization) for connecting to protected MCP servers:
854
-
855
- ```python
856
- from mcp.client.auth import OAuthClientProvider, TokenStorage
857
- from mcp.client.session import ClientSession
858
- from mcp.client.streamable_http import streamablehttp_client
859
- from mcp.shared.auth import OAuthClientInformationFull, OAuthClientMetadata, OAuthToken
860
-
861
-
862
- class CustomTokenStorage(TokenStorage):
863
- """Simple in-memory token storage implementation."""
864
-
865
- async def get_tokens(self) -> OAuthToken | None:
866
- pass
867
-
868
- async def set_tokens(self, tokens: OAuthToken) -> None:
869
- pass
870
-
871
- async def get_client_info(self) -> OAuthClientInformationFull | None:
872
- pass
873
-
874
- async def set_client_info(self, client_info: OAuthClientInformationFull) -> None:
875
- pass
876
-
877
-
878
- async def main():
879
- # Set up OAuth authentication
880
- oauth_auth = OAuthClientProvider(
881
- server_url="https://api.example.com",
882
- client_metadata=OAuthClientMetadata(
883
- client_name="My Client",
884
- redirect_uris=["http://localhost:3000/callback"],
885
- grant_types=["authorization_code", "refresh_token"],
886
- response_types=["code"],
887
- ),
888
- storage=CustomTokenStorage(),
889
- redirect_handler=lambda url: print(f"Visit: {url}"),
890
- callback_handler=lambda: ("auth_code", None),
891
- )
892
-
893
- # Use with streamable HTTP client
894
- async with streamablehttp_client(
895
- "https://api.example.com/mcp", auth=oauth_auth
896
- ) as (read, write, _):
897
- async with ClientSession(read, write) as session:
898
- await session.initialize()
899
- # Authenticated session ready
900
- ```
901
-
902
- For a complete working example, see [`examples/clients/simple-auth-client/`](examples/clients/simple-auth-client/).
903
-
904
-
905
- ### MCP Primitives
906
-
907
- The MCP protocol defines three core primitives that servers can implement:
908
-
909
- | Primitive | Control | Description | Example Use |
910
- |-----------|-----------------------|-----------------------------------------------------|------------------------------|
911
- | Prompts | User-controlled | Interactive templates invoked by user choice | Slash commands, menu options |
912
- | Resources | Application-controlled| Contextual data managed by the client application | File contents, API responses |
913
- | Tools | Model-controlled | Functions exposed to the LLM to take actions | API calls, data updates |
914
-
915
- ### Server Capabilities
916
-
917
- MCP servers declare capabilities during initialization:
918
-
919
- | Capability | Feature Flag | Description |
920
- |-------------|------------------------------|------------------------------------|
921
- | `prompts` | `listChanged` | Prompt template management |
922
- | `resources` | `subscribe`<br/>`listChanged`| Resource exposure and updates |
923
- | `tools` | `listChanged` | Tool discovery and execution |
924
- | `logging` | - | Server logging configuration |
925
- | `completion`| - | Argument completion suggestions |
926
-
927
- ## Documentation
928
-
929
- - [Model Context Protocol documentation](https://modelcontextprotocol.io)
930
- - [Model Context Protocol specification](https://spec.modelcontextprotocol.io)
931
- - [Officially supported servers](https://github.com/modelcontextprotocol/servers)
932
-
933
- ## Contributing
934
-
935
- We are passionate about supporting contributors of all levels of experience and would love to see you get involved in the project. See the [contributing guide](CONTRIBUTING.md) to get started.
936
-
937
- ## License
938
-
939
- This project is licensed under the MIT License - see the LICENSE file for details.