Create powerful AI workflows by connecting multiple MCP servers including Postgres, Google Docs, Supabase for enhanced automation capabilities in Klavis AI.
PostgreSQL is a powerful, open source object-relational database system
Google Docs is a word processor included as part of the free, web-based Google Docs Editors suite
Supabase official MCP Server
Follow these steps to connect LlamaIndex to these MCP servers
Sign up for KlavisAI to access our MCP server management platform.
Add your desired MCP servers to LlamaIndex and configure authentication settings.
Verify your connections work correctly and start using your enhanced AI capabilities.
import os
from klavis import Klavis
from klavis.types import McpServerName, ConnectionType
from llama_index.tools.mcp import (
BasicMCPClient,
get_tools_from_mcp_url,
aget_tools_from_mcp_url,
)
from llama_index.core.agent.workflow import FunctionAgent, AgentWorkflow
# Initialize clients
klavis_client = Klavis(api_key=os.getenv("KLAVIS_API_KEY"))
postgres_mcp_instance = klavis_client.mcp_server.create_server_instance(
server_name=McpServerName.POSTGRES,
user_id="1234",
platform_name="Klavis",
connection_type=ConnectionType.STREAMABLE_HTTP,
)
google_docs_mcp_instance = klavis_client.mcp_server.create_server_instance(
server_name=McpServerName.GOOGLE_DOCS,
user_id="1234",
platform_name="Klavis",
connection_type=ConnectionType.STREAMABLE_HTTP,
)
supabase_mcp_instance = klavis_client.mcp_server.create_server_instance(
server_name=McpServerName.SUPABASE,
user_id="1234",
platform_name="Klavis",
connection_type=ConnectionType.STREAMABLE_HTTP,
)
postgres_tools = await aget_tools_from_mcp_url(
postgres_mcp_instance.server_url,
client=BasicMCPClient(postgres_mcp_instance.server_url)
)
google_docs_tools = await aget_tools_from_mcp_url(
google_docs_mcp_instance.server_url,
client=BasicMCPClient(google_docs_mcp_instance.server_url)
)
supabase_tools = await aget_tools_from_mcp_url(
supabase_mcp_instance.server_url,
client=BasicMCPClient(supabase_mcp_instance.server_url)
)
postgres_agent = FunctionAgent(
name="postgres_agent",
tools=postgres_tools,
llm=llm,
)
google_docs_agent = FunctionAgent(
name="google_docs_agent",
tools=google_docs_tools,
llm=llm,
)
supabase_agent = FunctionAgent(
name="supabase_agent",
tools=supabase_tools,
llm=llm,
)
workflow = AgentWorkflow(
agents=[postgres_agent, google_docs_agent, supabase_agent],
root_agent="postgres_agent",
)
Everything you need to know about connecting to these MCP servers
Join developers who are already using KlavisAI to power their LlamaIndex applications with these MCP servers.
Start For Free