fast-agent-mcp 0.2.4__tar.gz → 0.2.5__tar.gz

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 (160) hide show
  1. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/.gitignore +6 -0
  2. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/PKG-INFO +2 -2
  3. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/README.md +1 -1
  4. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/pyproject.toml +1 -1
  5. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/agents/base_agent.py +13 -13
  6. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/cli/main.py +11 -0
  7. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/config.py +29 -7
  8. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/context.py +2 -0
  9. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/core/direct_factory.py +5 -14
  10. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/core/enhanced_prompt.py +3 -3
  11. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/core/fastagent.py +202 -46
  12. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/llm/augmented_llm.py +7 -9
  13. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/llm/augmented_llm_passthrough.py +3 -1
  14. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/llm/model_factory.py +5 -7
  15. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/mcp/prompt_serialization.py +42 -0
  16. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/mcp/prompts/prompt_load.py +51 -3
  17. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/mcp_server/agent_server.py +60 -11
  18. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/resources/examples/internal/agent.py +2 -2
  19. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/resources/examples/internal/fastagent.config.yaml +5 -0
  20. fast_agent_mcp-0.2.4/src/mcp_agent/mcp/mcp_agent_server.py +0 -56
  21. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/LICENSE +0 -0
  22. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/examples/data-analysis/analysis-campaign.py +0 -0
  23. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/examples/data-analysis/analysis.py +0 -0
  24. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/examples/data-analysis/fastagent.config.yaml +0 -0
  25. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/examples/data-analysis/mount-point/WA_Fn-UseC_-HR-Employee-Attrition.csv +0 -0
  26. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/examples/researcher/fastagent.config.yaml +0 -0
  27. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/examples/researcher/researcher-eval.py +0 -0
  28. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/examples/researcher/researcher-imp.py +0 -0
  29. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/examples/researcher/researcher.py +0 -0
  30. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/examples/workflows/chaining.py +0 -0
  31. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/examples/workflows/evaluator.py +0 -0
  32. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/examples/workflows/fastagent.config.yaml +0 -0
  33. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/examples/workflows/graded_report.md +0 -0
  34. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/examples/workflows/human_input.py +0 -0
  35. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/examples/workflows/orchestrator.py +0 -0
  36. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/examples/workflows/parallel.py +0 -0
  37. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/examples/workflows/router.py +0 -0
  38. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/examples/workflows/short_story.md +0 -0
  39. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/examples/workflows/short_story.txt +0 -0
  40. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/__init__.py +0 -0
  41. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/agents/__init__.py +0 -0
  42. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/agents/agent.py +0 -0
  43. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/agents/workflow/__init__.py +0 -0
  44. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/agents/workflow/chain_agent.py +0 -0
  45. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/agents/workflow/evaluator_optimizer.py +0 -0
  46. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/agents/workflow/orchestrator_agent.py +0 -0
  47. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/agents/workflow/orchestrator_models.py +0 -0
  48. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/agents/workflow/orchestrator_prompts.py +0 -0
  49. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/agents/workflow/parallel_agent.py +0 -0
  50. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/agents/workflow/router_agent.py +0 -0
  51. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/app.py +0 -0
  52. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/cli/__init__.py +0 -0
  53. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/cli/__main__.py +0 -0
  54. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/cli/commands/bootstrap.py +0 -0
  55. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/cli/commands/config.py +0 -0
  56. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/cli/commands/setup.py +0 -0
  57. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/cli/terminal.py +0 -0
  58. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/console.py +0 -0
  59. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/context_dependent.py +0 -0
  60. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/core/__init__.py +0 -0
  61. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/core/agent_app.py +0 -0
  62. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/core/agent_types.py +0 -0
  63. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/core/direct_decorators.py +0 -0
  64. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/core/error_handling.py +0 -0
  65. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/core/exceptions.py +0 -0
  66. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/core/interactive_prompt.py +0 -0
  67. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/core/mcp_content.py +0 -0
  68. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/core/prompt.py +0 -0
  69. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/core/request_params.py +0 -0
  70. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/core/validation.py +0 -0
  71. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/event_progress.py +0 -0
  72. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/executor/__init__.py +0 -0
  73. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/executor/decorator_registry.py +0 -0
  74. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/executor/executor.py +0 -0
  75. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/executor/task_registry.py +0 -0
  76. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/executor/temporal.py +0 -0
  77. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/executor/workflow.py +0 -0
  78. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/executor/workflow_signal.py +0 -0
  79. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/human_input/__init__.py +0 -0
  80. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/human_input/handler.py +0 -0
  81. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/human_input/types.py +0 -0
  82. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/llm/__init__.py +0 -0
  83. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/llm/augmented_llm_playback.py +0 -0
  84. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/llm/memory.py +0 -0
  85. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/llm/prompt_utils.py +0 -0
  86. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/llm/providers/__init__.py +0 -0
  87. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/llm/providers/anthropic_utils.py +0 -0
  88. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/llm/providers/augmented_llm_anthropic.py +0 -0
  89. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/llm/providers/augmented_llm_deepseek.py +0 -0
  90. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/llm/providers/augmented_llm_generic.py +0 -0
  91. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/llm/providers/augmented_llm_openai.py +0 -0
  92. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/llm/providers/multipart_converter_anthropic.py +0 -0
  93. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/llm/providers/multipart_converter_openai.py +0 -0
  94. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/llm/providers/openai_multipart.py +0 -0
  95. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/llm/providers/openai_utils.py +0 -0
  96. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/llm/providers/sampling_converter_anthropic.py +0 -0
  97. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/llm/providers/sampling_converter_openai.py +0 -0
  98. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/llm/sampling_converter.py +0 -0
  99. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/llm/sampling_format_converter.py +0 -0
  100. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/logging/__init__.py +0 -0
  101. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/logging/events.py +0 -0
  102. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/logging/json_serializer.py +0 -0
  103. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/logging/listeners.py +0 -0
  104. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/logging/logger.py +0 -0
  105. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/logging/rich_progress.py +0 -0
  106. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/logging/tracing.py +0 -0
  107. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/logging/transport.py +0 -0
  108. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/mcp/__init__.py +0 -0
  109. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/mcp/gen_client.py +0 -0
  110. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/mcp/helpers/__init__.py +0 -0
  111. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/mcp/helpers/content_helpers.py +0 -0
  112. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/mcp/interfaces.py +0 -0
  113. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/mcp/logger_textio.py +0 -0
  114. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/mcp/mcp_activity.py +0 -0
  115. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/mcp/mcp_agent_client_session.py +0 -0
  116. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/mcp/mcp_aggregator.py +0 -0
  117. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/mcp/mcp_connection_manager.py +0 -0
  118. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/mcp/mime_utils.py +0 -0
  119. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/mcp/prompt_message_multipart.py +0 -0
  120. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/mcp/prompt_render.py +0 -0
  121. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/mcp/prompts/__init__.py +0 -0
  122. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/mcp/prompts/__main__.py +0 -0
  123. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/mcp/prompts/prompt_constants.py +0 -0
  124. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/mcp/prompts/prompt_helpers.py +0 -0
  125. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/mcp/prompts/prompt_server.py +0 -0
  126. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/mcp/prompts/prompt_template.py +0 -0
  127. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/mcp/resource_utils.py +0 -0
  128. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/mcp/sampling.py +0 -0
  129. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/mcp_server/__init__.py +0 -0
  130. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/mcp_server_registry.py +0 -0
  131. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/progress_display.py +0 -0
  132. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/resources/examples/data-analysis/analysis-campaign.py +0 -0
  133. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/resources/examples/data-analysis/analysis.py +0 -0
  134. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/resources/examples/data-analysis/fastagent.config.yaml +0 -0
  135. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/resources/examples/data-analysis/mount-point/WA_Fn-UseC_-HR-Employee-Attrition.csv +0 -0
  136. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/resources/examples/in_dev/agent_build.py +0 -0
  137. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/resources/examples/in_dev/slides.py +0 -0
  138. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/resources/examples/internal/history_transfer.py +0 -0
  139. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/resources/examples/internal/job.py +0 -0
  140. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/resources/examples/internal/prompt_category.py +0 -0
  141. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/resources/examples/internal/prompt_sizing.py +0 -0
  142. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/resources/examples/internal/sizer.py +0 -0
  143. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/resources/examples/internal/social.py +0 -0
  144. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/resources/examples/prompting/__init__.py +0 -0
  145. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/resources/examples/prompting/agent.py +0 -0
  146. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/resources/examples/prompting/fastagent.config.yaml +0 -0
  147. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/resources/examples/prompting/image_server.py +0 -0
  148. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/resources/examples/prompting/work_with_image.py +0 -0
  149. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/resources/examples/researcher/fastagent.config.yaml +0 -0
  150. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/resources/examples/researcher/researcher-eval.py +0 -0
  151. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/resources/examples/researcher/researcher-imp.py +0 -0
  152. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/resources/examples/researcher/researcher.py +0 -0
  153. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/resources/examples/workflows/chaining.py +0 -0
  154. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/resources/examples/workflows/evaluator.py +0 -0
  155. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/resources/examples/workflows/fastagent.config.yaml +0 -0
  156. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/resources/examples/workflows/human_input.py +0 -0
  157. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/resources/examples/workflows/orchestrator.py +0 -0
  158. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/resources/examples/workflows/parallel.py +0 -0
  159. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/resources/examples/workflows/router.py +0 -0
  160. {fast_agent_mcp-0.2.4 → fast_agent_mcp-0.2.5}/src/mcp_agent/ui/console_display.py +0 -0
@@ -184,3 +184,9 @@ example-outputs/
184
184
 
185
185
  tests/integration/prompt-state/simple.txt
186
186
  tests/integration/workflow/router/fastagent.jsonl
187
+ tests/e2e/smoke/weather_location.txt
188
+ tests/integration/resources/fastagent.jsonl
189
+ tests/integration/workflow/orchestrator/fastagent.jsonl
190
+ fastagent.jsonl
191
+ tests/integration/resources/fastagent.jsonl
192
+ fastagent.jsonl
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fast-agent-mcp
3
- Version: 0.2.4
3
+ Version: 0.2.5
4
4
  Summary: Define, Prompt and Test MCP enabled Agents and Workflows
5
5
  Author-email: Shaun Smith <fastagent@llmindset.co.uk>, Sarmad Qadri <sarmad@lastmileai.dev>
6
6
  License: Apache License
@@ -244,7 +244,7 @@ Description-Content-Type: text/markdown
244
244
  <a href="https://pypi.org/project/fast-agent-mcp/"><img src="https://img.shields.io/pypi/v/fast-agent-mcp?color=%2334D058&label=pypi" /></a>
245
245
  <a href="#"><img src="https://github.com/evalstate/fast-agent/actions/workflows/main-checks.yml/badge.svg" /></a>
246
246
  <a href="https://github.com/evalstate/fast-agent/issues"><img src="https://img.shields.io/github/issues-raw/evalstate/fast-agent" /></a>
247
- <a href="https://lmai.link/discord/mcp-agent"><img src="https://shields.io/discord/1089284610329952357" alt="discord" /></a>
247
+ <a href="https://discord.gg/xg5cJ7ndN6"><img src="https://img.shields.io/discord/1358470293990936787" alt="discord" /></a>
248
248
  <img alt="Pepy Total Downloads" src="https://img.shields.io/pepy/dt/fast-agent-mcp?label=pypi%20%7C%20downloads"/>
249
249
  <a href="https://github.com/evalstate/fast-agent-mcp/blob/main/LICENSE"><img src="https://img.shields.io/pypi/l/fast-agent-mcp" /></a>
250
250
  </p>
@@ -2,7 +2,7 @@
2
2
  <a href="https://pypi.org/project/fast-agent-mcp/"><img src="https://img.shields.io/pypi/v/fast-agent-mcp?color=%2334D058&label=pypi" /></a>
3
3
  <a href="#"><img src="https://github.com/evalstate/fast-agent/actions/workflows/main-checks.yml/badge.svg" /></a>
4
4
  <a href="https://github.com/evalstate/fast-agent/issues"><img src="https://img.shields.io/github/issues-raw/evalstate/fast-agent" /></a>
5
- <a href="https://lmai.link/discord/mcp-agent"><img src="https://shields.io/discord/1089284610329952357" alt="discord" /></a>
5
+ <a href="https://discord.gg/xg5cJ7ndN6"><img src="https://img.shields.io/discord/1358470293990936787" alt="discord" /></a>
6
6
  <img alt="Pepy Total Downloads" src="https://img.shields.io/pepy/dt/fast-agent-mcp?label=pypi%20%7C%20downloads"/>
7
7
  <a href="https://github.com/evalstate/fast-agent-mcp/blob/main/LICENSE"><img src="https://img.shields.io/pypi/l/fast-agent-mcp" /></a>
8
8
  </p>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "fast-agent-mcp"
3
- version = "0.2.4"
3
+ version = "0.2.5"
4
4
  description = "Define, Prompt and Test MCP enabled Agents and Workflows"
5
5
  readme = "README.md"
6
6
  license = { file = "LICENSE" }
@@ -120,28 +120,30 @@ class BaseAgent(MCPAggregator, AgentProtocol):
120
120
  llm_factory: Union[Type[AugmentedLLMProtocol], Callable[..., AugmentedLLMProtocol]],
121
121
  model: Optional[str] = None,
122
122
  request_params: Optional[RequestParams] = None,
123
- **additional_kwargs
123
+ **additional_kwargs,
124
124
  ) -> AugmentedLLMProtocol:
