Documentation Index Fetch the complete documentation index at: https://docs.stackone.com/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Anthropic provides native MCP client support through the official mcp Python SDK, enabling direct integration with StackOne’s MCP server.
MCP Python SDK
Installation
uv add anthropic mcp httpx
Quick Start
Connect to StackOne MCP and use tools with Claude:
import os
import asyncio
import base64
from anthropic import Anthropic
from mcp.client.streamable_http import streamablehttp_client
from mcp import ClientSession
# Configure StackOne account
STACKONE_ACCOUNT_ID = "<account_id>" # Your StackOne account ID
# Encode API key for Basic auth
auth_token = base64.b64encode(
f " { os.getenv( 'STACKONE_API_KEY' ) } :" .encode()
).decode()
async def main ():
# Connect to StackOne MCP
async with streamablehttp_client(
url = "https://api.stackone.com/mcp" ,
headers = {
"Authorization" : f "Basic { auth_token } " ,
"x-account-id" : STACKONE_ACCOUNT_ID
}
) as (read, write, get_session_id):
async with ClientSession(read, write) as session:
await session.initialize()
# Get StackOne tools
tools_response = await session.list_tools()
tools = [{
"name" : t.name,
"description" : t.description,
"input_schema" : t.inputSchema
} for t in tools_response.tools]
# Use with Claude
client = Anthropic()
messages = [{ "role" : "user" , "content" : "Search recent calls in Gong" }]
response = client.messages.create(
model = "claude-haiku-4-5-20251001" ,
max_tokens = 4096 ,
tools = tools,
messages = messages
)
# Handle tool calls
if response.stop_reason == "tool_use" :
for block in response.content:
if block.type == "tool_use" :
result = await session.call_tool(
block.name,
arguments = block.input
)
print (result.content[ 0 ].text)
asyncio.run(main())
Environment Variables
STACKONE_API_KEY =< stackone_api_key >
ANTHROPIC_API_KEY = your_anthropic_key
For multi-turn conversations with automatic tool execution:
async def chat_with_tools ( session , user_message : str ):
"""Chat with Claude using StackOne tools"""
client = Anthropic()
# Get tools from StackOne
tools_response = await session.list_tools()
tools = [{
"name" : t.name,
"description" : t.description,
"input_schema" : t.inputSchema
} for t in tools_response.tools]
messages = [{ "role" : "user" , "content" : user_message}]
# Tool calling loop
while True :
response = client.messages.create(
model = "claude-haiku-4-5-20251001" ,
max_tokens = 4096 ,
tools = tools,
messages = messages
)
if response.stop_reason != "tool_use" :
return response.content[ 0 ].text
# Execute tools
tool_results = []
for block in response.content:
if block.type == "tool_use" :
result = await session.call_tool(block.name, arguments = block.input)
tool_results.append({
"type" : "tool_result" ,
"tool_use_id" : block.id,
"content" : result.content[ 0 ].text
})
messages.append({ "role" : "assistant" , "content" : response.content})
messages.append({ "role" : "user" , "content" : tool_results})
Resources
Next Steps
Pydantic AI Try Pydantic AI with built-in MCP support
LangChain Build agents with LangChain MCP adapters