Skip to content

Conversation

personal-dc
Copy link

Added support for using mcp tools with flow manager

  • added an "is_mcp" flag for a function in the flow_config to make the flow manager aware that the handler should be looking directly at llm registered tools (via the mcp server)
  • wrap the function in a handler like the flow manager expects

Usage:

# Initialize MCP Client
from pipecat.services.mcp_service import MCPClient

mcp = MCPClient(
            server_params=StreamableHttpParameters(
                url="https://api.githubcopilot.com/mcp/",
                headers={"Authorization": f"Bearer {os.getenv('GITHUB_PERSONAL_ACCESS_TOKEN')}"},
            )
        )

tools = await mcp.register_tools(llm)
# In your flow config 
flow_config = {
    "nodes": {
        "vehicle_lookup": {
            "task_messages": [
                {"role": "system", "content": "Your role messages"}
            ],
            "functions": [
                # regular function with an already implemented flow handler
                {
                    "type": "function",
                    "function": {
                        "name": "implemented_handler_function",
                        "handler": "implemented_handler_function",
                        "description": "function with an implemented flow handler",
                        "parameters": {"type": "object", "properties": {}, "required": []}
                    }
                },
                # MCP server registered function with an already implemented flow handler
                {
                    "type": "function",
                    "function": {
                        "name": "mcp_registered_function",
                         # KEY ADDITION
                        "is_mcp": True,
                        "description": "Description of that function",
                        "parameters": {
                            "type": "object",
                            "properties": {"arg": {"type": "arg type"}},
                            "required": ["arg"]
                        }
                    }
                },

Copy link

vercel bot commented Aug 22, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
pipecat-flows Ready Ready Preview Aug 22, 2025 7:10pm

Copy link
Author

@personal-dc personal-dc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@markbackman could you please review this PR and leave feedback - thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant