> ## Documentation Index
> Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Demo Test Tracker MCP

> Demo Python script that discovers issue tracker MCP tools, converts them to LangChain tools, and uses an LLM prompt to list available tracker actions

Hello and welcome back.

Before integrating an AI agent with the MCP, you should first discover which tools the MCP exposes — especially the issue tracker MCP included in this repo. Jumping straight to integration assumes you already know what tools exist and how they behave. In production, a reproducible way to enumerate available MCP tools is essential.

This guide provides a small standalone Python script that programmatically queries a tracker MCP and lists its available tools. The script does not import the project’s MCP client, so you can run it against any compatible MCP service to verify the exposed tools.

Overview

* The script uses LangChain helper functions to convert MCP tool metadata into LangChain tools.
* It creates a concise prompt that instructs the LLM to list available tools (without invoking them).
* The script prints the discovered tool list and the total count.

Code: prompt\_list\_tracker\_tools.py

```python theme={null}
"""Standalone demo: ask an LLM to list tracker MCP tools (no mcp_client)."""
import asyncio
import os
from pathlib import Path

from dotenv import load_dotenv
from langchain.agents import create_agent
from langchain_core.messages import HumanMessage
from langchain_mcp_tools import convert_mcp_to_langchain_tools
from langchain_openai import ChatOpenAI

# Load environment from repository root (adjust parents if needed)
load_dotenv(Path(__file__).parents[3] / ".env")

TRACKER_MCP_URL = os.getenv("TRACKER_MCP_URL", "http://localhost:8086/sse")

TRACKER_MCP_SERVERS = {
    "tracker": {
        "url": TRACKER_MCP_URL,
        "transport": "sse",
    },
}

PROMPT = """
You have issue tracker MCP tools available.

List every tool you can use. For each tool, give its name and a one-line description
of what it does. Do not call any tool. Do not create or update issues.
"""

async def main() -> None:
    # Convert MCP server descriptions into LangChain tools
    tools, cleanup = await convert_mcp_to_langchain_tools(TRACKER_MCP_SERVERS)
    try:
        print(f"Connected to tracker MCP at {TRACKER_MCP_URL} ({len(tools)} tools)\n")
        llm = ChatOpenAI(
            model=os.environ["OPENAI_MODEL_ID"],
            base_url=os.environ["OPENAI_BASE_URL"],
            api_key=os.environ["OPENAI_API_KEY"],
            temperature=float(os.getenv("OPENAI_TEMPERATURE", "0.2")),
            max_tokens=256,
        )
        agent = create_agent(llm, tools)
        # Send the single prompt as a HumanMessage and await the agent's reply
        result = await agent.ainvoke({"messages": [HumanMessage(content=PROMPT)]})
        # The model response is in the last message
        print(result["messages"][-1].content)
    finally:
        await cleanup()

if __name__ == "__main__":
    asyncio.run(main())
```

What this script does

* Defines the tracker MCP endpoint and transport (SSE in this example).
* Calls `convert_mcp_to_langchain_tools` to fetch MCP tool metadata and produce LangChain-compatible tools.
* Instantiates a `ChatOpenAI` LLM client using variables from your `.env`.
* Sends a controlled prompt asking the model to list tools without invoking any.
* Prints the model response and logs the discovered tool count.

Environment variables and configuration

* The script reads OpenAI-compatible variables from a `.env` file located at the repository root (adjust the parent path if your layout differs).
* Key variables used by the script:
  * `OPENAI_MODEL_ID` — LLM model identifier
  * `OPENAI_BASE_URL` — base URL for the OpenAI-compatible API
  * `OPENAI_API_KEY` — API key / bearer token
  * `OPENAI_TEMPERATURE` — optional temperature setting (default `0.2`)
  * `TRACKER_MCP_URL` — optional override for the tracker MCP endpoint (default `http://localhost:8086/sse`)

Ensure your `.env` contains the required OpenAI-compatible variables (`OPENAI_MODEL_ID`, `OPENAI_BASE_URL`, `OPENAI_API_KEY`). If `TRACKER_MCP_URL` is not set in the environment, the script uses the default `http://localhost:8086/sse`.

Start the tracker MCP
Make sure the tracker MCP is running before executing the script. In this demo the tracker is provided as a Docker image; adapt the command as needed if your organization runs the MCP differently.

Start the tracker (example Docker command used in this demo):

```bash theme={null}
docker run --rm -p 8085:8000 -p 8086:8001 --name finops-issue-tracker finops-issue-tracker:latest
```

Example output when launching the tracker container:

```bash theme={null}
INFO:     Started server process [9]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
INFO:     Started server process [8]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:8001 (Press CTRL+C to quit)
```

Run the discovery script

```bash theme={null}
python3 prompt_list_tracker_tools.py
```

Sample terminal output from the script showing the MCP connection and discovered tools:

```bash theme={null}
[INFO] MCP server "tracker": initializing with: {'url': 'http://localhost:8086/sse', 'transport': 'sse'}
[INFO] MCP server "tracker": Pre-validating authentication
[INFO] HTTP Request: POST http://localhost:8086/sse "HTTP/1.1 405 Method Not Allowed"
[INFO] MCP server "tracker": Authentication validation passed: 405
[INFO] MCP server "tracker": connecting via SSE (explicit) to http://localhost:8086/sse
[WARNING] MCP server "tracker": Using SSE transport (deprecated as of MCP 2025-03-26), consider migrating to streamable_http
[INFO] HTTP Request: GET http://localhost:8086/sse "HTTP/1.1 200 OK"
[INFO] HTTP Request: POST http://localhost:8086/messages/?session_id=c470b4ff438140d5ad3a0331dd2572af "HTTP/1.1 202 Accepted"
[INFO] MCP server "tracker": connected
[INFO] HTTP Request: POST http://localhost:8086/messages/?session_id=c470b4ff438140d5ad3a0331dd2572af "HTTP/1.1 202 Accepted"
[INFO] HTTP Request: POST http://localhost:8086/messages/?session_id=c470b4ff438140d5ad3a0331dd2572af "HTTP/1.1 202 Accepted"
[INFO] MCP server "tracker": 4 tool(s) available:
[INFO] - create_issue
[INFO] - list_issues
[INFO] - get_issue
[INFO] - update_issue

[INFO] MCP servers initialized: 4 tool(s) available in total
Tracker MCP OK – 4 tools via http://localhost:8086/sse
- create_issue
- list_issues
- get_issue
- update_issue
[INFO] MCP server "tracker": session closed
```

Interpreting the results

* The sample output indicates the tracker MCP exposes four tools:
  * `create_issue`
  * `list_issues`
  * `get_issue`
  * `update_issue`

Tool summary (example)

| Tool name | Purpose / one-line description |
| - | - |
| `create_issue` | Create a new issue/ticket in the tracker |
| `list_issues` | List existing issues with optional filters |
| `get_issue` | Retrieve the details of a single issue by ID |
| `update_issue` | Modify fields or status on an existing issue |

Next steps and usage ideas

* Use `list_issues` to fetch and inspect current tickets before creating new ones.
* Use `create_issue` to file new tickets based on outputs from an upstream FinOps agent.
* Use `update_issue` to change status, add comments, or attach metadata as workflows progress.
* If you prefer an interactive exploration, connect an AI coding assistant (e.g., Claude Code or other coding-capable agents) to the MCP and have it enumerate the tools and propose example calls interactively.

The log shows SSE transport in use and warns that SSE is deprecated as of MCP 2025-03-26. If you control the MCP server, consider migrating to `streamable_http` or another supported transport to avoid future compatibility issues.

References

* LangChain: [https://langchain.com](https://langchain.com)
* OpenAI Codex: [https://openai.com/blog/openai-codex](https://openai.com/blog/openai-codex)
* MCP / tracker integration examples: check this repo for agent integration samples and the project README for deployment details

Now that you can discover MCP tools programmatically, you can safely update agent code to call `create_issue` and `update_issue` (and other tracker tools) driven by outputs from your FinOps or automation agents.

> **[Watch Video](https://learn.kodekloud.com/user/courses/building-kubernetes-finops-ai-agent/module/bbcc27a3-b731-4d76-9ba0-b3df1a8b3afb/lesson/79549e35-871b-478f-868a-9f0a184df085)**


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.