fast-agent-mcp 0.2.12__tar.gz → 0.2.13__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.
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/PKG-INFO +1 -1
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/pyproject.toml +1 -1
- fast_agent_mcp-0.2.13/src/mcp_agent/mcp_server/agent_server.py +391 -0
- fast_agent_mcp-0.2.12/src/mcp_agent/mcp_server/agent_server.py +0 -152
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/.gitignore +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/LICENSE +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/README.md +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/examples/data-analysis/analysis-campaign.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/examples/data-analysis/analysis.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/examples/data-analysis/fastagent.config.yaml +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/examples/data-analysis/mount-point/WA_Fn-UseC_-HR-Employee-Attrition.csv +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/examples/mcp/state-transfer/agent_one.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/examples/mcp/state-transfer/agent_two.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/examples/mcp/state-transfer/fastagent.config.yaml +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/examples/researcher/fastagent.config.yaml +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/examples/researcher/researcher-eval.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/examples/researcher/researcher-imp.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/examples/researcher/researcher.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/examples/workflows/chaining.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/examples/workflows/evaluator.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/examples/workflows/fastagent.config.yaml +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/examples/workflows/graded_report.md +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/examples/workflows/human_input.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/examples/workflows/orchestrator.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/examples/workflows/parallel.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/examples/workflows/router.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/examples/workflows/short_story.md +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/examples/workflows/short_story.txt +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/__init__.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/agents/__init__.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/agents/agent.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/agents/base_agent.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/agents/workflow/__init__.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/agents/workflow/chain_agent.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/agents/workflow/evaluator_optimizer.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/agents/workflow/orchestrator_agent.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/agents/workflow/orchestrator_models.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/agents/workflow/orchestrator_prompts.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/agents/workflow/parallel_agent.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/agents/workflow/router_agent.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/app.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/cli/__init__.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/cli/__main__.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/cli/commands/config.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/cli/commands/quickstart.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/cli/commands/setup.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/cli/main.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/cli/terminal.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/config.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/console.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/context.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/context_dependent.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/core/__init__.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/core/agent_app.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/core/agent_types.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/core/direct_decorators.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/core/direct_factory.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/core/enhanced_prompt.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/core/error_handling.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/core/exceptions.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/core/fastagent.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/core/interactive_prompt.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/core/mcp_content.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/core/prompt.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/core/request_params.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/core/validation.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/event_progress.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/executor/__init__.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/executor/decorator_registry.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/executor/executor.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/executor/task_registry.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/executor/temporal.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/executor/workflow.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/executor/workflow_signal.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/human_input/__init__.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/human_input/handler.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/human_input/types.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/llm/__init__.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/llm/augmented_llm.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/llm/augmented_llm_passthrough.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/llm/augmented_llm_playback.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/llm/memory.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/llm/model_factory.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/llm/prompt_utils.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/llm/providers/__init__.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/llm/providers/anthropic_utils.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/llm/providers/augmented_llm_anthropic.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/llm/providers/augmented_llm_deepseek.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/llm/providers/augmented_llm_generic.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/llm/providers/augmented_llm_openai.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/llm/providers/augmented_llm_openrouter.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/llm/providers/multipart_converter_anthropic.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/llm/providers/multipart_converter_openai.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/llm/providers/openai_multipart.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/llm/providers/openai_utils.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/llm/providers/sampling_converter_anthropic.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/llm/providers/sampling_converter_openai.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/llm/sampling_converter.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/llm/sampling_format_converter.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/logging/__init__.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/logging/events.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/logging/json_serializer.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/logging/listeners.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/logging/logger.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/logging/rich_progress.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/logging/tracing.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/logging/transport.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/mcp/__init__.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/mcp/gen_client.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/mcp/helpers/__init__.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/mcp/helpers/content_helpers.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/mcp/interfaces.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/mcp/logger_textio.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/mcp/mcp_agent_client_session.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/mcp/mcp_aggregator.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/mcp/mcp_connection_manager.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/mcp/mime_utils.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/mcp/prompt_message_multipart.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/mcp/prompt_render.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/mcp/prompt_serialization.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/mcp/prompts/__init__.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/mcp/prompts/__main__.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/mcp/prompts/prompt_constants.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/mcp/prompts/prompt_helpers.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/mcp/prompts/prompt_load.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/mcp/prompts/prompt_server.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/mcp/prompts/prompt_template.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/mcp/resource_utils.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/mcp/sampling.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/mcp_server/__init__.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/mcp_server_registry.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/progress_display.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/resources/examples/data-analysis/analysis-campaign.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/resources/examples/data-analysis/analysis.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/resources/examples/data-analysis/fastagent.config.yaml +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/resources/examples/data-analysis/mount-point/WA_Fn-UseC_-HR-Employee-Attrition.csv +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/resources/examples/in_dev/agent_build.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/resources/examples/in_dev/css-LICENSE.txt +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/resources/examples/in_dev/slides.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/resources/examples/internal/agent.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/resources/examples/internal/fastagent.config.yaml +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/resources/examples/internal/history_transfer.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/resources/examples/internal/job.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/resources/examples/internal/prompt_category.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/resources/examples/internal/prompt_sizing.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/resources/examples/internal/simple.txt +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/resources/examples/internal/sizer.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/resources/examples/internal/social.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/resources/examples/mcp/state-transfer/agent_one.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/resources/examples/mcp/state-transfer/agent_two.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/resources/examples/mcp/state-transfer/fastagent.config.yaml +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/resources/examples/mcp/state-transfer/fastagent.secrets.yaml.example +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/resources/examples/prompting/__init__.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/resources/examples/prompting/agent.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/resources/examples/prompting/delimited_prompt.txt +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/resources/examples/prompting/fastagent.config.yaml +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/resources/examples/prompting/image_server.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/resources/examples/prompting/prompt1.txt +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/resources/examples/prompting/work_with_image.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/resources/examples/researcher/fastagent.config.yaml +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/resources/examples/researcher/researcher-eval.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/resources/examples/researcher/researcher-imp.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/resources/examples/researcher/researcher.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/resources/examples/workflows/chaining.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/resources/examples/workflows/evaluator.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/resources/examples/workflows/fastagent.config.yaml +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/resources/examples/workflows/human_input.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/resources/examples/workflows/orchestrator.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/resources/examples/workflows/parallel.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/resources/examples/workflows/router.py +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/resources/examples/workflows/short_story.txt +0 -0
- {fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/ui/console_display.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: fast-agent-mcp
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.13
|
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
|
@@ -0,0 +1,391 @@
|
|
1
|
+
"""
|
2
|
+
Enhanced AgentMCPServer with robust shutdown handling for SSE transport.
|
3
|
+
"""
|
4
|
+
|
5
|
+
import asyncio
|
6
|
+
import os
|
7
|
+
import signal
|
8
|
+
from contextlib import AsyncExitStack, asynccontextmanager
|
9
|
+
from typing import Set
|
10
|
+
|
11
|
+
from mcp.server.fastmcp import Context as MCPContext
|
12
|
+
from mcp.server.fastmcp import FastMCP
|
13
|
+
|
14
|
+
import mcp_agent
|
15
|
+
import mcp_agent.core
|
16
|
+
import mcp_agent.core.prompt
|
17
|
+
from mcp_agent.core.agent_app import AgentApp
|
18
|
+
from mcp_agent.logging.logger import get_logger
|
19
|
+
|
20
|
+
logger = get_logger(__name__)
|
21
|
+
|
22
|
+
|
23
|
+
class AgentMCPServer:
|
24
|
+
"""Exposes FastAgent agents as MCP tools through an MCP server."""
|
25
|
+
|
26
|
+
def __init__(
|
27
|
+
self,
|
28
|
+
agent_app: AgentApp,
|
29
|
+
server_name: str = "FastAgent-MCP-Server",
|
30
|
+
server_description: str | None = None,
|
31
|
+
) -> None:
|
32
|
+
"""Initialize the server with the provided agent app."""
|
33
|
+
self.agent_app = agent_app
|
34
|
+
self.mcp_server: FastMCP = FastMCP(
|
35
|
+
name=server_name,
|
36
|
+
instructions=server_description
|
37
|
+
or f"This server provides access to {len(agent_app._agents)} agents",
|
38
|
+
)
|
39
|
+
# Shutdown coordination
|
40
|
+
self._graceful_shutdown_event = asyncio.Event()
|
41
|
+
self._force_shutdown_event = asyncio.Event()
|
42
|
+
self._shutdown_timeout = 5.0 # Seconds to wait for graceful shutdown
|
43
|
+
|
44
|
+
# Resource management
|
45
|
+
self._exit_stack = AsyncExitStack()
|
46
|
+
self._active_connections: Set[any] = set()
|
47
|
+
|
48
|
+
# Server state
|
49
|
+
self._server_task = None
|
50
|
+
|
51
|
+
# Set up agent tools
|
52
|
+
self.setup_tools()
|
53
|
+
|
54
|
+
logger.info(f"AgentMCPServer initialized with {len(agent_app._agents)} agents")
|
55
|
+
|
56
|
+
def setup_tools(self) -> None:
|
57
|
+
"""Register all agents as MCP tools."""
|
58
|
+
for agent_name, agent in self.agent_app._agents.items():
|
59
|
+
self.register_agent_tools(agent_name, agent)
|
60
|
+
|
61
|
+
def register_agent_tools(self, agent_name: str, agent) -> None:
|
62
|
+
"""Register tools for a specific agent."""
|
63
|
+
|
64
|
+
# Basic send message tool
|
65
|
+
@self.mcp_server.tool(
|
66
|
+
name=f"{agent_name}_send",
|
67
|
+
description=f"Send a message to the {agent_name} agent",
|
68
|
+
)
|
69
|
+
async def send_message(message: str, ctx: MCPContext) -> str:
|
70
|
+
"""Send a message to the agent and return its response."""
|
71
|
+
# Get the agent's context
|
72
|
+
agent_context = getattr(agent, "context", None)
|
73
|
+
|
74
|
+
# Define the function to execute
|
75
|
+
async def execute_send():
|
76
|
+
return await agent.send(message)
|
77
|
+
|
78
|
+
# Execute with bridged context
|
79
|
+
if agent_context and ctx:
|
80
|
+
return await self.with_bridged_context(agent_context, ctx, execute_send)
|
81
|
+
else:
|
82
|
+
return await execute_send()
|
83
|
+
|
84
|
+
# Register a history prompt for this agent
|
85
|
+
@self.mcp_server.prompt(
|
86
|
+
name=f"{agent_name}_history",
|
87
|
+
description=f"Conversation history for the {agent_name} agent",
|
88
|
+
)
|
89
|
+
async def get_history_prompt() -> list:
|
90
|
+
"""Return the conversation history as MCP messages."""
|
91
|
+
# Get the conversation history from the agent's LLM
|
92
|
+
if not hasattr(agent, "_llm") or agent._llm is None:
|
93
|
+
return []
|
94
|
+
|
95
|
+
# Convert the multipart message history to standard PromptMessages
|
96
|
+
multipart_history = agent._llm.message_history
|
97
|
+
prompt_messages = mcp_agent.core.prompt.Prompt.from_multipart(multipart_history)
|
98
|
+
|
99
|
+
# In FastMCP, we need to return the raw list of messages
|
100
|
+
# that matches the structure that FastMCP expects (list of dicts with role/content)
|
101
|
+
return [{"role": msg.role, "content": msg.content} for msg in prompt_messages]
|
102
|
+
|
103
|
+
def _setup_signal_handlers(self):
|
104
|
+
"""Set up signal handlers for graceful and forced shutdown."""
|
105
|
+
loop = asyncio.get_running_loop()
|
106
|
+
|
107
|
+
def handle_signal(is_term=False):
|
108
|
+
# Use asyncio.create_task to handle the signal in an async-friendly way
|
109
|
+
asyncio.create_task(self._handle_shutdown_signal(is_term))
|
110
|
+
|
111
|
+
# Register handlers for SIGINT (Ctrl+C) and SIGTERM
|
112
|
+
for sig, is_term in [(signal.SIGINT, False), (signal.SIGTERM, True)]:
|
113
|
+
loop.add_signal_handler(sig, lambda term=is_term: handle_signal(term))
|
114
|
+
|
115
|
+
logger.debug("Signal handlers installed")
|
116
|
+
|
117
|
+
async def _handle_shutdown_signal(self, is_term=False):
|
118
|
+
"""Handle shutdown signals with proper escalation."""
|
119
|
+
signal_name = "SIGTERM" if is_term else "SIGINT (Ctrl+C)"
|
120
|
+
|
121
|
+
# If force shutdown already requested, exit immediately
|
122
|
+
if self._force_shutdown_event.is_set():
|
123
|
+
logger.info("Force shutdown already in progress, exiting immediately...")
|
124
|
+
os._exit(1)
|
125
|
+
|
126
|
+
# If graceful shutdown already in progress, escalate to forced
|
127
|
+
if self._graceful_shutdown_event.is_set():
|
128
|
+
logger.info(f"Second {signal_name} received. Forcing shutdown...")
|
129
|
+
self._force_shutdown_event.set()
|
130
|
+
# Allow a brief moment for final cleanup, then force exit
|
131
|
+
await asyncio.sleep(0.5)
|
132
|
+
os._exit(1)
|
133
|
+
|
134
|
+
# First signal - initiate graceful shutdown
|
135
|
+
logger.info(f"{signal_name} received. Starting graceful shutdown...")
|
136
|
+
print(f"\n{signal_name} received. Starting graceful shutdown...")
|
137
|
+
print("Press Ctrl+C again to force exit.")
|
138
|
+
self._graceful_shutdown_event.set()
|
139
|
+
|
140
|
+
def run(self, transport: str = "sse", host: str = "0.0.0.0", port: int = 8000) -> None:
|
141
|
+
"""Run the MCP server synchronously."""
|
142
|
+
if transport == "sse":
|
143
|
+
self.mcp_server.settings.host = host
|
144
|
+
self.mcp_server.settings.port = port
|
145
|
+
|
146
|
+
try:
|
147
|
+
self.mcp_server.run(transport=transport)
|
148
|
+
except KeyboardInterrupt:
|
149
|
+
print("\nServer stopped by user (CTRL+C)")
|
150
|
+
finally:
|
151
|
+
# Run an async cleanup in a new event loop
|
152
|
+
asyncio.run(self.shutdown())
|
153
|
+
|
154
|
+
async def run_async(
|
155
|
+
self, transport: str = "sse", host: str = "0.0.0.0", port: int = 8000
|
156
|
+
) -> None:
|
157
|
+
"""Run the MCP server asynchronously with improved shutdown handling."""
|
158
|
+
# Use different handling strategies based on transport type
|
159
|
+
if transport == "sse":
|
160
|
+
# For SSE, use our enhanced shutdown handling
|
161
|
+
self._setup_signal_handlers()
|
162
|
+
|
163
|
+
self.mcp_server.settings.host = host
|
164
|
+
self.mcp_server.settings.port = port
|
165
|
+
|
166
|
+
# Start the server in a separate task so we can monitor it
|
167
|
+
self._server_task = asyncio.create_task(self._run_server_with_shutdown(transport))
|
168
|
+
|
169
|
+
try:
|
170
|
+
# Wait for the server task to complete
|
171
|
+
await self._server_task
|
172
|
+
except asyncio.CancelledError:
|
173
|
+
logger.info("Server task cancelled.")
|
174
|
+
print("\nServer task cancelled.")
|
175
|
+
except Exception as e:
|
176
|
+
logger.error(f"Server error: {e}", exc_info=True)
|
177
|
+
print(f"\nServer error: {e}")
|
178
|
+
finally:
|
179
|
+
# Ensure cleanup happens
|
180
|
+
await self.shutdown()
|
181
|
+
logger.info("Server shutdown complete.")
|
182
|
+
print("\nServer shutdown complete.")
|
183
|
+
else: # stdio
|
184
|
+
# For STDIO, use simpler approach that respects STDIO lifecycle
|
185
|
+
# STDIO will naturally terminate when streams close
|
186
|
+
try:
|
187
|
+
# Run directly without extra monitoring or signal handlers
|
188
|
+
# This preserves the natural lifecycle of STDIO connections
|
189
|
+
await self.mcp_server.run_stdio_async()
|
190
|
+
except (asyncio.CancelledError, KeyboardInterrupt):
|
191
|
+
logger.info("Server stopped (CTRL+C)")
|
192
|
+
print("\nServer stopped (CTRL+C)")
|
193
|
+
|
194
|
+
# Only perform minimal cleanup needed for STDIO
|
195
|
+
# Don't use our full shutdown procedure which could keep process alive
|
196
|
+
await self._cleanup_stdio()
|
197
|
+
|
198
|
+
async def _run_server_with_shutdown(self, transport: str):
|
199
|
+
"""Run the server with proper shutdown handling."""
|
200
|
+
# This method is only used for SSE transport
|
201
|
+
if transport != "sse":
|
202
|
+
raise ValueError("This method should only be used with SSE transport")
|
203
|
+
|
204
|
+
# Start a monitor task for shutdown
|
205
|
+
shutdown_monitor = asyncio.create_task(self._monitor_shutdown())
|
206
|
+
|
207
|
+
try:
|
208
|
+
# Patch SSE server to track connections if needed
|
209
|
+
if hasattr(self.mcp_server, "_sse_transport") and self.mcp_server._sse_transport:
|
210
|
+
# Store the original connect_sse method
|
211
|
+
original_connect = self.mcp_server._sse_transport.connect_sse
|
212
|
+
|
213
|
+
# Create a wrapper that tracks connections
|
214
|
+
@asynccontextmanager
|
215
|
+
async def tracked_connect_sse(*args, **kwargs):
|
216
|
+
async with original_connect(*args, **kwargs) as streams:
|
217
|
+
self._active_connections.add(streams)
|
218
|
+
try:
|
219
|
+
yield streams
|
220
|
+
finally:
|
221
|
+
self._active_connections.discard(streams)
|
222
|
+
|
223
|
+
# Replace with our tracking version
|
224
|
+
self.mcp_server._sse_transport.connect_sse = tracked_connect_sse
|
225
|
+
|
226
|
+
# Run the server (SSE only)
|
227
|
+
await self.mcp_server.run_sse_async()
|
228
|
+
finally:
|
229
|
+
# Cancel the monitor when the server exits
|
230
|
+
shutdown_monitor.cancel()
|
231
|
+
try:
|
232
|
+
await shutdown_monitor
|
233
|
+
except asyncio.CancelledError:
|
234
|
+
pass
|
235
|
+
|
236
|
+
async def _monitor_shutdown(self):
|
237
|
+
"""Monitor for shutdown signals and coordinate proper shutdown sequence."""
|
238
|
+
try:
|
239
|
+
# Wait for graceful shutdown request
|
240
|
+
await self._graceful_shutdown_event.wait()
|
241
|
+
logger.info("Graceful shutdown initiated")
|
242
|
+
|
243
|
+
# Two possible paths:
|
244
|
+
# 1. Wait for force shutdown
|
245
|
+
# 2. Wait for shutdown timeout
|
246
|
+
force_shutdown_task = asyncio.create_task(self._force_shutdown_event.wait())
|
247
|
+
timeout_task = asyncio.create_task(asyncio.sleep(self._shutdown_timeout))
|
248
|
+
|
249
|
+
# Wait for either force shutdown or timeout
|
250
|
+
done, pending = await asyncio.wait(
|
251
|
+
[force_shutdown_task, timeout_task], return_when=asyncio.FIRST_COMPLETED
|
252
|
+
)
|
253
|
+
|
254
|
+
# Cancel the remaining task
|
255
|
+
for task in pending:
|
256
|
+
task.cancel()
|
257
|
+
|
258
|
+
# Determine the shutdown reason
|
259
|
+
if force_shutdown_task in done:
|
260
|
+
logger.info("Force shutdown requested")
|
261
|
+
print("\nForced shutdown initiated...")
|
262
|
+
else:
|
263
|
+
logger.info(f"Graceful shutdown timed out after {self._shutdown_timeout} seconds")
|
264
|
+
print(f"\nGraceful shutdown timed out after {self._shutdown_timeout} seconds")
|
265
|
+
|
266
|
+
# Force close any remaining SSE connections
|
267
|
+
await self._close_sse_connections()
|
268
|
+
|
269
|
+
# Cancel the server task if running
|
270
|
+
if self._server_task and not self._server_task.done():
|
271
|
+
logger.info("Cancelling server task")
|
272
|
+
self._server_task.cancel()
|
273
|
+
except asyncio.CancelledError:
|
274
|
+
# Monitor was cancelled - clean exit
|
275
|
+
pass
|
276
|
+
except Exception as e:
|
277
|
+
logger.error(f"Error in shutdown monitor: {e}", exc_info=True)
|
278
|
+
|
279
|
+
async def _close_sse_connections(self):
|
280
|
+
"""Force close all SSE connections."""
|
281
|
+
# Close tracked connections
|
282
|
+
for conn in list(self._active_connections):
|
283
|
+
try:
|
284
|
+
if hasattr(conn, "close"):
|
285
|
+
await conn.close()
|
286
|
+
elif hasattr(conn, "aclose"):
|
287
|
+
await conn.aclose()
|
288
|
+
except Exception as e:
|
289
|
+
logger.error(f"Error closing connection: {e}")
|
290
|
+
self._active_connections.discard(conn)
|
291
|
+
|
292
|
+
# Access the SSE transport if it exists to close stream writers
|
293
|
+
if (
|
294
|
+
hasattr(self.mcp_server, "_sse_transport")
|
295
|
+
and self.mcp_server._sse_transport is not None
|
296
|
+
):
|
297
|
+
sse = self.mcp_server._sse_transport
|
298
|
+
|
299
|
+
# Close all read stream writers
|
300
|
+
if hasattr(sse, "_read_stream_writers"):
|
301
|
+
writers = list(sse._read_stream_writers.items())
|
302
|
+
for session_id, writer in writers:
|
303
|
+
try:
|
304
|
+
logger.debug(f"Closing SSE connection: {session_id}")
|
305
|
+
await writer.aclose()
|
306
|
+
sse._read_stream_writers.pop(session_id, None)
|
307
|
+
except Exception as e:
|
308
|
+
logger.error(f"Error closing SSE connection {session_id}: {e}")
|
309
|
+
|
310
|
+
async def with_bridged_context(self, agent_context, mcp_context, func, *args, **kwargs):
|
311
|
+
"""
|
312
|
+
Execute a function with bridged context between MCP and agent
|
313
|
+
|
314
|
+
Args:
|
315
|
+
agent_context: The agent's context object
|
316
|
+
mcp_context: The MCP context from the tool call
|
317
|
+
func: The function to execute
|
318
|
+
args, kwargs: Arguments to pass to the function
|
319
|
+
"""
|
320
|
+
# Store original progress reporter if it exists
|
321
|
+
original_progress_reporter = None
|
322
|
+
if hasattr(agent_context, "progress_reporter"):
|
323
|
+
original_progress_reporter = agent_context.progress_reporter
|
324
|
+
|
325
|
+
# Store MCP context in agent context for nested calls
|
326
|
+
agent_context.mcp_context = mcp_context
|
327
|
+
|
328
|
+
# Create bridged progress reporter
|
329
|
+
async def bridged_progress(progress, total=None) -> None:
|
330
|
+
if mcp_context:
|
331
|
+
await mcp_context.report_progress(progress, total)
|
332
|
+
if original_progress_reporter:
|
333
|
+
await original_progress_reporter(progress, total)
|
334
|
+
|
335
|
+
# Install bridged progress reporter
|
336
|
+
if hasattr(agent_context, "progress_reporter"):
|
337
|
+
agent_context.progress_reporter = bridged_progress
|
338
|
+
|
339
|
+
try:
|
340
|
+
# Call the function
|
341
|
+
return await func(*args, **kwargs)
|
342
|
+
finally:
|
343
|
+
# Restore original progress reporter
|
344
|
+
if hasattr(agent_context, "progress_reporter"):
|
345
|
+
agent_context.progress_reporter = original_progress_reporter
|
346
|
+
|
347
|
+
# Remove MCP context reference
|
348
|
+
if hasattr(agent_context, "mcp_context"):
|
349
|
+
delattr(agent_context, "mcp_context")
|
350
|
+
|
351
|
+
async def _cleanup_stdio(self):
|
352
|
+
"""Minimal cleanup for STDIO transport to avoid keeping process alive."""
|
353
|
+
logger.info("Performing minimal STDIO cleanup")
|
354
|
+
|
355
|
+
# Just clean up agent resources directly without the full shutdown sequence
|
356
|
+
# This preserves the natural exit process for STDIO
|
357
|
+
for agent_name, agent in self.agent_app._agents.items():
|
358
|
+
try:
|
359
|
+
if hasattr(agent, "shutdown"):
|
360
|
+
await agent.shutdown()
|
361
|
+
except Exception as e:
|
362
|
+
logger.error(f"Error shutting down agent {agent_name}: {e}")
|
363
|
+
|
364
|
+
logger.info("STDIO cleanup complete")
|
365
|
+
|
366
|
+
async def shutdown(self):
|
367
|
+
"""Gracefully shutdown the MCP server and its resources."""
|
368
|
+
logger.info("Running full shutdown procedure")
|
369
|
+
|
370
|
+
# Skip if already in shutdown
|
371
|
+
if self._graceful_shutdown_event.is_set():
|
372
|
+
return
|
373
|
+
|
374
|
+
# Signal shutdown
|
375
|
+
self._graceful_shutdown_event.set()
|
376
|
+
|
377
|
+
# Close SSE connections
|
378
|
+
await self._close_sse_connections()
|
379
|
+
|
380
|
+
# Close any resources in the exit stack
|
381
|
+
await self._exit_stack.aclose()
|
382
|
+
|
383
|
+
# Shutdown any agent resources
|
384
|
+
for agent_name, agent in self.agent_app._agents.items():
|
385
|
+
try:
|
386
|
+
if hasattr(agent, "shutdown"):
|
387
|
+
await agent.shutdown()
|
388
|
+
except Exception as e:
|
389
|
+
logger.error(f"Error shutting down agent {agent_name}: {e}")
|
390
|
+
|
391
|
+
logger.info("Full shutdown complete")
|
@@ -1,152 +0,0 @@
|
|
1
|
-
# src/mcp_agent/mcp_server/agent_server.py
|
2
|
-
|
3
|
-
import asyncio
|
4
|
-
|
5
|
-
from mcp.server.fastmcp import Context as MCPContext
|
6
|
-
from mcp.server.fastmcp import FastMCP
|
7
|
-
|
8
|
-
import mcp_agent
|
9
|
-
import mcp_agent.core
|
10
|
-
import mcp_agent.core.prompt
|
11
|
-
from mcp_agent.core.agent_app import AgentApp
|
12
|
-
|
13
|
-
|
14
|
-
class AgentMCPServer:
|
15
|
-
"""Exposes FastAgent agents as MCP tools through an MCP server."""
|
16
|
-
|
17
|
-
def __init__(
|
18
|
-
self,
|
19
|
-
agent_app: AgentApp,
|
20
|
-
server_name: str = "FastAgent-MCP-Server",
|
21
|
-
server_description: str | None = None,
|
22
|
-
) -> None:
|
23
|
-
self.agent_app = agent_app
|
24
|
-
self.mcp_server: FastMCP = FastMCP(
|
25
|
-
name=server_name,
|
26
|
-
instructions=server_description
|
27
|
-
or f"This server provides access to {len(agent_app._agents)} agents",
|
28
|
-
)
|
29
|
-
self.setup_tools()
|
30
|
-
|
31
|
-
def setup_tools(self) -> None:
|
32
|
-
"""Register all agents as MCP tools."""
|
33
|
-
for agent_name, agent in self.agent_app._agents.items():
|
34
|
-
self.register_agent_tools(agent_name, agent)
|
35
|
-
|
36
|
-
def register_agent_tools(self, agent_name: str, agent) -> None:
|
37
|
-
"""Register tools for a specific agent."""
|
38
|
-
|
39
|
-
# Basic send message tool
|
40
|
-
@self.mcp_server.tool(
|
41
|
-
name=f"{agent_name}_send",
|
42
|
-
description=f"Send a message to the {agent_name} agent",
|
43
|
-
)
|
44
|
-
async def send_message(message: str, ctx: MCPContext) -> str:
|
45
|
-
"""Send a message to the agent and return its response."""
|
46
|
-
|
47
|
-
# Get the agent's context
|
48
|
-
agent_context = getattr(agent, "context", None)
|
49
|
-
|
50
|
-
# Define the function to execute
|
51
|
-
async def execute_send():
|
52
|
-
return await agent.send(message)
|
53
|
-
|
54
|
-
# Execute with bridged context
|
55
|
-
if agent_context and ctx:
|
56
|
-
return await self.with_bridged_context(agent_context, ctx, execute_send)
|
57
|
-
else:
|
58
|
-
return await execute_send()
|
59
|
-
|
60
|
-
# Register a history prompt for this agent
|
61
|
-
@self.mcp_server.prompt(
|
62
|
-
name=f"{agent_name}_history",
|
63
|
-
description=f"Conversation history for the {agent_name} agent",
|
64
|
-
)
|
65
|
-
async def get_history_prompt() -> list:
|
66
|
-
"""Return the conversation history as MCP messages."""
|
67
|
-
# Get the conversation history from the agent's LLM
|
68
|
-
if not hasattr(agent, "_llm") or agent._llm is None:
|
69
|
-
return []
|
70
|
-
|
71
|
-
# Convert the multipart message history to standard PromptMessages
|
72
|
-
multipart_history = agent._llm.message_history
|
73
|
-
prompt_messages = mcp_agent.core.prompt.Prompt.from_multipart(multipart_history)
|
74
|
-
|
75
|
-
# In FastMCP, we need to return the raw list of messages
|
76
|
-
# that matches the structure that FastMCP expects (list of dicts with role/content)
|
77
|
-
return [{"role": msg.role, "content": msg.content} for msg in prompt_messages]
|
78
|
-
|
79
|
-
def run(self, transport: str = "sse", host: str = "0.0.0.0", port: int = 8000) -> None:
|
80
|
-
"""Run the MCP server."""
|
81
|
-
if transport == "sse":
|
82
|
-
# For running as a web server
|
83
|
-
self.mcp_server.settings.host = host
|
84
|
-
self.mcp_server.settings.port = port
|
85
|
-
|
86
|
-
self.mcp_server.run(transport=transport)
|
87
|
-
|
88
|
-
async def run_async(
|
89
|
-
self, transport: str = "sse", host: str = "0.0.0.0", port: int = 8000
|
90
|
-
) -> None:
|
91
|
-
"""Run the MCP server asynchronously."""
|
92
|
-
if transport == "sse":
|
93
|
-
self.mcp_server.settings.host = host
|
94
|
-
self.mcp_server.settings.port = port
|
95
|
-
try:
|
96
|
-
await self.mcp_server.run_sse_async()
|
97
|
-
except (asyncio.CancelledError, KeyboardInterrupt):
|
98
|
-
print("Server Stopped (CTRL+C)")
|
99
|
-
return
|
100
|
-
else: # stdio
|
101
|
-
try:
|
102
|
-
await self.mcp_server.run_stdio_async()
|
103
|
-
except (asyncio.CancelledError, KeyboardInterrupt):
|
104
|
-
# Gracefully handle cancellation during shutdown
|
105
|
-
print("Server Stopped (CTRL+C)")
|
106
|
-
return
|
107
|
-
|
108
|
-
async def with_bridged_context(self, agent_context, mcp_context, func, *args, **kwargs):
|
109
|
-
"""
|
110
|
-
Execute a function with bridged context between MCP and agent
|
111
|
-
|
112
|
-
Args:
|
113
|
-
agent_context: The agent's context object
|
114
|
-
mcp_context: The MCP context from the tool call
|
115
|
-
func: The function to execute
|
116
|
-
args, kwargs: Arguments to pass to the function
|
117
|
-
"""
|
118
|
-
# Store original progress reporter if it exists
|
119
|
-
original_progress_reporter = None
|
120
|
-
if hasattr(agent_context, "progress_reporter"):
|
121
|
-
original_progress_reporter = agent_context.progress_reporter
|
122
|
-
|
123
|
-
# Store MCP context in agent context for nested calls
|
124
|
-
agent_context.mcp_context = mcp_context
|
125
|
-
|
126
|
-
# Create bridged progress reporter
|
127
|
-
async def bridged_progress(progress, total=None) -> None:
|
128
|
-
if mcp_context:
|
129
|
-
await mcp_context.report_progress(progress, total)
|
130
|
-
if original_progress_reporter:
|
131
|
-
await original_progress_reporter(progress, total)
|
132
|
-
|
133
|
-
# Install bridged progress reporter
|
134
|
-
if hasattr(agent_context, "progress_reporter"):
|
135
|
-
agent_context.progress_reporter = bridged_progress
|
136
|
-
|
137
|
-
try:
|
138
|
-
# Call the function
|
139
|
-
return await func(*args, **kwargs)
|
140
|
-
finally:
|
141
|
-
# Restore original progress reporter
|
142
|
-
if hasattr(agent_context, "progress_reporter"):
|
143
|
-
agent_context.progress_reporter = original_progress_reporter
|
144
|
-
|
145
|
-
# Remove MCP context reference
|
146
|
-
if hasattr(agent_context, "mcp_context"):
|
147
|
-
delattr(agent_context, "mcp_context")
|
148
|
-
|
149
|
-
async def shutdown(self):
|
150
|
-
"""Gracefully shutdown the MCP server and its resources."""
|
151
|
-
# Your MCP server may have additional cleanup code here
|
152
|
-
pass
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/examples/data-analysis/fastagent.config.yaml
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/examples/mcp/state-transfer/fastagent.config.yaml
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/agents/workflow/chain_agent.py
RENAMED
File without changes
|
{fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/agents/workflow/evaluator_optimizer.py
RENAMED
File without changes
|
{fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/agents/workflow/orchestrator_agent.py
RENAMED
File without changes
|
{fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/agents/workflow/orchestrator_models.py
RENAMED
File without changes
|
File without changes
|
{fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/agents/workflow/parallel_agent.py
RENAMED
File without changes
|
{fast_agent_mcp-0.2.12 → fast_agent_mcp-0.2.13}/src/mcp_agent/agents/workflow/router_agent.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|