Seamlessly integrate your LlamaIndex and AI applications with Affinity using Klavis AI's comprehensive MCP server connection guide.
Affinity is a relationship intelligence platform that helps teams manage relationships, track deals, and leverage network insights to drive business growth with powerful CRM and relationship mapping capabilities
Follow these steps to connect LlamaIndex to this MCP server
Sign up for KlavisAI to access our MCP server management platform.
Add the MCP server 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
# Initialize clients
klavis_client = Klavis(api_key=os.getenv("KLAVIS_API_KEY"))
affinity_mcp_instance = klavis_client.mcp_server.create_server_instance(
server_name=McpServerName.AFFINITY,
user_id="1234",
platform_name="Klavis",
connection_type=ConnectionType.STREAMABLE_HTTP,
)
affinity_tools = await aget_tools_from_mcp_url(
affinity_mcp_instance.server_url,
client=BasicMCPClient(affinity_mcp_instance.server_url)
)
affinity_agent = FunctionAgent(
name="affinity_agent",
tools=affinity_tools,
llm=llm,
)
Everything you need to know about connecting to this MCP server
Join developers who are already using KlavisAI to power their LlamaIndex applications with this MCP server.
Start For Free