125
125
  """
126
126
  Create and attach an LLM instance to this agent.
127
-
127
+
128
128
  Parameters have the following precedence (highest to lowest):
129
129
  1. Explicitly passed parameters to this method
130
130
  2. Agent's default_request_params
131
131
  3. LLM's default values
132
-
132
+
133
133
  Args:
134
134
  llm_factory: A class or callable that constructs an AugmentedLLM
135
135
  model: Optional model name override
136
136
  request_params: Optional request parameters override
137
137
  **additional_kwargs: Additional parameters passed to the LLM constructor
138
-
138
+
139
139
  Returns:
140
140
  The created LLM instance
141
141
  """
142
142
  # Start with agent's default params
143
- effective_params = self._default_request_params.model_copy() if self._default_request_params else None
144
-
143
+ effective_params = (
144
+ self._default_request_params.model_copy() if self._default_request_params else None
145
+ )
146
+
145
147
  # Override with explicitly passed request_params
146
148
  if request_params:
147
149
  if effective_params:
@@ -151,18 +153,16 @@ class BaseAgent(MCPAggregator, AgentProtocol):
151
153
  setattr(effective_params, k, v)
152
154
  else:
153
155
  effective_params = request_params
154
-
156
+
155
157
  # Override model if explicitly specified
156
158
  if model and effective_params:
157
159
  effective_params.model = model
158
-
160
+
159
161
  # Create the LLM instance
160
162
  self._llm = llm_factory(
161
- agent=self,
162
- request_params=effective_params,
163
- **additional_kwargs
163
+ agent=self, request_params=effective_params, context=self._context, **additional_kwargs
164
164
  )
165
-
165
+
166
166
  return self._llm
167
167
 
168
168
  async def shutdown(self) -> None:
@@ -468,7 +468,7 @@ class BaseAgent(MCPAggregator, AgentProtocol):
468
468
 
469
469
  # Get the prompt - this will search all servers if needed
470
470
  self.logger.debug(f"Loading prompt '{prompt_name}'")
471
- prompt_result = await self.get_prompt(prompt_name, arguments, server_name)
471
+ prompt_result: GetPromptResult = await self.get_prompt(prompt_name, arguments, server_name)
472
472
 
473
473
  if not prompt_result or not prompt_result.messages:
474
474
  error_msg = f"Prompt '{prompt_name}' could not be found or contains no messages"
@@ -62,6 +62,7 @@ def main(
62
62
  verbose: bool = typer.Option(False, "--verbose", "-v", help="Enable verbose mode"),
63
63
  quiet: bool = typer.Option(False, "--quiet", "-q", help="Disable output"),
64
64
  color: bool = typer.Option(True, "--color/--no-color", help="Enable/disable color output"),
65
+ version: bool = typer.Option(False, "--version", help="Show version and exit"),
65
66
  ) -> None:
66
67
  """FastAgent CLI - Build effective agents using Model Context Protocol (MCP).
67
68
 
@@ -70,6 +71,16 @@ def main(
70
71
  application.verbosity = 1 if verbose else 0 if not quiet else -1
71
72
  application.console = application.console if color else None
72
73
 
74
+ # Handle version flag
75
+ if version:
76
+ from importlib.metadata import version as get_version
77
+ try:
78
+ app_version = get_version("fast-agent-mcp")
79
+ except: # noqa: E722
80
+ app_version = "unknown"
81
+ console.print(f"fast-agent-mcp v{app_version}")
82
+ raise typer.Exit()
83
+
73
84
  # Show welcome message if no command was invoked
74
85
  if ctx.invoked_subcommand is None:
75
86
  show_welcome()
@@ -40,7 +40,7 @@ class MCPRootSettings(BaseModel):
40
40
  @classmethod
41
41
  def validate_uri(cls, v: str) -> str:
42
42
  """Validate that the URI starts with file:// (required by specification 2024-11-05)"""
43
- if not v.startswith("file://"):
43
+ if v and not v.startswith("file://"):
44
44
  raise ValueError("Root URI must start with file://")
45
45
  return v
46
46
 
@@ -276,9 +276,9 @@ class Settings(BaseSettings):
276
276
  # Check current directory and parent directories
277
277
  while current_dir != current_dir.parent:
278
278
  for filename in [
279
+ "fastagent.config.yaml",
279
280
  "mcp-agent.config.yaml",
280
281
  "mcp_agent.config.yaml",
281
- "fastagent.config.yaml",
282
282
  ]:
283
283
  config_path = current_dir / filename
284
284
  if config_path.exists():
@@ -306,15 +306,33 @@ def get_settings(config_path: str | None = None) -> Settings:
306
306
  return merged
307
307
 
308
308
  global _settings
309
- if _settings:
309
+
310
+ # If we have a specific config path, always reload settings
311
+ # This ensures each test gets its own config
312
+ if config_path:
313
+ # Reset for the new path
314
+ _settings = None
315
+ elif _settings:
316
+ # Use cached settings only for no specific path
310
317
  return _settings
311
318
 
312
- config_file = Path(config_path) if config_path else Settings.find_config()
319
+ # Handle config path - convert string to Path if needed
320
+ if config_path:
321
+ config_file = Path(config_path)
322
+ # If it's a relative path and doesn't exist, try finding it
323
+ if not config_file.is_absolute() and not config_file.exists():
324
+ # Try resolving against current directory first
325
+ resolved_path = Path.cwd() / config_file.name
326
+ if resolved_path.exists():
327
+ config_file = resolved_path
328
+ else:
329
+ config_file = Settings.find_config()
330
+
313
331
  merged_settings = {}
314
332
 
315
333
  if config_file:
316
334
  if not config_file.exists():
317
- pass
335
+ print(f"Warning: Specified config file does not exist: {config_file}")
318
336
  else:
319
337
  import yaml # pylint: disable=C0415
320
338
 
@@ -326,11 +344,14 @@ def get_settings(config_path: str | None = None) -> Settings:
326
344
  # but stop after finding the first one
327
345
  current_dir = config_file.parent
328
346
  found_secrets = False
347
+ # Start with the absolute path of the config file's directory
348
+ current_dir = config_file.parent.resolve()
349
+
329
350
  while current_dir != current_dir.parent and not found_secrets:
330
351
  for secrets_filename in [
352
+ "fastagent.secrets.yaml",
331
353
  "mcp-agent.secrets.yaml",
332
354
  "mcp_agent.secrets.yaml",
333
- "fastagent.secrets.yaml",
334
355
  ]:
335
356
  secrets_file = current_dir / secrets_filename
336
357
  if secrets_file.exists():
@@ -340,7 +361,8 @@ def get_settings(config_path: str | None = None) -> Settings:
340
361
  found_secrets = True
341
362
  break
342
363
  if not found_secrets:
343
- current_dir = current_dir.parent
364
+ # Get the absolute path of the parent directory
365
+ current_dir = current_dir.parent.resolve()
344
366
 
345
367
  _settings = Settings(**merged_settings)
346
368
  return _settings
@@ -234,5 +234,7 @@ def get_current_context() -> Context:
234
234
  def get_current_config():
235
235
  """
236
236
  Get the current application config.
237
+
238
+ Returns the context config if available, otherwise falls back to global settings.
237
239
  """
238
240
  return get_current_context().config or get_settings()
