Skip to content

LangGraph ​

Use langchain-mcp-adapters to load TKP's tools into a Python application. This example lists the available tools before you attach them to an agent. It does not require a model provider.

Prepare the connection ​

You need a Python environment with langchain-mcp-adapters installed and a Personal Access Token with MCP and read access to one library. In your application's virtual environment, install the adapter:

bash
python -m pip install langchain-mcp-adapters

Set TKP_MCP_URL to your TKP application address followed by /mcp, for example https://tkp.example.com/mcp. Set TKP_TOKEN to the token. The developer quickstart shows how to enter these variables without displaying the token.

Load the tools ​

Save this as tkp_tools.py:

python
import asyncio
import os

from langchain_mcp_adapters.client import MultiServerMCPClient

client = MultiServerMCPClient(
    {
        "tkp": {
            "transport": "streamable_http",
            "url": os.environ["TKP_MCP_URL"],
            "headers": {
                "Authorization": f"Bearer {os.environ['TKP_TOKEN']}",
            },
        },
    }
)

async def main():
    tools = await client.get_tools()
    print([tool.name for tool in tools])


asyncio.run(main())

Run python tkp_tools.py in that environment. The output should include list_libraries and search_resources. If they are missing, check that the token has read permission for a library.

Add tools to an agent ​

Use the discovered tool objects with your LangGraph application's chosen agent setup. Before exposing them to a model, select the tools you want to allow and add approval handling for writes and expensive analysis. The connection code above does not make those decisions for you.

See the adapter documentation for framework integration. For a complete search and evidence-reading example without framework dependencies, use the Python quickstart.

Traceable Knowledge Platform