







import { Agent } from "@openai/agents";
import { MCPServerStreamableHttp } from "@openai/agents/mcp";
// Configure StackOne account
const STACKONE_ACCOUNT_ID = "<account_id>"; // Your StackOne account ID
// Encode API key for Basic auth
const authToken = Buffer.from(`${process.env.STACKONE_API_KEY}:`).toString("base64");
// Create MCP server connection
const stackoneMcp = new MCPServerStreamableHttp({
url: "https://api.stackone.com/mcp",
headers: {
Authorization: `Basic ${authToken}`,
"x-account-id": STACKONE_ACCOUNT_ID,
},
});
// Create agent with StackOne tools
const agent = new Agent({
model: "gpt-5.2",
mcpServers: [stackoneMcp],
});
// Run agent
const response = await agent.run("List Salesforce accounts");
console.log(response.output);
import os
import base64
from agents import Agent
from agents.mcp import MCPServerStreamableHttp, MCPServerStreamableHttpParams
# 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()
# Create MCP server connection
stackone_mcp = MCPServerStreamableHttp(
params=MCPServerStreamableHttpParams(
url="https://api.stackone.com/mcp",
headers={
"Authorization": f"Basic {auth_token}",
"x-account-id": STACKONE_ACCOUNT_ID,
},
)
)
# Create agent with StackOne tools
agent = Agent(
model="gpt-5.2",
mcp_servers=[stackone_mcp]
)
# Run agent
response = agent.run("List Salesforce accounts")
print(response.output)
import { anthropic } from "@ai-sdk/anthropic";
import { generateText, stepCountIs } from "ai";
import { experimental_createMCPClient } from "@ai-sdk/mcp";
// Connect to StackOne MCP server
const mcp = await experimental_createMCPClient({
transport: {
type: "http",
url: "https://api.stackone.com/mcp",
headers: {
Authorization: `Basic ${Buffer.from(`${process.env.STACKONE_API_KEY}:`).toString("base64")}`,
"x-account-id": "<stackone_account_id>",
},
},
});
// Get StackOne tools
const tools = await mcp.tools();
// Use with any AI SDK provider
const result = await generateText({
model: anthropic("claude-haiku-4-5-20251001"),
tools,
prompt: "List all employees",
stopWhen: stepCountIs(2),
});
console.log(result.text);
{
"mcpServers": {
"stackone": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/client-http",
"https://api.stackone.com/mcp"
],
"env": {
"MCP_HTTP_HEADERS": "{\"Authorization\":\"Basic YOUR_BASE64_TOKEN\",\"x-account-id\":\"YOUR_ACCOUNT_ID\"}"
}
}
}
}
import os
import base64
from langchain_mcp_adapters import MultiServerMCPClient
from langchain.agents import AgentExecutor, create_tool_calling_agent
from langchain_openai import ChatOpenAI
from langchain.prompts import ChatPromptTemplate
# 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()
# Connect to StackOne MCP server
mcp_client = MultiServerMCPClient({
"stackone": {
"url": "https://api.stackone.com/mcp",
"transport": "streamable_http",
"headers": {
"Authorization": f"Basic {auth_token}",
"x-account-id": STACKONE_ACCOUNT_ID,
"Content-Type": "application/json",
"Accept": "application/json,text/event-stream",
"MCP-Protocol-Version": "2025-06-18"
}
}
})
# Get StackOne tools
tools = mcp_client.list_tools()
# Create agent with StackOne tools
llm = ChatOpenAI(model="gpt-5.2")
prompt = ChatPromptTemplate.from_messages([
("system", "You are a helpful assistant with access to data from various integrations."),
("human", "{input}"),
("placeholder", "{agent_scratchpad}")
])
agent = create_tool_calling_agent(llm, tools, prompt)
agent_executor = AgentExecutor(agent=agent, tools=tools)
# Run agent
result = agent_executor.invoke({"input": "List Salesforce accounts"})
print(result["output"])

