# Chat Interface
Source: https://docs.observee.ai/agentsdk/chat
AI conversations with tool access - both standard and streaming
## Basic Usage
```python Python
from observee_agents import chat_with_tools
result = chat_with_tools(
message="Search for recent AI news",
provider="anthropic",
observee_api_key="obs_your_key_here"
)
print(result["content"])
```
```typescript TypeScript
import { chatWithTools } from "@observee/agents";
const result = await chatWithTools("Search for recent AI news", {
provider: "anthropic",
observeeApiKey: "obs_your_key_here"
});
console.log(result.content);
```
## Streaming Responses
```python Python
import asyncio
from observee_agents import chat_with_tools_stream
async def stream_example():
async for chunk in chat_with_tools_stream(
message="What's the weather like today?",
provider="anthropic",
observee_api_key="obs_your_key_here"
):
if chunk["type"] == "content":
print(chunk["content"], end="", flush=True)
elif chunk["type"] == "final_content":
print(chunk["content"], end="", flush=True)
elif chunk["type"] == "tool_result":
print(f"\nπ§ [Tool: {chunk['tool_name']}]")
asyncio.run(stream_example())
```
```typescript TypeScript
import { chatWithToolsStream } from "@observee/agents";
try {
for await (const chunk of chatWithToolsStream("What's the weather like today?", {
provider: "anthropic",
observeeApiKey: "obs_your_key_here"
})) {
if (chunk.type === "content") {
console.log(chunk.content);
}
}
} catch (e) {
console.log(`Error: ${e}`);
}
```
## Parameters
| Parameter | Type | Default | Description |
| ------------------ | ------- | ------------- | ------------------------------------------------------- |
| `message` | `str` | *required* | Your message or query |
| `provider` | `str` | `"anthropic"` | LLM provider: `"anthropic"`, `"openai"`, `"gemini"` |
| `model` | `str` | `None` | Specific model (auto-detected if not provided) |
| `observee_api_key` | `str` | `None` | Your Observee API key |
| `enable_filtering` | `bool` | `True` | Whether to filter tools |
| `filter_type` | `str` | `"bm25"` | Filter method: `"bm25"`, `"local_embedding"`, `"cloud"` |
| `max_tools` | `int` | `20` | Maximum tools to provide |
| `temperature` | `float` | `0.7` | LLM temperature |
| `max_tokens` | `int` | `1000` | Maximum response tokens |
| `session_id` | `str` | `None` | Session ID for conversation history |
| `system_prompt` | `str` | `None` | Custom system prompt |
## Response Formats
### Standard Response
```python
{
"content": "AI response text",
"tool_calls": [{"name": "tool_name", "input": {...}}],
"tool_results": [{"tool": "tool_name", "result": "..."}],
"filtered_tools_count": 5,
"used_filtering": True
}
```
### Streaming Chunk Types
```python
# Content chunk
{
"type": "content",
"content": "streaming text content"
}
# Tool result chunk
{
"type": "tool_result",
"tool_name": "tool_name",
"result": "tool output"
}
# Error chunk
{
"type": "error",
"error": "error message"
}
# Session metadata chunk
{
"type": "done",
"session_id": "session_123", # When using conversation history
"final_response": {...}
}
```
## Examples
### Different Providers
```python Python
# Anthropic Claude
result = chat_with_tools(
message="Analyze this data",
provider="anthropic",
model="claude-sonnet-4-20250514"
)
# OpenAI GPT
result = chat_with_tools(
message="Write a summary",
provider="openai",
model="gpt-4o"
)
# Google Gemini
result = chat_with_tools(
message="Search for information",
provider="gemini",
model="gemini-2.5-pro"
)
```
```typescript TypeScript
import { chatWithTools } from "@observee/agents";
const result1 = await chatWithTools("Analyze this data", {
provider: "anthropic",
model: "claude-sonnet-4-20250514"
});
console.log(result.content);
const result2 = await chatWithTools("Write a summary", {
provider: "openai",
model: "gpt-4o"
});
console.log(result2.content);
const result3 = await chatWithTools("Search for information", {
provider: "gemini",
model: "gemini-2.5-pro"
});
console.log(result3.content);
```
### Tool Filtering
```python Python
# Fast keyword filtering (default)
result = chat_with_tools(
message="Gmail email management",
filter_type="bm25"
)
# Semantic filtering
result = chat_with_tools(
message="Help me be productive",
filter_type="local_embedding"
)
# No filtering - all tools
result = chat_with_tools(
message="What can you do?",
enable_filtering=False
)
```
```typescript TypeScript
import { chatWithTools } from "@observee/agents";
const result = await chatWithTools("Gmail email management", {
filter_type: "bm25"
});
console.log(result.content);
```
## Conversation Features
### Conversation History
```python Python
from observee_agents import chat_with_tools_stream, get_conversation_history
# Create a conversation with memory
async for chunk in chat_with_tools_stream(
message="Search my emails",
session_id="my_assistant",
provider="anthropic"
):
# Handle response...
# Follow-up - remembers context!
async for chunk in chat_with_tools_stream(
message="Summarize the first email you found",
session_id="my_assistant" # Same session = memory
):
# Handle response...
# Check conversation history
history = get_conversation_history("my_assistant")
print(f"Conversation has {len(history)} messages")
```
```typescript TypeScript
import { chatWithToolsStream, getConversationHistory } from "@observee/agents";
for await (const chunk of chatWithToolsStream("Search my emails", {
provider: "anthropic"
})) {
if (chunk.type === "content") {
console.log(chunk.content);
}
}
const history = await getConversationHistory("my_assistant");
console.log(`Conversation has ${history.length} messages`);
```
### Streaming with Conversation History
```python Python
import asyncio
from observee_agents import chat_with_tools_stream, get_conversation_history
async def conversational_streaming():
session_id = "streaming_assistant"
custom_prompt = "You are a helpful assistant. Stream responses naturally."
print("π¬ First streaming message:")
async for chunk in chat_with_tools_stream(
message="Search for emails about meetings",
provider="anthropic",
session_id=session_id, # π Session for memory
system_prompt=custom_prompt, # π Custom system prompt
observee_api_key=os.getenv("OBSERVEE_API_KEY")
):
if chunk["type"] == "content":
print(chunk["content"], end="", flush=True)
elif chunk["type"] == "tool_result":
print(f"\nπ§ [Tool: {chunk['tool_name']}]")
elif chunk["type"] == "done":
print(f"\nβ
Session: {chunk.get('session_id')}")
print("\n" + "="*40 + "\n㪠Follow-up streaming (remembers context):")
async for chunk in chat_with_tools_stream(
message="What was the subject of the first meeting?",
session_id=session_id, # Same session = memory!
observee_api_key=os.getenv("OBSERVEE_API_KEY")
):
if chunk["type"] == "content":
print(chunk["content"], end="", flush=True)
elif chunk["type"] == "final_content":
print(chunk["content"], end="", flush=True)
# Check conversation history
history = get_conversation_history(session_id)
print(f"\nπ Total messages in conversation: {len(history)}")
asyncio.run(conversational_streaming())
```
### Custom System Prompts
```python Python
# Create specialized assistants
result = chat_with_tools(
message="Help me organize my tasks",
system_prompt="You are an expert productivity coach. Focus on actionable advice.",
provider="anthropic"
)
# Different assistant for different tasks
result = chat_with_tools(
message="Analyze this data",
system_prompt="You are a data scientist. Provide technical insights.",
provider="anthropic"
)
```
### Custom Configuration
```python Python
result = chat_with_tools(
message="Creative writing task",
provider="openai",
temperature=0.9,
max_tokens=2000,
max_tools=10
)
```
## Next Steps
* [Tool Management](/agentsdk/tools)
* [Configuration](/agentsdk/configuration)
* [Examples](/agentsdk/examples)
# Configuration
Source: https://docs.observee.ai/agentsdk/configuration
Configuration options for the Observee Agents SDK
## Environment Variables
### Required
```bash
# Observee Configuration
OBSERVEE_API_KEY=obs_your_api_key_here
OBSERVEE_CLIENT_ID=your_client_id_here # Optional
# LLM Provider Keys (choose one or more)
ANTHROPIC_API_KEY=your_anthropic_key_here
OPENAI_API_KEY=your_openai_key_here
GOOGLE_API_KEY=your_gemini_key_here
```
### Optional
```bash
# Tool filtering
MCP_FILTER_TYPE=bm25 # bm25, local_embedding, cloud
# Cloud filtering (if using cloud filter)
PINECONE_API_KEY=your_pinecone_key_here
```
## Function Parameters
All configuration can be passed as function parameters:
```python
from observee_agents import chat_with_tools
result = chat_with_tools(
message="Hello",
# Provider settings
provider="anthropic",
model="claude-sonnet-4-20250514",
# Authentication
observee_api_key="obs_your_key",
client_id="custom_client_123",
# Tool filtering
enable_filtering=True,
filter_type="bm25",
max_tools=10,
min_score=7.0,
# Performance
sync_tools=False,
# LLM parameters
temperature=0.7,
max_tokens=1000,
top_p=0.9
)
```
## Provider-Specific Settings
### Anthropic Claude
```python
result = chat_with_tools(
message="Hello",
provider="anthropic",
model="claude-sonnet-4-20250514",
temperature=0.7,
max_tokens=1000,
top_p=0.9,
top_k=40
)
```
### OpenAI GPT
```python
result = chat_with_tools(
message="Hello",
provider="openai",
model="gpt-4o",
temperature=0.7,
max_tokens=1000,
top_p=0.9,
frequency_penalty=0.0,
presence_penalty=0.0
)
```
### Google Gemini
```python
result = chat_with_tools(
message="Hello",
provider="gemini",
model="gemini-2.5-pro",
temperature=0.7,
max_tokens=1000,
top_p=0.9,
top_k=40
)
```
## Tool Filtering Configuration
### BM25 Filter (Default)
```python
result = chat_with_tools(
message="Gmail email management",
filter_type="bm25",
max_tools=5,
min_score=8.0
)
```
### Local Embedding Filter
```python
# Requires: pip install mcp-agents[embedding]
result = chat_with_tools(
message="Help me be productive",
filter_type="local_embedding",
max_tools=10,
min_score=7.0
)
```
### Cloud Filter
```python
# Requires: pip install mcp-agents[cloud]
# Requires: PINECONE_API_KEY and OPENAI_API_KEY
result = chat_with_tools(
message="Complex analytical task",
filter_type="cloud",
max_tools=15,
min_score=6.0
)
```
### Disable Filtering
```python
result = chat_with_tools(
message="What can you do?",
enable_filtering=False # Uses all available tools
)
```
## Next Steps
* [Examples](/agentsdk/examples)
* [Tool Management](/agentsdk/tools)
* [Chat Interface](/agentsdk/chat)
# null
Source: https://docs.observee.ai/agentsdk/installation
# Installation
## Prerequisites
* Python or TypeScript
* An Observee account at [observee.ai](https://observee.ai)
* API keys for your preferred LLM provider
## Install the SDK
```bash Python
# Basic installation
pip install mcp-agents
# With optional dependencies
pip install mcp-agents[embedding,cloud,dev]
# With MCP Logger
pip install observee
```
```bash TypeScript
npm install @observee/agents
```
## Get Your API Keys
### 1. Observee API Key
1. Visit [observee.ai](https://observee.ai)
2. Sign up or log in
3. Navigate to API Keys
4. Create a new API key (starts with `obs_`)
### 2. LLM Provider Keys
Choose your preferred provider:
* **Anthropic**: [console.anthropic.com](https://console.anthropic.com)
* **OpenAI**: [platform.openai.com](https://platform.openai.com)
* **Google**: [makersuite.google.com](https://makersuite.google.com/app/apikey)
## Environment Setup
Create a `.env` file:
```bash
# Required
OBSERVEE_API_KEY=obs_your_api_key_here
# Choose your LLM provider
ANTHROPIC_API_KEY=your_anthropic_key_here
OPENAI_API_KEY=your_openai_key_here
GOOGLE_API_KEY=your_gemini_key_here
```
## Test Installation
```python Python
from observee_agents import chat_with_tools
try:
result = chat_with_tools(
message="Hello! What tools do you have?",
provider="anthropic",
observee_api_key="obs_your_key_here"
)
print("β
Installation successful!")
print(f"Response: {result['content']}")
except Exception as e:
print(f"β Installation issue: {e}")
```
```typescript TypeScript
import { chatWithTools } from "@observee/agents";
try {
const result = await chatWithTools("Hello! What tools do you have?", {
provider: "anthropic",
observeeApiKey: "obs_your_key_here"
});
console.log("β
Installation successful!");
console.log(`Response: ${result.content}`);
} catch (e) {
console.log(`β Installation issue: ${e}`);
}
```
## Next Steps
* [Configuration](/agentsdk/configuration)
* [Quick Start](/quickstartmcpuse)
* [Examples](/agentsdk/examples)
# Overview
Source: https://docs.observee.ai/agentsdk/overview
Seamless integration of MCP (Model Context Protocol) tools with multiple LLM providers.
## What is it?
Observee Agents connects your Python applications to 3000+ tools through a simple API. It works with Anthropic Claude, OpenAI GPT, and Google Gemini.
## Key Features
* **π€ Multi-Provider Support**: Anthropic, OpenAI, and Gemini
* **π§ 1000+ Tools**: Gmail, YouTube, Linear, Slack, Notion, and more
* **β‘ Smart Filtering**: Automatically finds relevant tools
* **π OAuth Integration**: Built-in authentication for popular services
* **π‘ Streaming Support**: Real-time responses
* **π― Simple API**: Easy to use and integrate
## Documentation
* [**Installation**](/agentsdk/installation) - Set up the SDK
* [**Authentication**](/agentsdk/authentication) - Configure API keys and OAuth
* [**Chat with Tools**](/agentsdk/chat-with-tools) - Main conversation interface
* [**Tool Management**](/agentsdk/tools) - Discover and execute tools
* [**Streaming**](/agentsdk/streaming) - Real-time responses
* [**Examples**](/agentsdk/examples) - Practical code examples
* [**Configuration**](/agentsdk/configuration) - Advanced settings
## Support
* **π¬ Discord**: [Join our community](https://discord.gg/jnf8yHWJ)
* **π§ Email**: [contact@observee.ai](mailto:contact@observee.ai)
# Tool Management
Source: https://docs.observee.ai/agentsdk/tools
Discover, filter, and execute tools directly.
## List Available Tools
```python
from observee_agents import list_tools
tools = list_tools(observee_api_key="obs_your_key_here")
print(f"Found {len(tools)} tools")
for tool in tools[:5]: # Show first 5
print(f"- {tool['name']}: {tool['description']}")
```
## Filter Tools
Find relevant tools for specific tasks:
```python
from observee_agents import filter_tools
# Find email tools
email_tools = filter_tools(
query="email management",
max_tools=5,
observee_api_key="obs_your_key_here"
)
for tool in email_tools:
print(f"- {tool['name']} (score: {tool['relevance_score']})")
```
## Get Tool Information
```python
from observee_agents import get_tool_info
tool_info = get_tool_info(
tool_name="youtube_get_transcript",
observee_api_key="obs_your_key_here"
)
if tool_info:
print(f"Tool: {tool_info['name']}")
print(f"Description: {tool_info['description']}")
print(f"Parameters: {tool_info['parameters']}")
```
## Execute Tools Directly
Run tools without LLM conversation:
```python
from observee_agents import execute_tool
result = execute_tool(
tool_name="youtube_get_transcript",
tool_input={"video_url": "https://youtube.com/watch?v=example"},
observee_api_key="obs_your_key_here"
)
print(result)
```
## Filter Types
### BM25 Filter (Default)
* **Speed**: β‘ 1-5ms
* **Best for**: Keyword matching, production use
* **Dependencies**: None
```python
tools = filter_tools(
query="gmail email",
filter_type="bm25"
)
```
### Local Embedding Filter
* **Speed**: β‘ 10ms
* **Best for**: Semantic search, offline use
* **Dependencies**: `pip install mcp-agents[embedding]`
```python
tools = filter_tools(
query="help me be productive",
filter_type="local_embedding"
)
```
### Cloud Filter
* **Speed**: π 300-400ms
* **Best for**: Highest accuracy
* **Dependencies**: `pip install mcp-agents[cloud]`
* **Requirements**: `PINECONE_API_KEY`, `OPENAI_API_KEY`
```python
tools = filter_tools(
query="complex analytical task",
filter_type="cloud"
)
```
## Available Tools
The SDK provides access to tools including:
* **π§ Gmail**: Email management, search, compose
* **π₯ YouTube**: Video transcript retrieval
* **π Linear**: Project management, issues
* **π¬ Slack**: Messaging, channels, files
* **π Notion**: Database queries, page creation
* **π Brave Search**: Web search
* **π
Google Calendar**: Event management
* **π Google Docs**: Document creation and editing
* **πΎ Google Drive**: File management
* **π Google Sheets**: Spreadsheet operations
* **And many more...**
## Examples
### Find Tools for Email
```python
email_tools = filter_tools(
query="email management gmail",
max_tools=3
)
for tool in email_tools:
print(f"π§ {tool['name']}: {tool['description']}")
```
### Find Tools for Content Creation
```python
content_tools = filter_tools(
query="youtube video transcript content",
max_tools=5
)
for tool in content_tools:
print(f"π₯ {tool['name']}: {tool['description']}")
```
### Execute Multiple Tools
```python
# Get YouTube transcript
transcript = execute_tool(
tool_name="youtube_get_transcript",
tool_input={"video_url": "https://youtube.com/watch?v=example"}
)
# Create Linear issue
issue = execute_tool(
tool_name="linear_create_issue",
tool_input={
"title": "Video Summary",
"description": transcript["result"]
}
)
```
## Custom Tools
Custom tools allow you to add your own functionality to the SDK without needing to create a full MCP server. They work seamlessly with all LLM providers and can be combined with existing MCP tools.
### Basic Usage
```python
from observee_agents import chat_with_tools_stream
import asyncio
# Define custom tool handler
async def custom_tool_handler(tool_name: str, tool_input: dict) -> str:
"""Handle custom tool executions"""
if tool_name == "add_numbers":
return str(tool_input.get("a", 0) + tool_input.get("b", 0))
elif tool_name == "get_time":
from datetime import datetime
return datetime.now().strftime("%I:%M %p")
else:
return f"Unknown tool: {tool_name}"
# Define custom tools in OpenAI format
custom_tools = [
{
"type": "function",
"function": {
"name": "add_numbers",
"description": "Add two numbers together",
"parameters": {
"type": "object",
"properties": {
"a": {"type": "number", "description": "First number"},
"b": {"type": "number", "description": "Second number"}
},
"required": ["a", "b"]
}
}
},
{
"type": "function",
"function": {
"name": "get_time",
"description": "Get the current time",
"parameters": {
"type": "object",
"properties": {}
}
}
}
]
# Use custom tools
async def example():
async for chunk in chat_with_tools_stream(
message="What's 5 + 3? Also, what time is it?",
provider="anthropic",
custom_tools=custom_tools,
custom_tool_handler=custom_tool_handler,
observee_api_key="obs_your_key_here"
):
if chunk["type"] == "content":
print(chunk["content"], end="", flush=True)
elif chunk["type"] == "tool_result":
print(f"\nπ§ [Tool: {chunk['tool_name']} = {chunk['result']}]")
asyncio.run(example())
```
### Tool Handler Function
The custom tool handler is an async function that receives:
* `tool_name`: The name of the tool being called
* `tool_input`: Dictionary of input parameters
It should return a string with the result.
```python
async def custom_tool_handler(tool_name: str, tool_input: dict) -> str:
if tool_name == "calculate_tax":
income = tool_input.get("income", 0)
rate = tool_input.get("rate", 0.2)
return str(income * rate)
elif tool_name == "fetch_weather":
# Implement weather fetching logic
city = tool_input.get("city", "Unknown")
return f"Weather in {city}: Sunny, 72Β°F"
else:
return f"Unknown tool: {tool_name}"
```
### Tool Definition Format
Custom tools use the OpenAI function calling format:
```python
{
"type": "function",
"function": {
"name": "tool_name",
"description": "What this tool does",
"parameters": {
"type": "object",
"properties": {
"param1": {
"type": "string",
"description": "Description of param1"
},
"param2": {
"type": "number",
"description": "Description of param2"
}
},
"required": ["param1"] # List of required parameters
}
}
}
```
### Combining Custom and MCP Tools
```python
# Custom tools work alongside MCP tools
async def combined_example():
async for chunk in chat_with_tools_stream(
message="Search for AI news and tell me what time it is",
provider="openai",
custom_tools=custom_tools, # Your custom tools
custom_tool_handler=custom_tool_handler,
enable_filtering=True, # MCP tools still available
observee_api_key="obs_your_key_here"
):
# Process response...
```
### Non-Streaming Usage
Custom tools also work with the synchronous API:
```python
from observee_agents import chat_with_tools
result = chat_with_tools(
message="Calculate 15 + 27",
provider="anthropic",
custom_tools=custom_tools,
custom_tool_handler=custom_tool_handler,
observee_api_key="obs_your_key_here"
)
print(result["content"])
```
### Common Use Cases
* **Business Logic**: Implement company-specific calculations or rules
* **API Wrappers**: Create simple wrappers for internal APIs
* **Data Processing**: Add custom data transformation tools
* **Prototyping**: Quickly test tool ideas before creating MCP servers
### Limitations
* Custom tools are local to your application
* They don't appear in `list_tools()` results
* No built-in authentication or permissions
* Limited to the OpenAI function format or when filtering=True
## Next Steps
* [Chat Interface](/agentsdk/chat)
* [Examples](/agentsdk/examples)
* [Configuration](/agentsdk/configuration)
# null
Source: https://docs.observee.ai/authsdk/authentication
## Auth SDK Setup
### Environment Variable Setup
Set your Observee API key as an environment variable:
```bash
export OBSERVEE_API_KEY="obs_your_api_key_here"
```
## OAuth Authentication Flow
### Step 1: Authenticate with a Service
Use the Auth SDK to authenticate with services like Gmail, Slack, etc. and get a client\_id:
```python Python
from observee_agents import call_mcpauth_login, get_available_servers
# See available services
servers = get_available_servers()
print(f"Available: {servers['supported_servers']}")
# Start authentication (optionally provide your own client_id)
response = call_mcpauth_login(
auth_server="gmail",
client_id="" # Optional: use your own UUID
)
print(f"Visit: {response['url']}")
# After authentication, you'll receive:
# {"success":true,"client_id":""}
```
```typescript TypeScript
import { callMcpauthLogin, getAvailableServers } from "@observee/agents";
// See available services
const servers = await getAvailableServers();
console.log(`Available: ${servers.supported_servers}`);
// Start authentication (optionally provide your own client_id)
const response = await callMcpAuthLogin({
authServer: "gmail",
clientId: "" // Optional: use your own UUID
});
console.log(`Visit: ${response.url}`);
// After authentication, you'll receive:
// {"success":true,"client_id":""}
```
### Step 2: Use the Client ID
After authentication, use the returned client\_id in your API calls. **Tools are automatically filtered based on which services you've authenticated with this client\_id.**
**Important:** You can reuse the same client\_id to authenticate multiple services. Each time you authenticate a new service with an existing client\_id, that client\_id gains access to the new service's tools while retaining access to previously authenticated services.
```python Python
from observee_agents import chat_with_tools
# Use the client_id from authentication
# Only Gmail tools will be available since we authenticated Gmail
result = chat_with_tools(
message="Check my Gmail inbox and summarize important emails",
provider="anthropic",
client_id="" # From Step 1
)
```
```typescript TypeScript
import { chatWithTools } from "@observee/agents";
// Use the client_id from authentication
// Only Gmail tools will be available since we authenticated Gmail
const result = await chatWithTools("Check my Gmail inbox and summarize important emails", {
provider: "anthropic",
clientId: "" // From Step 1
});
```
## Available Services
50+ services are supported including:
* **Email & Calendar**: Gmail, Google Calendar, Outlook
* **Productivity**: Google Docs, Google Sheets, Google Drive, OneDrive
* **Project Management**: Linear, Asana, Jira (Atlassian)
* **Communication**: Slack, Discord
* **Knowledge**: Notion, Airtable
* **Development**: GitHub, Supabase
* **And many more...**
### Check Authenticated Services
You can check which services are authenticated for a specific client\_id:
```python Python
from observee_agents import get_servers_by_client
# Check which services this client_id has access to
authenticated = get_servers_by_client(
client_id=""
)
print(f"Authenticated services: {authenticated['servers']}")
# Output: {"servers": ["gmail", "slack"]}
```
```typescript TypeScript
import { getServersByClient } from "@observee/agents";
// Check which services this client_id has access to
const authenticated = await getServersByClient({
clientId: ""
});
console.log(`Authenticated services: ${authenticated.servers}`);
// Output: {"servers": ["gmail", "slack"]}
```
## Multiple Service Authentication
**You can reuse the same client\_id to authenticate multiple services.** This allows you to access tools from different services with a single client\_id:
```python Python
# Option 1: Use the same client_id for multiple services
my_client_id = ""
# Authenticate Gmail
gmail_response = call_mcpauth_login(
auth_server="gmail",
client_id=my_client_id
)
# Authenticate Slack with the SAME client_id
slack_response = call_mcpauth_login(
auth_server="slack",
client_id=my_client_id # Reusing the same client_id
)
# Now this client_id has access to both Gmail AND Slack tools
result = chat_with_tools(
message="Check my emails and post a summary to Slack",
client_id=my_client_id # Can use both services!
)
# Option 2: Use different client_ids for separate sessions
# (Each client_id will only have access to its own authenticated services)
```
```typescript TypeScript
// Option 1: Use the same client_id for multiple services
const myClientId = "";
// Authenticate Gmail
const gmailResponse = await callMcpAuthLogin({
authServer: "gmail",
clientId: myClientId
});
// Authenticate Slack with the SAME client_id
const slackResponse = await callMcpAuthLogin({
authServer: "slack",
clientId: myClientId // Reusing the same client_id
});
// Now this client_id has access to both Gmail AND Slack tools
const result = await chatWithTools("Check my emails and post a summary to Slack", {
clientId: myClientId // Can use both services!
});
// Option 2: Use different client_ids for separate sessions
// (Each client_id will only have access to its own authenticated services)
```
## Troubleshooting
**Invalid API Key**: Check your key starts with `obs_`
**OAuth Failed**: Make sure you completed the authentication flow in your browser
**Permission Denied**: Check that you've authenticated the service for this client\_id
**Tool Not Found**: Ensure you've authenticated with the correct service
## Next Steps
* [Chat Interface](/agentsdk/chat)
* [Tool Management](/agentsdk/tools)
* [Examples](/examples/python/basic-usage)
# null
Source: https://docs.observee.ai/authsdk/installation
# Installation
## Prerequisites
* Python or TypeScript
* An Observee account at [observee.ai](https://observee.ai)
* API keys for your preferred LLM provider
## Install the SDK
```bash Python
# Basic installation
pip install agents-oauth
```
```bash TypeScript
npm install @observee/auth
```
## Get Your API Keys
### Observee API Key
1. Visit [observee.ai](https://observee.ai)
2. Sign up or log in
3. Navigate to API Keys
4. Create a new API key (starts with `obs_`)
## Environment Setup
Create a `.env` file:
```bash
# Required
OBSERVEE_API_KEY=obs_your_api_key_here
```
## Next Steps
* [Authentication Guide](/authsdk/authentication)
# null
Source: https://docs.observee.ai/authsdk/overview
# Observee Auth
A TypeScript SDK for seamless OAuth authentication with popular services including Gmail, Slack, Notion, and 50+ other platforms. Simplify your authentication workflows with built-in OAuth flows and secure token management.
**Configure and manage OAuth for any supported service at [observee.ai](https://observee.ai)**
## What You Can Do
The Observee Auth SDK enables you to:
* **π OAuth 2.0 Authentication**: Seamlessly authenticate with 50+ popular services
* **π Token Management**: Automatic token storage, refresh, and renewal
* **π‘οΈ Secure Flows**: Industry-standard OAuth 2.0 security practices
* **π Custom Redirects**: Support for custom redirect URLs in your applications
* **β‘ Simple Integration**: One-line authentication for any supported service
* **π Multi-Service Support**: Gmail, Slack, Notion, Linear, GitHub, and more
## Installation
```bash Python
pip install agents-oauth
```
```bash TypeScript
npm install @observee/auth
```
## Quick Start
Get started with OAuth authentication for your MCPs. See the [Authentication Guide](/authsdk/authentication) for detailed setup instructions and code examples.
# Python Examples
Source: https://docs.observee.ai/examples/python/basic-usage
Basic examples for common use cases in Python
## Email Management
```python
from observee_agents import chat_with_tools
# Check and summarize emails
result = chat_with_tools(
message="Check my Gmail inbox and summarize important emails from today",
provider="anthropic"
)
print(result["content"])
```
## YouTube Content Analysis
```python
# Get video transcript and analyze
result = chat_with_tools(
message="Get the transcript from this YouTube video and create a summary: https://youtube.com/watch?v=example",
provider="openai"
)
print(result["content"])
```
## Project Management
```python
# Create Linear issue
result = chat_with_tools(
message="Create a Linear issue titled 'Fix login bug' with description 'Users cannot login with Google OAuth'",
provider="gemini"
)
print(result["content"])
```
## Web Search
```python
# Search and analyze
result = chat_with_tools(
message="Search for the latest Python 3.12 features and explain the most important ones",
provider="anthropic"
)
print(result["content"])
```
## Streaming Example
```python
import asyncio
from observee_agents import chat_with_tools_stream
async def stream_example():
async for chunk in chat_with_tools_stream(
message="What's the weather like today?",
provider="anthropic",
observee_api_key="obs_your_key_here"
):
if chunk["type"] == "content":
print(chunk["content"], end="", flush=True)
elif chunk["type"] == "tool_result":
print(f"\nπ§ [Tool: {chunk['tool_name']}]")
asyncio.run(stream_example())
```
# Tool Usage
Source: https://docs.observee.ai/examples/python/tool-usage
Direct tool execution and discovery in Python
## Direct Tool Execution
```python
from observee_agents import execute_tool
# Get YouTube transcript directly
transcript = execute_tool(
tool_name="youtube_get_transcript",
tool_input={"video_url": "https://youtube.com/watch?v=example"}
)
# Search web directly
search_results = execute_tool(
tool_name="brave_search",
tool_input={"query": "Python 3.12 features"}
)
# Create Linear issue directly
issue = execute_tool(
tool_name="linear_create_issue",
tool_input={
"title": "New Feature Request",
"description": "Add dark mode support"
}
)
```
## Tool Discovery
```python
from observee_agents import filter_tools, list_tools
# List all available tools
all_tools = list_tools(observee_api_key="obs_your_key_here")
print(f"Found {len(all_tools)} tools")
for tool in all_tools[:5]: # Show first 5
print(f"- {tool['name']}: {tool['description']}")
```
## Filter Tools by Task
```python
from observee_agents import filter_tools
# Find productivity tools
productivity_tools = filter_tools(
query="productivity task management",
max_tools=5
)
for tool in productivity_tools:
print(f"π {tool['name']}: {tool['description']}")
# Find communication tools
comm_tools = filter_tools(
query="communication messaging slack email",
max_tools=3
)
for tool in comm_tools:
print(f"π¬ {tool['name']}: {tool['description']}")
# Find content creation tools
content_tools = filter_tools(
query="youtube video content creation",
max_tools=5
)
for tool in content_tools:
print(f"π₯ {tool['name']}: {tool['description']}")
```
## Get Tool Information
```python
from observee_agents import get_tool_info
# Get detailed info about a specific tool
tool_info = get_tool_info(
tool_name="youtube_get_transcript",
observee_api_key="obs_your_key_here"
)
if tool_info:
print(f"Tool: {tool_info['name']}")
print(f"Description: {tool_info['description']}")
print(f"Parameters: {tool_info['parameters']}")
```
# TypeScript Examples
Source: https://docs.observee.ai/examples/typescript/basic-usage
Basic examples for common use cases in TypeScript
## Email Management
```typescript
import { chatWithTools } from "@observee/agents";
// Check and summarize emails
const result = await chatWithTools({
message: "Check my Gmail inbox and summarize important emails from today",
provider: "anthropic"
});
console.log(result.content);
```
## YouTube Content Analysis
```typescript
// Get video transcript and analyze
const result = await chatWithTools({
message: "Get the transcript from this YouTube video and create a summary: https://youtube.com/watch?v=example",
provider: "openai"
});
console.log(result.content);
```
## Project Management
```typescript
// Create Linear issue
const result = await chatWithTools({
message: "Create a Linear issue titled 'Fix login bug' with description 'Users cannot login with Google OAuth'",
provider: "gemini"
});
console.log(result.content);
```
## Web Search
```typescript
// Search and analyze
const result = await chatWithTools({
message: "Search for the latest TypeScript 5.0 features and explain the most important ones",
provider: "anthropic"
});
console.log(result.content);
```
## Streaming Example
```typescript
import { chatWithToolsStream } from "@observee/agents";
try {
for await (const chunk of chatWithToolsStream({
message: "What's the weather like today?",
provider: "anthropic",
observeeApiKey: "obs_your_key_here"
})) {
if (chunk.type === "content") {
process.stdout.write(chunk.content);
} else if (chunk.type === "tool_result") {
console.log(`\nπ§ [Tool: ${chunk.toolName}]`);
}
}
} catch (e) {
console.log(`Error: ${e}`);
}
```
# Tool Usage
Source: https://docs.observee.ai/examples/typescript/tool-usage
Direct tool execution and discovery in TypeScript
## Direct Tool Execution
```typescript
import { executeTool } from "@observee/agents";
// Get YouTube transcript directly
const transcript = await executeTool({
toolName: "youtube_get_transcript",
toolInput: { videoUrl: "https://youtube.com/watch?v=example" }
});
// Search web directly
const searchResults = await executeTool({
toolName: "brave_search",
toolInput: { query: "TypeScript 5.0 features" }
});
// Create Linear issue directly
const issue = await executeTool({
toolName: "linear_create_issue",
toolInput: {
title: "New Feature Request",
description: "Add dark mode support"
}
});
```
## Tool Discovery
```typescript
import { listTools } from "@observee/agents";
// List all available tools
const allTools = await listTools({ observeeApiKey: "obs_your_key_here" });
console.log(`Found ${allTools.length} tools`);
allTools.slice(0, 5).forEach(tool => {
console.log(`- ${tool.name}: ${tool.description}`);
});
```
## Filter Tools by Task
```typescript
import { filterTools } from "@observee/agents";
// Find productivity tools
const productivityTools = await filterTools({
query: "productivity task management",
maxTools: 5
});
productivityTools.forEach(tool => {
console.log(`π ${tool.name}: ${tool.description}`);
});
// Find communication tools
const commTools = await filterTools({
query: "communication messaging slack email",
maxTools: 3
});
commTools.forEach(tool => {
console.log(`π¬ ${tool.name}: ${tool.description}`);
});
// Find content creation tools
const contentTools = await filterTools({
query: "youtube video content creation",
maxTools: 5
});
contentTools.forEach(tool => {
console.log(`π₯ ${tool.name}: ${tool.description}`);
});
```
## Get Tool Information
```typescript
import { getToolInfo } from "@observee/agents";
// Get detailed info about a specific tool
const toolInfo = await getToolInfo({
toolName: "youtube_get_transcript",
observeeApiKey: "obs_your_key_here"
});
if (toolInfo) {
console.log(`Tool: ${toolInfo.name}`);
console.log(`Description: ${toolInfo.description}`);
console.log(`Parameters: ${toolInfo.parameters}`);
}
```
# Observee SDK (MCP)
Source: https://docs.observee.ai/index
Enterprise-grade MCP integration platform for AI agents
Build AI agents with access to 1000+ tools through Model Context Protocol (MCP). Available for **Python** and **TypeScript**.
## What is Observee?
Observee provides the infrastructure to connect AI models with external tools and services through MCP. We handle the complex parts of tool integration so you can focus on building great AI applications.
### Key Features
* **π€ Multi-Provider Support** - Works with Anthropic Claude, OpenAI GPT, and Google Gemini
* **π§ 1000+ Tools** - Gmail, YouTube, Linear, Slack, Notion, GitHub, and more
* **β‘ Smart Tool Selection** - Automatically finds the right tools for each task
* **π Built-in Authentication** - OAuth flows handled automatically
* **π Enterprise Monitoring** - Track usage, costs, and performance
* **π‘οΈ Security First** - Tool injection prevention and PII protection
## Quick Start
* [**For MCP Users**](/mcpaiagents) - Start using 1000+ tools with your AI agents in 5 minutes
* [**For MCP Builders**](/quickstartmcpdev) - Add observability and analytics to your MCP servers
## SDK Components
### π€ Agents SDK
Connect AI models to MCP tools with a simple API. Supports streaming, conversation memory, and custom tools.
[Learn more β](/agentsdk/overview) β’ [npm](https://www.npmjs.com/package/@observee/agents) β’ [pypi](https://pypi.org/project/mcp-agents/)
### π Auth SDK
OAuth authentication for 50+ services with automatic token management and refresh.
[Learn more β](/authsdk/overview) β’ [npm](https://www.npmjs.com/package/@observee/auth) β’ [pypi](https://pypi.org/project/agents-oauth/)
### π Logger SDK
Enterprise logging and monitoring for MCP servers. Track every interaction, monitor costs, and debug issues.
[Learn more β](/loggersdk/overview) β’ [npm](https://www.npmjs.com/package/@observee/logger) β’ [pypi](https://pypi.org/project/mcp-logger/)
## Who is this for?
* **AI Application Developers** - Build production-ready AI agents quickly
* **Enterprise Teams** - Secure, monitored AI tool access for your organization
* **MCP Server Builders** - Add professional logging and analytics to your servers
## Support
* **Discord**: [Join our community](https://discord.gg/jnf8yHWJ)
* **Email**: [contact@observee.ai](mailto:contact@observee.ai)
* **GitHub**: [observee-ai/observee](https://github.com/observee-ai/observee)
# Anthropic API
Source: https://docs.observee.ai/integrations/python/anthropic
Connect to Observee's MCP server directly using Anthropic's Python SDK
## Overview
The Anthropic Python SDK provides native support for MCP (Model Context Protocol) servers. This allows you to connect Claude directly to Observee's tool ecosystem without additional frameworks.
## Prerequisites
Before getting started, ensure you have:
* Python 3.8 or later installed
* Required packages installed:
```bash
pip install anthropic python-dotenv rich
```
* Your Observee client ID for identifying your customer
* Your Observee API key for authentication
* Anthropic API key
## Example
Connect Claude to Observee's MCP server and access all available tools:
```python
import anthropic
from rich import print
from dotenv import load_dotenv
import os
load_dotenv()
# Your Observee MCP server URL
# Replace {your_client_id} with your actual client ID from the Observee dashboard
url = 'https://mcp.observee.ai/mcp?client_id={your_client_id}'
client = anthropic.Anthropic()
# Create streaming response with MCP server connection
stream = client.beta.messages.create(
model="claude-sonnet-4-20250514",
max_tokens=1000,
messages=[{"role": "user", "content": "Check my latest email"}],
mcp_servers=[
{
"type": "url",
"url": url,
"name": "observee",
"authorization_token": "{observee_api_key}" # Replace with your API key
}
],
extra_headers={
"anthropic-beta": "mcp-client-2025-04-04"
},
stream=True
)
# Process the streaming response
print("Streaming response:")
for chunk in stream:
if chunk.type == "content_block_delta":
if chunk.delta.type == "text_delta":
print(chunk.delta.text, end="", flush=True)
elif chunk.type == "message_stop":
print("\n\nStream completed.")
break
print() # Final newline for clean output
```
## Learn More
* [Observee SDK Documentation](/agentsdk/overview)
* [Authentication Guide](/authsdk/authentication)
* [Contact Support](mailto:contact@observee.ai) or join our [Discord Community](https://discord.gg/jnf8yHWJ)
# CrewAI
Source: https://docs.observee.ai/integrations/python/crewai
Build AI agent crews with Observee tools using CrewAI
## Overview
CrewAI enables you to orchestrate multiple AI agents working together, and with the MCP Server Adapter, you can connect your crews to Observee's powerful tool ecosystem. This integration allows you to build sophisticated multi-agent systems that leverage Observee's tools for complex workflows.
## Prerequisites
Before getting started, ensure you have:
* Python 3.10 or later installed
* Required packages installed:
```bash
pip install crewai crewai-tools python-dotenv
```
* Your Observee client ID for identifying your customer
* Your Observee API key for authentication
* OpenAI API key (set as environment variable)
## Example
Connect your CrewAI agents to Observee's MCP server to access all available tools:
```python
import os
from dotenv import load_dotenv
from crewai import Agent, Task, Crew
from crewai_tools import MCPServerAdapter
# Load environment variables
load_dotenv()
# Streamable HTTP Server configuration for Observee
# Replace {your_client_id} with your actual client ID from the Observee dashboard
server_params = {
"url": "https://mcp.observee.ai/mcp?client_id={your_client_id}",
"transport": "streamable-http",
"headers": {
"Authorization": "Bearer {observee_api_key}" # Replace with your API key
}
}
# Example usage
with MCPServerAdapter(server_params) as mcp_tools:
print(f"Available tools: {[tool.name for tool in mcp_tools]}")
my_agent = Agent(
role="MCP Tool User",
goal="Utilize tools from an MCP server.",
backstory="I can connect to MCP servers and use their tools.",
tools=mcp_tools, # Pass the loaded tools to your agent
reasoning=True,
verbose=True
)
# Create a task to check email
email_task = Task(
description="Check my latest email",
expected_output="Details about the latest email including sender, subject, and a brief summary of the content",
agent=my_agent
)
# Create the crew
crew = Crew(
agents=[my_agent],
tasks=[email_task],
verbose=True
)
# Execute the crew
result = crew.kickoff()
print("\n--- Result ---")
print(result)
```
```
## Learn More
- [Observee SDK Documentation](/agentsdk/overview)
- [Authentication Guide](/authsdk/authentication)
- [Tool Management](/agentsdk/tools)
- [Other Python Integrations](/integrations/python/overview)
- [Contact Support](mailto:contact@observee.ai) or join our [Discord Community](https://discord.gg/jnf8yHWJ)
```
# LangChain
Source: https://docs.observee.ai/integrations/python/langchain
Connect Observee with LangChain using MCP adapters
## Overview
LangChain can connect to Observee's MCP (Model Context Protocol) server using the `langchain-mcp-adapters` package. This enables your LangChain applications to access Observee's tool ecosystem through the familiar LangChain interface.
## Prerequisites
Before getting started, ensure you have:
* Python 3.10 or later installed
* Required packages installed:
```bash
pip install langchain-mcp-adapters langgraph langchain
```
* Your Observee client ID for identifying your customer
* Your Observee API key for authentication
* OpenAI API key or other LLM provider credentials
## Example: Creating a React Agent with Observee Tools
This example shows how to create a simple React agent that can use tools from your Observee MCP server:
```python
from langchain_mcp_adapters.client import MultiServerMCPClient
from langgraph.prebuilt import create_react_agent
# Configure the MCP client to connect to Observee
# Replace {your_client_id} with your actual client ID from the Observee dashboard
client = MultiServerMCPClient(
{
"observee": {
"transport": "streamable_http",
"url": "https://mcp.observee.ai/mcp?client_id={your_client_id}",
"headers": {
"Authorization": "Bearer {observee_api_key}" # Replace with your API key
},
}
}
)
# Get all available tools from Observee
tools = await client.get_tools()
# Create a React agent with the tools
agent = create_react_agent("openai:gpt-4.1", tools)
# Use the agent - it will automatically use appropriate Observee tools
response = await agent.ainvoke({
"messages": "check my latest emails and add to my sheets"
})
print(response)
```
## Learn More
* [LangGraph Integration](/integrations/python/langgraph)
* [Observee SDK Documentation](/agentsdk/overview)
* [Authentication Guide](/authsdk/authentication)
* [Tool Management](/agentsdk/tools)
* [Contact Support](mailto:contact@observee.ai) or join our [Discord Community](https://discord.gg/jnf8yHWJ)
# LangGraph
Source: https://docs.observee.ai/integrations/python/langgraph
Build stateful agents with Observee tools using LangGraph
## Overview
LangGraph enables you to build complex, stateful agents that can use Observee's MCP tools. This integration combines LangGraph's powerful graph-based agent architecture with Observee's tool ecosystem.
## Prerequisites
Before getting started, ensure you have:
* Python 3.10 or later installed
* Required packages installed:
```bash
pip install langchain-mcp-adapters langgraph langchain langchain-openai
```
* Your Observee client ID for identifying your customer
* Your Observee API key for authentication
* OpenAI API key or other LLM provider credentials
## Example: Building a Stateful Agent with Observee Tools
This example demonstrates how to create a LangGraph agent that maintains state across interactions while using Observee tools:
```python
from langchain_mcp_adapters.client import MultiServerMCPClient
from langgraph.graph import StateGraph, MessagesState, START
from langgraph.prebuilt import ToolNode, tools_condition
from langchain.chat_models import init_chat_model
# Initialize the chat model
model = init_chat_model("openai:gpt-4")
# Configure the MCP client to connect to Observee
# Replace {your_client_id} with your actual client ID from the Observee dashboard
client = MultiServerMCPClient(
{
"observee": {
"url": "https://mcp.observee.ai/mcp?client_id={your_client_id}",
"transport": "streamable_http",
"headers": {
"Authorization": "Bearer {observee_api_key}" # Replace with your API key
},
}
}
)
# Get all available tools from Observee
tools = await client.get_tools()
# Define the model calling function
def call_model(state: MessagesState):
response = model.bind_tools(tools).invoke(state["messages"])
return {"messages": response}
# Build the state graph
builder = StateGraph(MessagesState)
builder.add_node("call_model", call_model)
builder.add_node("tools", ToolNode(tools))
builder.add_edge(START, "call_model")
builder.add_conditional_edges(
"call_model",
tools_condition,
)
builder.add_edge("tools", "call_model")
# Compile the graph
graph = builder.compile()
# Use the agent - it maintains state across interactions
response1 = await graph.ainvoke({
"messages": "Check my latest system metrics"
})
# Follow-up question uses the context from the previous interaction
response2 = await graph.ainvoke({
"messages": "Based on those metrics, are there any issues I should address?"
})
```
## Learn More
* [LangChain Integration](/integrations/python/langchain)
* [Observee SDK Documentation](/agentsdk/overview)
* [Authentication Guide](/authsdk/authentication)
* [Tool Management](/agentsdk/tools)
* [Contact Support](mailto:contact@observee.ai) or join our [Discord Community](https://discord.gg/jnf8yHWJ)
# OpenAI SDK (Python)
Source: https://docs.observee.ai/integrations/python/openai-sdk
Connect Observee with OpenAI's Python SDK using the agents library
## Overview
The OpenAI Python SDK can connect to Observee's MCP (Model Context Protocol) server using the `agents` library. This enables your Python-based agents to access Observee's powerful tool ecosystem, integrate with internal or external APIs, and leverage custom knowledge sources through a unified interface.
## Prerequisites
Before getting started, ensure you have:
* Python 3.10 or later installed
* Required packages installed:
```bash
pip install openai agents python-dotenv
```
* Your Observee client ID for identifying your customer
* Your Observee API key for authentication
* OpenAI API key
## Example: Connecting an Agent to Observee's MCP Server
Below is a complete example of how to set up an Agent that communicates with your Observee MCP server using Python:
```python
import asyncio
from agents import Agent, Runner, set_default_openai_client
from agents.mcp import MCPServerStreamableHttp
from openai import AsyncOpenAI
from openai.types.responses import ResponseTextDeltaEvent
import os
from dotenv import load_dotenv
load_dotenv()
async def main():
# Set up OpenAI client
client = AsyncOpenAI(api_key=os.getenv('OPENAI_API_KEY'))
set_default_openai_client(client)
# Instantiate the MCP server connection to Observee
# Replace {your_client_id} with your actual client ID from the Observee dashboard
mcp_server = MCPServerStreamableHttp(
name='Observee',
params={
'url': 'https://mcp.observee.ai/mcp?client_id={your_client_id}',
'headers': {
'Authorization': 'Bearer {observee_api_key}' # Replace with your API key
}
}
)
# Create the Agent and register the MCP server
agent = Agent(
name='Observee Agent',
instructions='Use all available tools and knowledge to help users with their requests.',
mcp_servers=[mcp_server]
)
try:
# Use MCP server as async context manager
async with mcp_server:
# Example query with streaming - the Agent will use appropriate Observee tools
result = Runner.run_streamed(
agent,
'check my latest emails'
)
# Stream the response as it comes
async for event in result.stream_events():
if event.type == "raw_response_event" and isinstance(event.data, ResponseTextDeltaEvent):
print(event.data.delta, end="", flush=True)
print() # Final newline
except Exception as error:
print(f'Connection failed: {error}')
# Check your client ID, API key, and network connection
if __name__ == "__main__":
asyncio.run(main())
```
## Environment Setup
Create a `.env` file with your credentials:
```bash
OPENAI_API_KEY=your_openai_api_key_here
```
## Learn More
* [Observee SDK Documentation](/agentsdk/overview)
* [Authentication Guide](/authsdk/authentication)
* [Tool Management](/agentsdk/tools)
* [TypeScript OpenAI SDK Integration](/integrations/typescript/openai-sdk)
* [Contact Support](mailto:contact@observee.ai) or join our [Discord Community](https://discord.gg/jnf8yHWJ)
# Vercel AI SDK
Source: https://docs.observee.ai/integrations/typescript/ai-sdk
Connect Observee with Vercel's AI SDK
## Overview
The Vercel AI SDK can be seamlessly integrated with Observee to enable your applications to access Observee's powerful tool ecosystem and custom MCP (Model Context Protocol) servers. This allows you to combine advanced LLMs, streaming, and tool use in a unified developer experience.
## Prerequisites
Before getting started, ensure you have:
* Node.js 18 or later installed
* Required packages installed:
```bash
npm install ai @modelcontextprotocol/sdk
npm install openai # or your preferred provider
```
* Your Observee client ID (from Observee Dashboard)
* Your Observee API key for authentication
* OpenAI or any LLM API key
## Example: Connecting to an MCP Server with the AI SDK
Below is a complete example of how to connect to an MCP server using the Vercel AI SDK:
```ts
import {
experimental_createMCPClient as createMCPClient,
streamText,
} from 'ai';
import { openai } from '@ai-sdk/openai';
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp';
async function main() {
try {
// Define your MCP server endpoint
// Replace {your_client_id} with your actual client ID from the Observee dashboard
const url = new URL('https://mcp.observee.ai/mcp?client_id={your_client_id}');
// Create the MCP client with authentication
const mcpClient = await createMCPClient({
transport: new StreamableHTTPClientTransport(url, {
requestInit: {
headers: {
'Authorization': 'Bearer {observee_api_key}' // Replace with your API key
}
}
})
});
// Discover available tools from the MCP server
const tools = await mcpClient.tools();
console.log(`Connected to MCP server with ${Object.keys(tools).length} tools available`);
// Use the tools in a streaming LLM call
const result = await streamText({
model: openai('gpt-4-turbo'),
tools, // Pass the discovered tools to streamText
prompt: 'Help me analyze the latest system metrics and provide insights',
maxTokens: 1000,
});
// Handle the streaming response
for await (const textPart of result.textStream) {
process.stdout.write(textPart);
}
// Always close the client when done
await mcpClient.close();
} catch (error) {
console.error('MCP Integration failed:', error);
// Common error scenarios:
if (error.message.includes('404')) {
console.log('Check your client ID and ensure the MCP server is deployed');
} else if (error.message.includes('authentication')) {
console.log('Verify your API key and authentication configuration');
}
}
}
main().catch(console.error);
```
## Learn More
* [Observee SDK Documentation](/agentsdk/overview)
* [Authentication Guide](/agentsdk/authentication)
* [Tool Management](/agentsdk/tools)
* [Contact Support](mailto:contact@observee.ai) or join our [Discord Community](https://discord.gg/jnf8yHWJ)
# Mastra SDK
Source: https://docs.observee.ai/integrations/typescript/mastra
Integrate Mastra with Model Context Protocol (MCP) and Observee for powerful tool and agent orchestration.
## Prerequisites
If you haven't already, install the Mastra MCP package:
```bash
npm install @mastra/mcp@latest
```
***
## Connecting Mastra to Observee's MCP Server
You can connect your Mastra agent to Observee's secure, enterprise-ready MCP servers to access all your Observee-managed tools, agents, and workflows.
First, configure the `MCPClient` to point to your Observee MCP endpoint. You can find your `{your_client_id}` and generate an API key in the Observee dashboard.
```ts
import { MCPClient } from "@mastra/mcp";
const mcpClient = new MCPClient({
servers: {
observee: {
url: new URL("https://mcp.observee.ai/mcp?client_id={your_client_id}"), // Replace with your client ID
requestInit: {
headers: {
Authorization: "Bearer {observee_api_key}", // Replace with your API key
},
},
},
},
});
```
### Using Tools from Observee
Once the client is configured, you can fetch tools for your agent. Mastra supports two patterns:
#### 1. Static Tools
For simple scripts or single-user applications, fetch all tools once and initialize the agent with them.
```ts
import { Agent } from "@mastra/core/agent";
// Fetch all available tools from Observee
const tools = await mcpClient.getTools();
// Create your agent with the static toolset
const agent = new Agent({
tools,
// ...other agent config
});
// Use the agent to handle user prompts
const response = await agent.generate("Summarize the latest sales data");
console.log(response);
```
#### 2. Dynamic Toolsets
For multi-tenant applications or when credentials change per-request, create a new MCP client for each request and pass the toolsets dynamically.
```ts
import { Agent } from "@mastra/core/agent";
async function handleUserRequest(userPrompt: string, userApiKey: string) {
// Create a client for the specific user's request
const userMcpClient = new MCPClient({
servers: {
observee: {
url: new URL("https://mcp.observee.ai/mcp?client_id={your_client_id}"),
requestInit: {
headers: {
Authorization: `Bearer ${userApiKey}`,
},
},
},
},
});
// Fetch toolsets dynamically
const toolsets = await userMcpClient.getToolsets();
const agent = new Agent({ /* ... */ });
const response = await agent.stream(userPrompt, { toolsets });
await userMcpClient.disconnect();
return response;
}
```
***
## Learn More
* [Observee SDK Documentation](/agentsdk/overview)
* [Authentication Guide](/agentsdk/authentication)
* [Tool Management](/agentsdk/tools)
* [Contact Support](mailto:contact@observee.ai) or join our [Discord Community](https://discord.gg/jnf8yHWJ)
# OpenAI SDK
Source: https://docs.observee.ai/integrations/typescript/openai-sdk
Connect Observee with OpenAI SDK
## Overview
The OpenAI SDK allows you to connect your Agent directly to an Observee MCP (Model Context Protocol) server. This enables your Agent to access Observee's powerful tool ecosystem, integrate with internal or external APIs, and leverage custom knowledge sourcesβall through a unified, secure interface.
## Prerequisites
Before getting started, ensure you have:
* Node.js 18 or later installed
* The OpenAI SDK installed: `npm install @openai/agents`
* Your Observee client ID (found in your Observee dashboard)
* Your Observee API key for authentication
## What is MCPServerStreamableHttp?
`MCPServerStreamableHttp` is a class provided by the OpenAI SDK for connecting to any HTTP MCP server. It manages the connection, streaming, and communication between your Agent and the server, supporting real-time, tool-augmented LLM responses. Once connected, your Agent automatically discovers and can use all available tools from the MCP server.
## Example: Connecting an Agent to Observee's MCP Server
Below is a complete example of how to set up an Agent that communicates with your Observee MCP server:
```ts
import { Agent, run, MCPServerStreamableHttp } from '@openai/agents';
async function main() {
// Instantiate the MCP server connection to Observee
// Replace {your_client_id} with your actual client ID from the Observee dashboard
const mcpServer = new MCPServerStreamableHttp({
url: 'https://mcp.observee.ai/mcp?client_id={your_client_id}',
name: 'Observee MCP Server',
requestInit: {
headers: {
'Authorization': 'Bearer {observee_api_key}' // Replace with your API key
}
}
});
// Create the Agent and register the MCP server
// The Agent will automatically discover and use all available tools from Observee
const agent = new Agent({
name: 'Observee Agent',
instructions: 'Use all available tools and knowledge to help users with their requests.',
mcpServers: [mcpServer],
});
try {
await mcpServer.connect();
// Example query - the Agent will use appropriate Observee tools to answer
const result = await run(agent, 'Help me analyze the latest data from our monitoring system');
console.log(result.finalOutput);
} catch (error) {
console.error('Connection failed:', error);
// Check your client ID, API key, and network connection
} finally {
await mcpServer.close();
}
}
main().catch(console.error);
```
## Learn More
* [Observee SDK Documentation](/agentsdk/overview)
* [Authentication Guide](/agentsdk/authentication)
* [Tool Management](/agentsdk/tools)
* [Contact Support](mailto:contact@observee.ai) or join our [Discord Community](https://discord.gg/jnf8yHWJ)
# null
Source: https://docs.observee.ai/loggersdk/installation
# Installation
## Prerequisites
* Python or TypeScript
* An Observee account at [observee.ai](https://observee.ai)
* API keys for your preferred LLM provider
## Install the SDK
```bash Python
pip install mcp-logger
```
```bash TypeScript
npm install @observee/logger
```
# null
Source: https://docs.observee.ai/loggersdk/logging
## Usage
In your MCP server, you can add Observee's usage logger to track tool and prompt usage.
### Global Configuration
You can either use an API key or set a local file to store the logs.
### API Key configuration
```python Python
from observee import ObserveeConfig, observee_usage_logger
# Set the MCP server name globally
ObserveeConfig.set_mcp_server_name("your-mcp-server-name")
ObserveeConfig.set_api_key("your-api-key")
```
```typescript TypeScript
import { Logger, observeeUsageLogger } from "@observee/logger";
const logger = new Logger("your-server-name", {
apiKey: "your-api-key",
});
```
### Local File Configuration
```python Python
from observee import ObserveeConfig, observee_usage_logger
# Set the MCP server name globally
ObserveeConfig.set_mcp_server_name("your-mcp-server-name")
ObserveeConfig.set_local_storage(True, "your-log-file.log")
```
```typescript TypeScript
import { Logger, observeeUsageLogger } from "@observee/logger";
const logger = new Logger("your-server-name", {
logFile: "your-log-file.log",
});
```
### Usage
You can add the logger to your tool or prompt functions to ensure that the inputs and outputs for each tool or prompt are logged.
Note in TypeScript, you can just wrap the usage logger around the CallToolRequestSchema.
```python Python
# Auto-detection based on function name
@observee_usage_logger
async def your_tool_function():
# Your tool code here
pass
@observee_usage_logger
async def generate_prompt():
# Your prompt code here - auto-detected as prompt
pass
```
```typescript TypeScript
// For tool calls
server.setRequestHandler(
CallToolRequestSchema,
observeeUsageLogger(logger, async (request) => {
// your tool handler code here
})
);
// For prompt calls
server.setRequestHandler(
GetPromptRequestSchema,
observeeUsageLogger(logger, async (request) => {
// your prompt handler code here
})
);
```
## Features
* **Unified decorator** for both tool and prompt usage logging with async support
* **Auto-detection** of usage type based on function names (or explicit specification)
* Automatic logging of:
* Tool/prompt name
* Input parameters
* Response data
* Execution duration (for tools only)
* Error information (if any)
* Configurable logging endpoint (defaults to Observe API)
* Error handling and reporting
* Performance tracking (for tools only)
* Flexible MCP server name configuration
* API key support for enhanced features
* Privacy protection: Input/response data only logged when API key is provided
## Logging Details
### Unified Usage Logging
The SDK uses a single `@observee_usage_logger()` decorator that can automatically detect whether you're logging a tool or prompt based on the function name, or you can specify explicitly:
**Auto-detection**: Functions containing keywords like 'prompt', 'template', or 'message' in their name are detected as prompts. All others are treated as tools.
**Tool logging** includes:
* MCP server name
* Tool name (derived from function name)
* Tool input parameters (as JSON)
* Tool response
* Execution duration in milliseconds
* Any errors that occur during execution
**Prompt logging** includes:
* MCP server name
* Prompt name (derived from function name)
* Prompt input parameters (as JSON)
* Prompt response
* Any errors that occur during execution
### Privacy Protection
For privacy protection, detailed input and response data is only logged when an API key is configured. Without an API key, only basic metadata is logged:
* For tools: server name, tool name, and execution duration
* For prompts: server name and prompt name
Logs are sent asynchronously to avoid impacting tool/prompt performance.
# null
Source: https://docs.observee.ai/loggersdk/overview
# Observee SDK Logger
The Observee SDK Logger provides automatic logging capabilities for MCP (Model Context Protocol) servers, allowing you to track tool and prompt usage.
[Installation](/loggersdk/installation)
# Quickstart - Using MCPs in AI agents
Source: https://docs.observee.ai/mcpaiagents
Get up and running with Observee Agents in under 5 minutes
## Step 1: Get your API Keys and Set up Marketplace
Go to `https://app.observee.ai` and create an API key for your profile. Then click `Connect` and enable servers
### **Get Your API Keys**
1. **Observee API Key**: Sign up at [**observee.ai**](http://observee.ai) β API Keys β Create new key
2. **LLM API Key**: Get from [**Anthropic**](https://console.anthropic.com/), [**OpenAI**](https://platform.openai.com/), or [**Google**](https://aistudio.google.com/)
### **Environment Setup**
Create a `.env` file:
```shellscript
# Required
OBSERVEE_API_KEY=obs_your_api_key_here
# Choose one LLM provider
ANTHROPIC_API_KEY=your_key_here
OPENAI_API_KEY=your_key_here
GOOGLE_API_KEY=your_key_here
```
## Step 2: Authenticate & Get Your Client ID
This step is optional for those who are not setting up an OAuth server.
If you are using an OAuth server like Gmail, you can authenticate directly from our Auth SDK to get a client ID for accessing tools. Learn more at [Auth SDK Overview](/authsdk/overview).
**3.1 Install the Auth SDK**
```bash Python
pip install mcp-agents
```
```bash TypeScript
npm install @observee/auth
```
**3.2 Start the Auth flow for whichever OAuth Server you have enabled**
```python Python
from observee_agents import call_mcpauth_login
# Start authentication flow (optionally provide your own client_id)
response = call_mcpauth_login(
auth_server="gmail",
client_id="" # Optional: use your own UUID
)
print(f"Visit: {response['url']}")
# After you visit the URL and authenticate, you'll receive:
# {"success":true,"client_id":""}
```
```typescript TypeScript
import { callMcpAuthLogin } from "@observee/auth";
// Start authentication flow (optionally provide your own client_id)
const response = await callMcpAuthLogin({
authServer: "gmail",
clientId: "" // Optional: use your own UUID
});
console.log(`Visit: ${response.url}`);
// After you visit the URL and authenticate, you'll receive:
// {"success":true,"client_id":""}
```
This will open a browser window for OAuth authentication. After successful login, you'll receive a `client_id` that you'll use in all subsequent API calls. You can optionally provide your own UUID as the client\_id.
**Tip:** You can reuse the same client\_id to authenticate multiple services. Each service you authenticate adds its tools to that client\_id's available toolset.
## Step 3: Install the Agents SDK
```bash Python
pip install mcp-agents
```
```bash TypeScript
npm install @observee/agents
```
### Your First Tool-Powered Conversation
```python Python
from observee_agents import chat_with_tools
# Use the client_id from authentication
result = chat_with_tools(
message="Search for recent news about AI developments",
provider="anthropic",
client_id="" # Use the client_id from Step 2
)
print("π€ AI Response:", result["content"])
print("π§ Tools Used:", len(result["tool_calls"]))
```
```typescript TypeScript
import { chatWithTools } from "@observee/agents";
// Use the client_id from authentication
const result = await chatWithTools("Search for recent news about AI developments", {
provider: "anthropic",
clientId: "" // Use the client_id from Step 2
});
console.log("π€ AI Response:", result.content);
```
### Streaming Responses
```python Python
import asyncio
from observee_agents import chat_with_tools_stream
async def stream_example():
async for chunk in chat_with_tools_stream(
message="Check my emails and summarize them",
provider="anthropic"
):
if chunk["type"] == "content":
print(chunk["content"], end="", flush=True)
asyncio.run(stream_example())
```
```typescript TypeScript
import { chatWithToolsStream } from "@observee/agents";
for await (const chunk of chatWithToolsStream("Check my emails and summarize them", {
provider: "anthropic"
})) {
if (chunk.type === "content") {
process.stdout.write(chunk.content);
}
}
```
### Conversation with Memory
```python Python
# First message
result1 = chat_with_tools(
message="Search for emails about the product launch",
client_id="",
session_id="assistant_001"
)
# Follow-up (remembers context)
result2 = chat_with_tools(
message="What date was mentioned in those emails?",
client_id="",
session_id="assistant_001" # Same session = memory
)
```
π **Congratulations!** You can now:
1. **Connect to 1000+ tools** - Gmail, YouTube, Linear, Slack, and more
2. **Use multiple LLM providers** - Anthropic, OpenAI, Gemini and Groq
3. **Created conversations with memory** - Context preserved across messages
## Next Steps
* [**Examples**](/examples/python/basic-usage) - More code examples
* [**Agents SDK**](/agentsdk/overview) - Complete SDK reference
* [**Tool Management**](/agentsdk/tools) - Work with tools directly
* [**Configuration**](/agentsdk/configuration) - Advanced settings
## Need Help?
* π¬ [Discord Community](https://discord.gg/jnf8yHWJ)
* π§ [Email Support](mailto:contact@observee.ai)
# Observee (Ingestion + Actions)
Source: https://docs.observee.ai/observee
Data Ingestion and Action Engine
Our platform for data ingestion and taking actions is not self-serve. Please [book a demo](https://cal.com/observee/30min) with us today to learn more about how we can support your integrations.
# Connecting to Our MCP Server using HTTP
Source: https://docs.observee.ai/quickstartagentshttp
For those who want to use our API directly, please see this tutorial
Make sure you've gone to [https://app.observee.ai](https://app.observee.ai) to obtain your API keys before starting!
## MCP API Documentation
## cURL Commands
### 1. Initialize MCP Server
```bash
curl -X POST 'https://mcp.observee.ai/mcp' \
--header 'Authorization: Bearer YOUR_API_KEY_HERE' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json, text/event-stream' \
--data '{
"jsonrpc": "2.0",
"id": 0,
"method": "initialize",
"params": {
"protocolVersion": "2025-06-18",
"capabilities": {},
"clientInfo": {
"name": "observee-chat-client",
"version": "1.0.0"
}
}
}'
```
**Response Headers:**
* `mcp-session-id: `
* `content-type: text/event-stream`
### 2. Send Initialized Notification
```bash
curl -X POST 'https://mcp.observee.ai/mcp' \
--header 'Authorization: Bearer YOUR_API_KEY_HERE' \
--header 'mcp-session-id: SESSION_ID_FROM_INITIALIZE_RESPONSE' \
--header 'mcp-protocol-version: 2025-06-18' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json, text/event-stream' \
--data '{
"jsonrpc": "2.0",
"method": "notifications/initialized"
}'
```
### 3. List Tools
```bash
curl -X POST 'https://mcp.observee.ai/mcp' \
--header 'Authorization: Bearer YOUR_API_KEY_HERE' \
--header 'mcp-session-id: SESSION_ID_FROM_INITIALIZE_RESPONSE' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json, text/event-stream' \
--data '{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/list",
"params": {}
}'
```
### 4. Call Tool
```bash
curl -X POST 'https://mcp.observee.ai/mcp' \
--header 'Authorization: Bearer YOUR_API_KEY_HERE' \
--header 'mcp-session-id: SESSION_ID_FROM_INITIALIZE_RESPONSE' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json, text/event-stream' \
--data '{
"jsonrpc": "2.0",
"id": 3,
"method": "tools/call",
"params": {
"name": "TOOL_NAME_FROM_TOOLS_LIST",
"arguments": {
"param1": "value1",
"param2": "value2"
}
}
}'
```
#### Example: Gmail Search
```bash
curl -X POST 'https://mcp.observee.ai/mcp' \
--header 'Authorization: Bearer YOUR_API_KEY_HERE' \
--header 'mcp-session-id: SESSION_ID_FROM_INITIALIZE_RESPONSE' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json, text/event-stream' \
--data '{
"jsonrpc": "2.0",
"id": 4,
"method": "tools/call",
"params": {
"name": "Gmail__search_emails",
"arguments": {
"query": "from:user@example.com",
"maxResults": 2
}
}
}'
```
#### Example: Everything Calculator
```bash
curl -X POST 'https://mcp.observee.ai/mcp' \
--header 'Authorization: Bearer YOUR_API_KEY_HERE' \
--header 'mcp-session-id: SESSION_ID_FROM_INITIALIZE_RESPONSE' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json, text/event-stream' \
--data '{
"jsonrpc": "2.0",
"id": 5,
"method": "tools/call",
"params": {
"name": "Everything__add",
"arguments": {
"a": 5,
"b": 2
}
}
}'
```
> **π‘ Finding Tool Arguments:** Use the `/tools/list` endpoint first to get each tool's `inputSchema`. This schema defines the required and optional arguments for each tool, including their types, descriptions, and validation rules.
## Key Implementation Notes
### Authentication
* Uses Bearer token authentication with Observee API key
* Format: `Authorization: Bearer YOUR_API_KEY_HERE`
### Session Management
1. **Initialize** returns `mcp-session-id` in response headers
2. **Subsequent requests** must include this session ID as a header
3. Session IDs are UUIDs (e.g., `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`)
### Response Types
* **Initialize**: Returns `text/event-stream` (SSE) for real-time updates
* **Notifications**: Returns `202 Accepted` with empty body
* **Tool operations**: Return `application/json` with structured data
## McpAuth API - cURL Commands
### 1. Get Available Servers
Get a list of all supported authentication servers.
```bash
curl -X POST 'https://mcpauth.observee.ai/supported_servers' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
"OBSERVEE_API_KEY": "YOUR_API_KEY_HERE"
}'
```
**Expected Response:**
```json
{
"supportedServers": ["server1", "server2", "server3"]
}
```
### 2. Start Auth Flow (Basic)
Start an OAuth flow for a specific service without additional parameters.
```bash
curl -X POST 'https://mcpauth.observee.ai/enterprise//start' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
"OBSERVEE_API_KEY": "YOUR_API_KEY_HERE"
}'
```
### 3. Start Auth Flow (with Client ID)
Start an OAuth flow with a specific client ID passed as query parameter.
```bash
curl -X POST 'https://mcpauth.observee.ai/enterprise//start?client_id=YOUR_CLIENT_ID' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
"OBSERVEE_API_KEY": "YOUR_API_KEY_HERE"
}'
```
### 4. Start Auth Flow (with Custom Redirect URL)
Start an OAuth flow with a custom redirect URL.
```bash
curl -X POST 'https://mcpauth.observee.ai/enterprise//start' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
"OBSERVEE_API_KEY": "YOUR_API_KEY_HERE",
"CUSTOM_REDIRECT_URL": "https://your-app.com/auth/callback"
}'
```
### 5. Start Auth Flow (with Additional Parameters)
Start an OAuth flow with custom parameters for specific auth servers.
```bash
curl -X POST 'https://mcpauth.observee.ai/enterprise//start?client_id=YOUR_CLIENT_ID' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
"OBSERVEE_API_KEY": "YOUR_API_KEY_HERE",
"CUSTOM_REDIRECT_URL": "https://your-app.com/auth/callback",
"scopes": "custom-scope-here",
"workspace": "your-workspace"
}'
```
### Server Discovery
Replace `` in the auth flow URLs with any server name from the `supportedServers` array returned by the `/supported_servers` endpoint above.
### Expected Auth Flow Response
```json
{
"auth_url": "https://accounts.google.com/oauth/authorize?client_id=...",
"state": "random-state-string",
"expires_in": 3600,
"callback_url": "https://mcpauth.observee.ai/callback"
}
```
### Error Response Example
```json
{
"error": "Invalid API key",
"status": 401
}
```
### Usage Flow
1. **Get available servers** to see what services are supported
2. **Start auth flow** for your desired service
3. **Redirect user** to the `auth_url` from the response
4. **Handle callback** when user completes OAuth flow
5. **Use the authenticated credentials** in your MCP tools
### Notes
* All requests use `POST` method
* API key is always required in the request body as `OBSERVEE_API_KEY`
* Client ID is optional and passed as query parameter
* Custom parameters go in the request body
* The auth flow returns a URL where users complete OAuth authentication
# Quickstart - Adding Observability and Analytics to MCPs using Logger SDK
Source: https://docs.observee.ai/quickstartmcpdev
## 1. Installation
```bash Python
pip install mcp-logger
```
```bash TypeScript
npm install @observee/logger
```
## 2. Initialize the SDK within your main MCP server file
If you are an enterprise or an individual developer with an API key, you can pass it to the logger. This will enable you to see all input and response data from tools and prompts.
```python Python
from observee import ObserveeConfig, observee_usage_logger, observee_prompt_logger
# Set the MCP server name globally
ObserveeConfig.set_mcp_server_name("your-mcp-server-name")
# Optionally, if you have an API key, you can pass it to the logger.
ObserveeConfig.set_api_key("your-api-key")
```
```typescript TypeScript
import { Logger, observeeUsageLogger } from "@observee/sdk";
const loggerWithAPIKey = new Logger("your-mcp-server-name", {
apiKey: "your-api-key",
});
const loggerNoAPIKey = new Logger("your-mcp-server-name");
```
## 3. Add logging to tool calls.
In Python, you can add it to each individual tool call, or you can use the `observee_usage_logger` decorator to log all tool calls.
```python Python
@observee_usage_logger
async def your_tool_function():
# Your tool code here
pass
```
```typescript TypeScript
server.setRequestHandler(
CallToolRequestSchema,
observeeUsageLogger(logger, async (request) => {
// your handler code here
}))
```
## 4. Add logging to your prompt calls.
```python Python
@observee_prompt_logger
async def your_prompt_function():
# Your prompt code here
pass
```
```typescript TypeScript
server.setRequestHandler(
GetPromptRequestSchema,
observeeUsageLogger(logger, async (request) => {
// your handler code here
}))
```