@@ -148,10 +148,7 @@ async def create_agents_by_type(
148
148
 
149
149
  # Attach LLM to the agent
150
150
  llm_factory = model_factory_func(model=config.model)
151
- await agent.attach_llm(
152
- llm_factory,
153
- request_params=config.default_request_params
154
- )
151
+ await agent.attach_llm(llm_factory, request_params=config.default_request_params)
155
152
  result_agents[name] = agent
156
153
 
157
154
  elif agent_type == AgentType.ORCHESTRATOR:
@@ -185,8 +182,7 @@ async def create_agents_by_type(
185
182
  # Attach LLM to the orchestrator
186
183
  llm_factory = model_factory_func(model=config.model)
187
184
  await orchestrator.attach_llm(
188
- llm_factory,
189
- request_params=config.default_request_params
185
+ llm_factory, request_params=config.default_request_params
190
186
  )
191
187
 
192
188
  result_agents[name] = orchestrator
@@ -201,9 +197,7 @@ async def create_agents_by_type(
201
197
  # Create default fan-in agent with auto-generated name
202
198
  fan_in_name = f"{name}_fan_in"
203
199
  fan_in_agent = await _create_default_fan_in_agent(
204
- fan_in_name,
205
- app_instance.context,
206
- model_factory_func
200
+ fan_in_name, app_instance.context, model_factory_func
207
201
  )
208
202
  # Add to result_agents so it's registered properly
209
203
  result_agents[fan_in_name] = fan_in_agent
@@ -248,10 +242,7 @@ async def create_agents_by_type(
248
242
 
249
243
  # Attach LLM to the router
250
244
  llm_factory = model_factory_func(model=config.model)
251
- await router.attach_llm(
252
- llm_factory,
253
- request_params=config.default_request_params
254
- )
245
+ await router.attach_llm(llm_factory, request_params=config.default_request_params)
255
246
  result_agents[name] = router
256
247
 
257
248
  elif agent_type == AgentType.CHAIN:
@@ -459,7 +450,7 @@ async def _create_default_fan_in_agent(
459
450
  default_config = AgentConfig(
460
451
  name=fan_in_name,
461
452
  model="passthrough",
462
- instruction="You are a passthrough agent that combines outputs from parallel agents."
453
+ instruction="You are a passthrough agent that combines outputs from parallel agents.",
463
454
  )
464
455
 
465
456
  # Create and initialize the default agent
@@ -291,7 +291,7 @@ async def get_enhanced_input(
291
291
  return f"SELECT_PROMPT:{cmd_parts[1].strip()}"
292
292
  elif cmd == "exit":
293
293
  return "EXIT"
294
- elif cmd == "stop":
294
+ elif cmd.lower() == "stop":
295
295
  return "STOP"
296
296
 
297
297
  # Agent switching
@@ -420,7 +420,7 @@ async def get_argument_input(
420
420
  prompt_session.app.exit()
421
421
 
422
422
 
423
- async def handle_special_commands(command, agent_app=None):
423
+ async def handle_special_commands(command: str, agent_app=None):
424
424
  """Handle special input commands."""
425
425
  # Quick guard for empty or None commands
426
426
  if not command:
@@ -450,7 +450,7 @@ async def handle_special_commands(command, agent_app=None):
450
450
  print("\033c", end="")
451
451
  return True
452
452
 
453
- elif command == "EXIT":
453
+ elif command.upper() == "EXIT":
454
454
  raise PromptExitError("User requested to exit fast-agent session")
455
455
 
456
456
  elif command == "LIST_AGENTS":
@@ -6,14 +6,15 @@ directly creates Agent instances without proxies.
6
6
 
7
7
  import argparse
8
8
  import asyncio
9
- import os
9
+ import sys
10
10
  from contextlib import asynccontextmanager
11
+ from importlib.metadata import version as get_version
11
12
  from typing import TYPE_CHECKING, Any, Callable, Dict, Optional, TypeVar
12
13
 
13
14
  import yaml
14
15
 
16
+ from mcp_agent import config
15
17
  from mcp_agent.app import MCPApp
16
- from mcp_agent.config import Settings
17
18
  from mcp_agent.context import Context
18
19
  from mcp_agent.core.agent_app import AgentApp
19
20
  from mcp_agent.core.direct_decorators import (
@@ -70,7 +71,7 @@ class FastAgent:
70
71
  def __init__(
71
72
  self,
72
73
  name: str,
73
- config_path: Optional[str] = None,
74
+ config_path: str | None = None,
74
75
  ignore_unknown_args: bool = False,
75
76
  ) -> None:
76
77
  """
@@ -101,6 +102,33 @@ class FastAgent:
101
102
  action="store_true",
102
103
  help="Disable progress display, tool and message logging for cleaner output",
103
104
  )
105
+ parser.add_argument(
106
+ "--version",
107
+ action="store_true",
108
+ help="Show version and exit",
109
+ )
110
+ parser.add_argument(
111
+ "--server",
112
+ action="store_true",
113
+ help="Run as an MCP server",
114
+ )
115
+ parser.add_argument(
116
+ "--transport",
117
+ choices=["sse", "stdio"],
118
+ default="sse",
119
+ help="Transport protocol to use when running as a server (sse or stdio)",
120
+ )
121
+ parser.add_argument(
122
+ "--port",
123
+ type=int,
124
+ default=8000,
125
+ help="Port to use when running as a server with SSE transport",
126
+ )
127
+ parser.add_argument(
128
+ "--host",
129
+ default="0.0.0.0",
130
+ help="Host address to bind to when running as a server with SSE transport",
131
+ )
104
132
 
105
133
  if ignore_unknown_args:
106
134
  known_args, _ = parser.parse_known_args()
@@ -108,10 +136,28 @@ class FastAgent:
108
136
  else:
109
137
  self.args = parser.parse_args()
110
138
 
139
+ # Handle version flag
140
+ if self.args.version:
141
+ try:
142
+ app_version = get_version("fast-agent-mcp")
143
+ except: # noqa: E722
144
+ app_version = "unknown"
145
+ print(f"fast-agent-mcp v{app_version}")
146
+ sys.exit(0)
147
+
111
148
  self.name = name
112
149
  self.config_path = config_path
150
+
113
151
  try:
152
+ # Load configuration directly for this instance
114
153
  self._load_config()
154
+
155
+ # Create the app with our local settings
156
+ self.app = MCPApp(
157
+ name=name,
158
+ settings=config.Settings(**self.config) if hasattr(self, "config") else None,
159
+ )
160
+
115
161
  except yaml.parser.ParserError as e:
116
162
  handle_error(
117
163
  e,
@@ -119,25 +165,30 @@ class FastAgent:
119
165
  "There was an error parsing the config or secrets YAML configuration file.",
120
166
  )
121
167
  raise SystemExit(1)
122
- # Create the MCPApp with the config
123
- self.app = MCPApp(
124
- name=name,
125
- settings=Settings(**self.config) if hasattr(self, "config") else None,
126
- )
127
168
 
128
169
  # Dictionary to store agent configurations from decorators
129
170
  self.agents: Dict[str, Dict[str, Any]] = {}
130
171
 
131
172
  def _load_config(self) -> None:
132
- """Load configuration from YAML file"""
133
- if self.config_path:
134
- with open(self.config_path) as f:
135
- self.config = yaml.safe_load(f) or {}
136
- elif os.path.exists("fastagent.config.yaml"):
137
- with open("fastagent.config.yaml") as f:
138
- self.config = yaml.safe_load(f) or {}
139
- else:
140
- self.config = {}
173
+ """Load configuration from YAML file including secrets using get_settings
174
+ but without relying on the global cache."""
175
+
176
+ # Import but make a local copy to avoid affecting the global state
177
+ from mcp_agent.config import _settings, get_settings
178
+
179
+ # Temporarily clear the global settings to ensure a fresh load
180
+ old_settings = _settings
181
+ _settings = None
182
+
183
+ try:
184
+ # Use get_settings to load config - this handles all paths and secrets merging
185
+ settings = get_settings(self.config_path)
186
+
187
+ # Convert to dict for backward compatibility
188
+ self.config = settings.model_dump() if settings else {}
189
+ finally:
190
+ # Restore the original global settings
191
+ _settings = old_settings
141
192
 
142
193
  @property
143
194
  def context(self) -> Context:
@@ -166,16 +217,17 @@ class FastAgent:
166
217
  quiet_mode = hasattr(self, "args") and self.args.quiet
167
218
 
168
219
  try:
169
- async with self.app.run() as agent_app:
220
+ async with self.app.run():
170
221
  # Apply quiet mode if requested
171
222
  if (
172
223
  quiet_mode
173
- and hasattr(agent_app.context, "config")
174
- and hasattr(agent_app.context.config, "logger")
224
+ and hasattr(self.app.context, "config")
225
+ and hasattr(self.app.context.config, "logger")
175
226
  ):
176
- agent_app.context.config.logger.progress_display = False
177
- agent_app.context.config.logger.show_chat = False
178
- agent_app.context.config.logger.show_tools = False
227
+ # Update our app's config directly
228
+ self.app.context.config.logger.progress_display = False
229
+ self.app.context.config.logger.show_chat = False
230
+ self.app.context.config.logger.show_tools = False
179
231
 
180
232
  # Directly disable the progress display singleton
181
233
  from mcp_agent.progress_display import progress_display
@@ -205,6 +257,41 @@ class FastAgent:
205
257
  # Create a wrapper with all agents for simplified access
206
258
  wrapper = AgentApp(active_agents)
207
259
 
260
+ # Handle command line options that should be processed after agent initialization
261
+
262
+ # Handle --server option
263
+ if hasattr(self, "args") and self.args.server:
264
+ try:
265
+ # Print info message if not in quiet mode
266
+ if not quiet_mode:
267
+ print(f"Starting FastAgent '{self.name}' in server mode")
268
+ print(f"Transport: {self.args.transport}")
269
+ if self.args.transport == "sse":
270
+ print(f"Listening on {self.args.host}:{self.args.port}")
271
+ print("Press Ctrl+C to stop")
272
+
273
+ # Create the MCP server
274
+ from mcp_agent.mcp_server import AgentMCPServer
275
+
276
+ mcp_server = AgentMCPServer(
277
+ agent_app=wrapper,
278
+ server_name=f"{self.name}-MCP-Server",
279
+ )
280
+
281
+ # Run the server directly (this is a blocking call)
282
+ await mcp_server.run_async(
283
+ transport=self.args.transport, host=self.args.host, port=self.args.port
284
+ )
285
+ except KeyboardInterrupt:
286
+ if not quiet_mode:
287
+ print("\nServer stopped by user (Ctrl+C)")
288
+ except Exception as e:
289
+ if not quiet_mode:
290
+ print(f"\nServer stopped with error: {e}")
291
+
292
+ # Exit after server shutdown
293
+ raise SystemExit(0)
294
+
208
295
  # Handle direct message sending if --agent and --message are provided
209
296
  if hasattr(self, "args") and self.args.agent and self.args.message:
210
297
  agent_name = self.args.agent
@@ -222,7 +309,8 @@ class FastAgent:
222
309
  agent = active_agents[agent_name]
223
310
  response = await agent.send(message)
224
311
 
225
- # Print the response in quiet mode
312
+ # In quiet mode, just print the raw response
313
+ # The chat display should already be turned off by the configuration
226
314
  if self.args.quiet:
227
315
  print(f"{response}")
228
316
 
@@ -313,6 +401,58 @@ class FastAgent:
313
401
  else:
314
402
  handle_error(e, error_type or "Error", "An unexpected error occurred.")
315
403
 
404
+ async def start_server(
405
+ self,
406
+ transport: str = "sse",
407
+ host: str = "0.0.0.0",
408
+ port: int = 8000,
409
+ server_name: Optional[str] = None,
410
+ server_description: Optional[str] = None,
411
+ ) -> None:
412
+ """
413
+ Start the application as an MCP server.
414
+ This method initializes agents and exposes them through an MCP server.
415
+ It is a blocking method that runs until the server is stopped.
416
+
417
+ Args:
418
+ transport: Transport protocol to use ("stdio" or "sse")
419
+ host: Host address for the server when using SSE
420
+ port: Port for the server when using SSE
421
+ server_name: Optional custom name for the MCP server
422
+ server_description: Optional description for the MCP server
423
+ """
424
+ # This method simply updates the command line arguments and uses run()
425
+ # to ensure we follow the same initialization path for all operations
426
+
427
+ # Store original args
428
+ original_args = None
429
+ if hasattr(self, "args"):
430
+ original_args = self.args
431
+
432
+ # Create our own args object with server settings
433
+ from argparse import Namespace
434
+
435
+ self.args = Namespace()
436
+ self.args.server = True
437
+ self.args.transport = transport
438
+ self.args.host = host
439
+ self.args.port = port
440
+ self.args.quiet = (
441
+ original_args.quiet if original_args and hasattr(original_args, "quiet") else False
442
+ )
443
+ self.args.model = None
444
+ if hasattr(original_args, "model"):
445
+ self.args.model = original_args.model
446
+
447
+ # Run the application, which will detect the server flag and start server mode
448
+ async with self.run():
449
+ pass # This won't be reached due to SystemExit in run()
450
+
451
+ # Restore original args (if we get here)
452
+ if original_args:
453
+ self.args = original_args
454
+
455
+ # Keep run_with_mcp_server for backward compatibility
316
456
  async def run_with_mcp_server(
317
457
  self,
318
458
  transport: str = "sse",
@@ -323,6 +463,8 @@ class FastAgent:
323
463
  ) -> None:
324
464
  """
325
465
  Run the application and expose agents through an MCP server.
466
+ This method is kept for backward compatibility.
467
+ For new code, use start_server() instead.
326
468
 
327
469
  Args:
328
470
  transport: Transport protocol to use ("stdio" or "sse")
@@ -331,26 +473,40 @@ class FastAgent:
331
473
  server_name: Optional custom name for the MCP server
332
474
  server_description: Optional description for the MCP server
333
475
  """
334
- from mcp_agent.mcp_server import AgentMCPServer
335
-
336
- async with self.run() as agent_app:
337
- # Create the MCP server
338
- mcp_server = AgentMCPServer(
339
- agent_app=agent_app,
340
- server_name=server_name or f"{self.name}-MCP-Server",
341
- server_description=server_description,
342
- )
343
-
344
- # Run the MCP server in a separate task
345
- server_task = asyncio.create_task(
346
- mcp_server.run_async(transport=transport, host=host, port=port)
347
- )
476
+ await self.start_server(
477
+ transport=transport,
478
+ host=host,
479
+ port=port,
480
+ server_name=server_name,
481
+ server_description=server_description,
482
+ )
348
483
 
349
- try:
350
- # Wait for the server task to complete (or be cancelled)
351
- await server_task
352
- except asyncio.CancelledError:
353
- # Propagate cancellation
354
- server_task.cancel()
355
- await asyncio.gather(server_task, return_exceptions=True)
356
- raise
484
+ async def main(self):
485
+ """
486
+ Helper method for checking if server mode was requested.
487
+
488
+ Usage:
489
+ ```python
490
+ fast = FastAgent("My App")
491
+
492
+ @fast.agent(...)
493
+ async def app_main():
494
+ # Check if server mode was requested
495
+ # This doesn't actually do anything - the check happens in run()
496
+ # But it provides a way for application code to know if server mode
497
+ # was requested for conditionals
498
+ is_server_mode = hasattr(self, "args") and self.args.server
499
+
500
+ # Normal run - this will handle server mode automatically if requested
501
+ async with fast.run() as agent:
502
+ # This code only executes for normal mode
503
+ # Server mode will exit before reaching here
504
+ await agent.send("Hello")
505
+ ```
506
+
507
+ Returns:
508
+ bool: True if --server flag is set, False otherwise
509
+ """
510
+ # Just check if the flag is set, no action here
511
+ # The actual server code will be handled by run()
512
+ return hasattr(self, "args") and self.args.server