Skip to content

About

Shared MCP servers and runtime for Dan's Slack-driven agents (fpa, cos, strategy, etc.)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

21 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

agent-tools

Shared MCP servers and standard runtime for Dan's Slack-driven agents.

Why this exists

All 11 agents (fpa, cos, strategy, revops, video, web, content-review, pmm, marketing-recruiter, social, ea) historically copy-pasted the same tool modules and run loop. Bugs got fixed in one repo and never made it to the others. Slack reliability suffered as a result.

This package centralizes:

  • Standard runtime (agent_tools.runtime): one wrapper around ClaudeSDKClient that every agent uses. Handles the agent loop, error-into-Slack hook, telemetry, memory injection, and the claude_code system-prompt preset.
  • Cost telemetry (agent_tools.cost_telemetry): the canonical per-call LLM cost emitter. Computes cost_usd from a per-MTok price table and captures an agent_llm_call PostHog event with the agent name as the dimension. Fire-and-forget, never raises. Agents on the runtime get it for free via AGENT_NAME (or the agent_name= argument).
  • MCP servers (agent_tools.slack, agent_tools.snowflake, agent_tools.notion, agent_tools.drive, agent_tools.google, ...): one canonical implementation per service, imported by every agent that needs it.
  • Smoke-test harness (agent_tools.smoke): pre-deploy probe that catches token expiry, schema drift, and MCP misconfiguration before users hit it in Slack.

Layout

agent_tools/
  runtime.py            # ClaudeSDKClient wrapper, run_ask() entry point
  cost_telemetry.py     # per-call LLM cost events -> PostHog (agent_llm_call)
  smoke.py              # smoke-test harness
  legacy.py             # wrap_legacy_tools(): flat TOOLS + dispatch -> one MCP server
  slack/
    client.py           # Slack API wrapper (lifted from fpa-agent-cloud)
    mcp.py              # MCP server: post_in_thread, list_channel_messages, get_thread
  snowflake/
    client.py           # Snowflake key-pair auth + query()
    mcp.py              # MCP server: snowflake_query
  notion/
    client.py           # Notion search/read/write helpers
    mcp.py              # MCP server: notion_search, notion_get_page, notion_query_database, notion_create_db_row, notion_update_page, notion_append_to_page, notion_replace_page_content
  drive/
    client.py           # Google Drive read-only via OAuth user token
    mcp.py              # MCP server: drive_search_files, drive_get_file_metadata, drive_read_file_content, drive_list_recent_files
  google/
    client.py           # Google REST client: GA4, Search Console, Tag Manager, YouTube (OAuth refresh token, ADC, or GOOGLE_API_KEY for public YouTube reads only)
    mcp.py              # MCP servers, one per product: ga4_server, gsc_server, gtm_server, youtube_server

Usage from an agent

from agent_tools.runtime import run_ask
from agent_tools.slack.mcp import slack_server
from agent_tools.snowflake.mcp import snowflake_server
from agent_tools.notion.mcp import notion_server
from agent_tools.drive.mcp import drive_server

SYSTEM_PROMPT = (Path(__file__).parent / "system_prompt.md").read_text()

def handle_slack_message(text, channel_id, thread_ts, thread_context=None):
    return run_ask(
        text=text,
        channel_id=channel_id,
        thread_ts=thread_ts,
        system_prompt_append=SYSTEM_PROMPT,
        mcp_servers={
            "slack": slack_server,
            "snowflake": snowflake_server,
            "notion": notion_server,
            "drive": drive_server,
        },
        thread_context=thread_context,
    )

Installation

This is a private package, not on PyPI. Each agent adds it to its requirements.txt as a git dependency:

agent-tools @ git+https://github.com/danstotts-ops/agent-tools.git@main

For local development, install in editable mode:

pip install -e ~/agent-tools

Environment variables

Each MCP server reads its own credentials from env. Agents must set these in .env (local) or Railway env (prod):

  • Slack: SLACK_BOT_TOKEN, SLACK_USER_TOKEN
  • Cost telemetry: AGENT_NAME (identity on the agent_llm_call event; without it the runtime skips emission). Optional: POSTHOG_PROJECT_API_KEY / POSTHOG_CAPTURE_URL override the embedded public capture token and endpoint; AGENT_COST_TELEMETRY_DISABLED=1 turns emission off.
  • Snowflake: SNOWFLAKE_ACCOUNT, SNOWFLAKE_USER, SNOWFLAKE_PRIVATE_KEY, SNOWFLAKE_PRIVATE_KEY_PASSPHRASE, SNOWFLAKE_ROLE, SNOWFLAKE_WAREHOUSE, SNOWFLAKE_DATABASE
  • Notion: NOTION_API_TOKEN
  • Drive: DRIVE_ACCESS_TOKEN, DRIVE_REFRESH_TOKEN, DRIVE_OAUTH_CLIENT_ID, DRIVE_OAUTH_CLIENT_SECRET

What's NOT here yet

These MCP servers will be added in subsequent phases as agents need them:

  • hubspot — HubSpot via Snowflake mirror (currently in fpa-agent-cloud)
  • posthog — PostHog product analytics (fpa, revops)
  • ramp — Ramp expense data (fpa, cos)
  • linkedin_ads — LinkedIn ads spend (fpa, social)
  • gong — Gong call transcripts (revops, marketing-recruiter)
  • fireflies — Fireflies meeting summaries (cos, ea)
  • gmail — Gmail read/draft (ea)
  • calendar — Google Calendar (ea, cos)
  • mode — Mode Analytics SQL pulls (revops, fpa)

The pattern is identical: lift the existing *_tools.py from whichever agent originally implemented it, drop it in agent_tools/<service>/client.py, write the mcp.py wrapper.

Status

Phase 1 (in progress). Foundation + slack/snowflake/notion/drive servers. fpa-agent will be the first agent migrated onto this package as proof-of-pattern; the rest follow in their own PRs.

Brand tokens (agent_tools.brand)

Runpod's colours, typefaces, weights and dark/light themes, read from the public brand.json instead of hard-coded hex codes. Same loader and rules as the marketing plugin's runpod-decks skill.

from agent_tools import brand
brand.BRAND["purple"]        # "#5D29F0", Runpod Purple
brand.BRAND["midnight"]      # "#000010", Runpod Black (there is no #000000)
brand.THEMES["dark"]["bg"]   # slide/page background for dark surfaces
brand.TYPEFACE               # primary family
brand.source_used()          # "brand", "s3", "github", "env" or "snapshot"

Resolution, first that loads wins: BRAND_JSON_PATH (local file), https://brand.runpod.io/brand.json, the same file from S3 (https://runpod-brand-json.s3.us-east-1.amazonaws.com/brand.json), the private raw GitHub URL when GITHUB_TOKEN is set, then the bundled brand.snapshot.json. Network reads are cached 24 hours; BRAND_JSON_OFFLINE=1 skips the network (tests should set it). Deprecated colours are never loaded. Refresh the snapshot from https://brand.runpod.io/brand.json when the canon changes.

About

Shared MCP servers and runtime for Dan's Slack-driven agents (fpa, cos, strategy, etc.)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages