<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Mark Holton on Medium]]></title>
        <description><![CDATA[Stories by Mark Holton on Medium]]></description>
        <link>https://medium.com/@markholton?source=rss-6d66f9bc5525------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*HuRIbLz_Lm9f0hVM.jpeg</url>
            <title>Stories by Mark Holton on Medium</title>
            <link>https://medium.com/@markholton?source=rss-6d66f9bc5525------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 18:28:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@markholton/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[AI Integration: Building Conversational Apps with MCP]]></title>
            <link>https://markholton.medium.com/ai-integration-building-conversational-apps-with-mcp-f47a487009f5?source=rss-6d66f9bc5525------2</link>
            <guid isPermaLink="false">https://medium.com/p/f47a487009f5</guid>
            <category><![CDATA[llm-applications]]></category>
            <category><![CDATA[claude]]></category>
            <category><![CDATA[model-context-protocol]]></category>
            <category><![CDATA[ai-integration]]></category>
            <category><![CDATA[pydantic]]></category>
            <dc:creator><![CDATA[Mark Holton]]></dc:creator>
            <pubDate>Sun, 22 Jun 2025 16:56:39 GMT</pubDate>
            <atom:updated>2025-06-22T16:56:39.151Z</atom:updated>
            <content:encoded><![CDATA[<p>Why This Matters: The Shift to Agentic AI</p><figure><img alt="Developer working at home office with visual connection between database app and Large Language Model (LLM)" src="https://cdn-images-1.medium.com/max/1024/1*3QCKmP6LyZB-VSFTMrE8FA.jpeg" /></figure><p>The software landscape is shifting toward agentic AI systems — applications where Large Language Models (LLMs) don’t just answer questions, but actively use tools to solve complex problems. Instead of building separate AI features, the market and industry are moving toward AI that can directly interact with your existing systems, databases, and workflows.</p><p>This creates a fundamental challenge: how do you expose your application’s capabilities to an LLM? How do you let Claude, for instance, query your database, analyze the results or trigger your business logic — all through natural conversation?</p><p>Enter the <a href="https://www.anthropic.com/news/model-context-protocol">Model Context Protocol (MCP), open-sourced by Anthropic in November 2024</a>. MCP provides a standardized way to connect any application to Claude (or other LLMs) through well-defined tools and protocols. Think of it as a bridge that lets your applications participate in AI conversations by exposing your functionality as tools.</p><p>This post walks through building a complete MCP integration — from a local FastAPI application with PostgreSQL (a personal “goal tracking” app) to a conversational interface where you can ask Claude to query your database, analyze trends, and even update records. You’ll see the practical patterns, common gotchas in setup, and why this approach represents a fundamental shift in how we build intelligent applications.</p><p>The goal isn’t just to add AI features to your app — it’s to make your entire application conversational and intelligent by design.</p><h3>The Magic of MCP: Apps Meet Conversational AI</h3><p>Building conversational AI interfaces has been unlocked thanks to Anthropic’s Model Context Protocol (MCP). In this post, I’ll walk you through creating a local FastAPI application with PostgreSQL that Claude can interact with directly through structured tools — your local app talking to Claude Desktop. This demonstrates the core MCP integration patterns, and because we’re running everything locally, we won’t get bogged down with API keys, authentication, or hosting complexities.</p><p>Imagine asking Claude: <em>“What goals do I have set up?”</em> and having it query your PostgreSQL database, return structured data, and provide intelligent insights — all through a simple conversation. That’s a surface-level glimpse of the power of MCP.</p><p>MCP bridges the gap between your applications and Claude’s conversational abilities by providing:</p><ul><li><strong>Structured tool definitions</strong> that Claude can discover and use</li><li><strong>Type-safe data exchange</strong> through JSON schemas</li><li><strong>Real-time conversations</strong> with your actual application data</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-IwFosjW2yWPRuK1Qkjd3g.png" /></figure><h3>Architecture Overview</h3><p>The stack here demonstrates a modern Python development pattern:</p><pre>Claude Desktop ↔ MCP Server ↔ FastAPI App ↔ PostgreSQL<br>                     ↕<br>               Pydantic Models (Type Safety)</pre><p><strong>Key Components:</strong></p><ul><li><strong>Pydantic Models</strong>: Define data structure and automatic validation</li><li><strong>SQLAlchemy</strong>: ORM for PostgreSQL with relationship management</li><li><strong>FastAPI</strong>: REST API with auto-generated OpenAPI docs</li><li><strong>MCP Server</strong>: Bridge between Claude and your application</li><li><strong>PostgreSQL</strong>: Robust relational database with JSON support</li></ul><h3>Project Structure</h3><pre>src/<br>├── core/<br>│   ├── models/         # Pydantic data models<br>│   ├── database/       # SQLAlchemy models and connection<br>│   ├── api/            # FastAPI routes and app<br>│   └── mcp/            # MCP server integration<br>│       ├── server.py   # Main MCP server<br>│       ├── tools.py    # Tool definitions for Claude<br>│       └── handlers.py # Tool implementation logic</pre><figure><img alt="Whimsical cartoon illustration of MCP as a colorful mechanical bridge connecting two worlds — organic conversational elements on the left and structured application blocks on the right" src="https://cdn-images-1.medium.com/max/1024/1*fSj6wtG1V4fdxTSeroiZKw.jpeg" /></figure><h3>Step 1: Pydantic Models for Type Safety</h3><p>Pydantic models serve as the single source of truth for your data structure:</p><pre>from pydantic import BaseModel, Field<br>from typing import List, Optional<br>from uuid import UUID<br>from datetime import datetime<br><br>class Goal(BaseModel):<br>    &quot;&quot;&quot;A specific, time-bound outcome to achieve.&quot;&quot;&quot;<br>    id: UUID = Field(default_factory=uuid4)<br>    title: str = Field(..., description=&quot;Clear, specific goal statement&quot;)<br>    progress_percentage: float = Field(default=0.0, ge=0.0, le=100.0)<br>    status: str = Field(default=&quot;active&quot;)<br>    created_at: datetime = Field(default_factory=datetime.utcnow)<br>class GoalWithMetrics(Goal):<br>    &quot;&quot;&quot;Goal with nested metrics for rich responses.&quot;&quot;&quot;<br>    metrics: List[Metric] = Field(default_factory=list)</pre><p><strong>Why this matters</strong>: These same models generate:</p><ul><li><strong>Database schemas</strong> (via SQLAlchemy)</li><li><strong>API documentation</strong> (via FastAPI)</li><li><strong>MCP tool schemas</strong> (for Claude integration)</li></ul><h3>Step 2: SQLAlchemy Database Models</h3><p>Map Pydantic models to database tables</p><p>This is the database layer that mirrors your Pydantic models. You’re defining the actual PostgreSQL table structure using SQLAlchemy’s ORM syntax.</p><p>The key pattern here is model mapping — your Goal Pydantic model becomes a GoalTable SQLAlchemy model with the same fields, but now with database-specific details like column types, constraints, and relationships.</p><p>The relationship(&quot;MetricTable&quot;, back_populates=&quot;goal&quot;) sets up the foreign key relationship so you can easily query goals with their associated metrics in one go.</p><p><strong>Why this matters</strong>: You now have type-safe data models (Pydantic) that automatically generate both your API schemas and your database tables (SQLAlchemy), keeping everything in sync without manual duplication.</p><pre>from sqlalchemy import Column, String, Float, DateTime<br>from sqlalchemy.dialects.postgresql import UUID as PGUUID<br><br>class GoalTable(Base):<br>    __tablename__ = &quot;goals&quot;<br>    <br>    id = Column(PGUUID(as_uuid=True), primary_key=True, default=uuid4)<br>    title = Column(String(200), nullable=False)<br>    progress_percentage = Column(Float, default=0.0)<br>    status = Column(String(20), default=&quot;active&quot;)<br>    created_at = Column(DateTime(timezone=True), server_default=func.now())<br>    <br>    # Relationships for complex queries<br>    metrics = relationship(&quot;MetricTable&quot;, back_populates=&quot;goal&quot;)</pre><p><strong>Database migrations</strong> with Alembic handle schema evolution:</p><pre># Generate migration from model changes<br>poetry run alembic revision --autogenerate -m &quot;Add goals table&quot;<br><br># Apply migrations<br>poetry run alembic upgrade head</pre><h3>Step 3: FastAPI Routes</h3><p>Create REST endpoints that return Pydantic models:</p><pre>from fastapi import FastAPI, Depends<br>from sqlalchemy.orm import Session<br><br>app = FastAPI(title=&quot;Your Local App&quot;)<br>@app.get(&quot;/goals&quot;, response_model=List[GoalWithMetrics])<br>async def get_goals(session: Session = Depends(get_session)):<br>    goals = session.query(GoalTable).all()<br>    <br>    # Convert SQLAlchemy to Pydantic with nested data<br>    return [<br>        GoalWithMetrics.model_validate({<br>            &quot;id&quot;: goal.id,<br>            &quot;title&quot;: goal.title,<br>            &quot;progress_percentage&quot;: goal.progress_percentage,<br>            &quot;status&quot;: goal.status,<br>            &quot;created_at&quot;: goal.created_at,<br>            &quot;metrics&quot;: [metric_to_dict(m) for m in goal.metrics]<br>        })<br>        for goal in goals<br>    ]</pre><h3>Step 4: MCP Tool Definitions</h3><p>Now we get to the fun part — defining tools that Claude can discover and use!</p><p>Here we are creating a “menu” of tools that tells Claude exactly what it can use from your application. Each tool definition is like a menu item that specifies:</p><ul><li><strong>The name</strong> — get_goals</li><li><strong>What it does</strong> — &quot;Get goals with their current progress&quot;</li><li><strong>What options</strong> are available — status_filter, include_metrics</li></ul><p>The inputSchema is the detailed specification of those options - it tells Claude &quot;you can filter by active, completed, or paused, and you can choose whether to include metrics (default is yes).&quot; When Claude sees this menu, it knows exactly how to &quot;order&quot; from your app: it can ask for goals, specify which status it wants, and decide whether it needs the extra metric details. This is the contract between Claude and your application - Claude knows what&#39;s possible, and your app knows what to expect:</p><pre>from mcp.types import Tool<br><br>def get_goals_tool() -&gt; Tool:<br>    &quot;&quot;&quot;Tool for Claude to get goals with progress.&quot;&quot;&quot;<br>    return Tool(<br>        name=&quot;get_goals&quot;,<br>        description=&quot;Get goals with their current progress and metrics&quot;,<br>        inputSchema={<br>            &quot;type&quot;: &quot;object&quot;,<br>            &quot;properties&quot;: {<br>                &quot;status_filter&quot;: {<br>                    &quot;type&quot;: &quot;string&quot;,<br>                    &quot;enum&quot;: [&quot;active&quot;, &quot;completed&quot;, &quot;paused&quot;],<br>                    &quot;description&quot;: &quot;Filter goals by status&quot;<br>                },<br>                &quot;include_metrics&quot;: {<br>                    &quot;type&quot;: &quot;boolean&quot;,<br>                    &quot;description&quot;: &quot;Whether to include metric details&quot;,<br>                    &quot;default&quot;: True<br>                }<br>            }<br>        }<br>    )</pre><p><strong>Tip</strong>: Use Pydantic.model_json_schema() to auto-generate complex schemas:</p><pre>def create_goal_tool() -&gt; Tool:<br>    return Tool(<br>        name=&quot;create_goal&quot;, <br>        description=&quot;Create a new goal&quot;,<br>        inputSchema=Goal.model_json_schema()  # Automatic schema generation!<br>    )</pre><h3>Step 5: MCP Server Implementation</h3><p>Create the server that bridges Claude and your app.</p><p>The MCP server has two main jobs:</p><p><strong>“Here’s what I can do”</strong> — When Claude asks “what tools are available?”, the list_tools() function responds with a menu: “I can get goals, create goals, and update goals.”</p><p><strong>“Let me do that for you”</strong> — When Claude says “please get my goals with status=active”, the call_tool() function:</p><ul><li>Figures out which specific function to call (handle_get_goals)</li><li>Passes along Claude’s parameters ({&quot;status&quot;: &quot;active&quot;})</li><li>Runs your database code</li><li>Sends the results back to Claude as text</li></ul><p>The run_mcp_server() function starts up this “translator” and keeps it running, listening for Claude&#39;s requests through standard input/output (like a command-line program).</p><pre>from mcp.server import Server<br>from mcp.types import TextContent<br>from mcp.server.stdio import stdio_server<br><br>def create_server():<br>    server = Server(&quot;your-app-name&quot;)<br>    <br>    @server.list_tools()<br>    async def list_tools():<br>        return [get_goals_tool(), create_goal_tool(), update_goal_tool()]<br>    <br>    @server.call_tool()<br>    async def call_tool(name: str, arguments: dict):<br>        try:<br>            if name == &quot;get_goals&quot;:<br>                result = await handle_get_goals(arguments)<br>            elif name == &quot;create_goal&quot;:<br>                result = await handle_create_goal(arguments)<br>            # ... other tools<br>            <br>            return [TextContent(type=&quot;text&quot;, text=result)]<br>            <br>        except Exception as e:<br>            # Error handling - shows up in Claude logs<br>            print(f&quot;Error in tool {name}: {str(e)}&quot;, file=sys.stderr)<br>            return [TextContent(type=&quot;text&quot;, text=f&quot;Error: {str(e)}&quot;)]<br>    <br>    return server<br>async def run_mcp_server():<br>    server = create_server()<br>    async with stdio_server() as (read_stream, write_stream):<br>        await server.run(read_stream, write_stream, <br>                        server.create_initialization_options())</pre><h3>Step 6: Tool Implementation with Database Integration</h3><p>Here we are creating the bridge between MCP and the database by:</p><ul><li>Extracting parameters from Claude’s tool call (like filtering and options)</li><li>Querying your database using standard SQLAlchemy patterns with optional filtering</li><li>Converting SQLAlchemy objects to plain dictionaries for JSON serialization</li><li>Optionally loading related data (metrics) based on the include_metrics flag</li><li>Returning structured JSON that Claude can understand and work with</li></ul><p>Essentially, you’re translating between Claude’s conversational requests and your database’s structured data — taking natural language tool calls and turning them into database queries, then formatting the results back into something Claude can interpret and discuss with the user.</p><p>The pattern is: MCP tool call → database query → JSON response</p><p>Connect MCP tools to your database:</p><pre>async def handle_get_goals(arguments: dict) -&gt; str:<br>    status_filter = arguments.get(&quot;status_filter&quot;)<br>    include_metrics = arguments.get(&quot;include_metrics&quot;, True)<br>    <br>    # Use your existing database session<br>    session = next(get_session())<br>    try:<br>        query = session.query(GoalTable)<br>        if status_filter:<br>            query = query.filter(GoalTable.status == status_filter)<br>            <br>        goals = query.order_by(GoalTable.created_at).all()<br>        <br>        # Convert to Pydantic for validation and serialization<br>        goal_objects = []<br>        for goal in goals:<br>            goal_data = {<br>                &quot;id&quot;: str(goal.id),<br>                &quot;title&quot;: goal.title,<br>                &quot;progress_percentage&quot;: goal.progress_percentage,<br>                &quot;status&quot;: goal.status,<br>                &quot;metrics&quot;: []<br>            }<br>            <br>            if include_metrics:<br>                metrics = session.query(MetricTable).filter(<br>                    MetricTable.goal_id == goal.id<br>                ).all()<br>                goal_data[&quot;metrics&quot;] = [metric_to_dict(m) for m in metrics]<br>            <br>            goal_objects.append(goal_data)<br>        <br>        # Return formatted JSON for Claude<br>        return json.dumps(goal_objects, indent=2)<br>        <br>    finally:<br>        session.close()</pre><h3>Step 7: Claude Desktop Configuration</h3><p>Configure Claude Desktop to connect to your MCP server:</p><p>This step instructs Claude Desktop on where to locate your MCP server. You’re adding an entry to Claude’s configuration file that specifies:</p><ul><li><strong>What to call</strong> — the command to start your MCP server</li><li><strong>Where to run it </strong>— the working directory for your project</li><li><strong>How to identify it </strong>— a name Claude uses to reference this server</li></ul><p>Once configured, Claude Desktop will automatically start your MCP server when it launches and connect to it for tool access. <strong>The result:</strong> Claude can now discover and use the tools you defined in previous steps.</p><p><strong>File</strong>: ~/Library/Application Support/Claude/claude_desktop_config.json</p><pre>{<br>  &quot;mcpServers&quot;: {<br>    &quot;your-app-name&quot;: {<br>      &quot;command&quot;: &quot;/bin/bash&quot;,<br>      &quot;args&quot;: [&quot;-c&quot;, &quot;cd /path/to/your/project &amp;&amp; poetry run python -m src.core.mcp.server&quot;],<br>      &quot;cwd&quot;: &quot;/path/to/your/project&quot;<br>    }<br>  }<br>}</pre><p>This follows the <a href="https://modelcontextprotocol.io/quickstart/user#2-add-the-filesystem-mcp-server">official MCP configuration pattern</a> documented by Anthropic. <strong>Key points</strong>:</p><ul><li>Use absolute paths for reliability</li><li>Ensure proper working directory with cwd</li><li>Use bash wrapper to handle environment setup</li></ul><p><strong>Note</strong>: In a production environment, you’d typically have your own AI agent or application connecting to the MCP server. Here, Claude Desktop acts as our “agent” — it discovers your MCP server on startup and makes the tools available through the chat interface. This local setup enables you to quickly explore MCP integrations before integrating them into larger systems.</p><h3>BONUS: CLI Integration for Easy Management</h3><p>Create a CLI for managing your servers:</p><pre>import typer<br>import uvicorn<br>import asyncio<br><br>app = typer.Typer()<br>@app.command()<br>def start_api():<br>    &quot;&quot;&quot;Start the FastAPI server.&quot;&quot;&quot;<br>    uvicorn.run(&quot;src.core.api.app:app&quot;, host=&quot;127.0.0.1&quot;, port=8000, reload=True)<br>@app.command()<br>def start_mcp():<br>    &quot;&quot;&quot;Start the MCP server for Claude.&quot;&quot;&quot;<br>    from .mcp.server import run_mcp_server<br>    asyncio.run(run_mcp_server())<br>@app.command()<br>def migrate():<br>    &quot;&quot;&quot;Run database migrations.&quot;&quot;&quot;<br>    subprocess.run([&quot;alembic&quot;, &quot;upgrade&quot;, &quot;head&quot;])</pre><p>Usage:</p><pre>poetry run your-app start-api    # FastAPI server<br>poetry run your-app start-mcp    # MCP server<br>poetry run your-app migrate      # Database migrations</pre><h3>The Result: Conversational Database Interactions</h3><p>Once everything is connected, you can have natural conversations with your data:</p><p><strong>You</strong>: <em>“What are my 3 most recent goals?”</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HT1apn2KHz7njj8vDulfiA.png" /></figure><p><strong>Claude</strong>: <em>Looking at your goals, your **3 most recent goals** appear to be:</em></p><pre>[Calls get_goals with status_filter=&quot;active&quot;, include_metrics=true]</pre><p><em>Claude calls the get_goals tool and then analyzes the results to identify the 3 most recently created goals.</em></p><p><strong>Claude</strong>: <em>*Based on your current goals, I found 3 that might need attention.</em></p><p><strong>You could enhance your tool definition to include:</strong></p><ul><li>limit parameter (number of results to return)</li><li>sort_by parameter (&quot;created_at&quot;, &quot;updated_at&quot;, etc.)</li></ul><p>That would make the call:</p><pre>[Calls get_goals with limit=3, sort_by=&quot;created_at&quot;, include_metrics=true]</pre><h3>Advanced Patterns</h3><h3>Rich Insights with Cross-Domain Analysis</h3><p>Leverage Claude’s analytical capabilities:</p><p>Instead of asking Claude to run individual queries (“show me my goals”, “show me my metrics”), you’re giving it <strong>rich, interconnected data</strong> and letting it find patterns and insights you might miss.</p><p><strong>The analytical leap:</strong></p><ul><li><strong>Raw approach</strong>: “What are my goals?” → Claude returns a list</li><li><strong>Rich approach</strong>: “Here’s my goals, metrics, and recent activity — what insights do you see?” → Claude identifies trends, correlations, and recommendations</li></ul><p><strong>Concrete example:</strong> Claude might notice: <em>“Your deadlift goal is at 15% progress, but I see you haven’t logged any gym sessions in 3 weeks, and your recent check-ins show you’ve been deep in learning new technologies. These might be connected — your intense focus on skill development may be crowding out your strength training routine.”</em></p><p><strong>Why this is powerful:</strong></p><ul><li><strong>Cross-domain thinking</strong> — Claude can spot relationships between different life areas</li><li><strong>Pattern recognition</strong> — Finds trends across time and different data types</li><li><strong>Proactive insights</strong> — Suggests what to focus on rather than just reporting status</li><li><strong>Strategic recommendations</strong> — Not just “what happened” but “what should I do next”</li></ul><p>By connecting the goals app to the LLM, you’re essentially transformed a logging and metrics app into an <strong>AI-powered personal strategist</strong> that can see the whole picture and help you make better decisions about where to focus your energy. Does that help illustrate the power?</p><pre>async def handle_progress_summary(arguments: dict) -&gt; str:<br>    # Gather data from multiple tables<br>    goals = get_goals_data()<br>    metrics = get_metrics_data() <br>    recent_activity = get_recent_checkins()<br>    <br>    # Return rich data for Claude to analyze<br>    return json.dumps({<br>        &quot;goals&quot;: goals,<br>        &quot;metrics&quot;: metrics,<br>        &quot;recent_activity&quot;: recent_activity,<br>        &quot;suggested_insights&quot;: [<br>            &quot;Cross-reference goal progress with activity patterns&quot;,<br>            &quot;Identify goals that haven&#39;t been updated recently&quot;,<br>            &quot;Find correlation between metrics and goal completion&quot;<br>        ]<br>    })</pre><h3>Multiple MCP Servers</h3><p>You can run multiple MCP servers for different domains:</p><p><strong>Composability</strong> — you can connect multiple specialized servers to Claude simultaneously. Each server can focus on a different domain (your main app, analytics, financial data, etc.), and Claude can use tools from all of them in a single conversation.</p><p>Instead of building one monolithic MCP server, you can create focused, single-purpose servers that Claude orchestrates together. Ask Claude to “analyze my goals progress and compare it with my financial metrics” — it seamlessly pulls from multiple apps to give you cross-system insights.</p><pre>{<br>  &quot;mcpServers&quot;: {<br>    &quot;main-app&quot;: {<br>      &quot;command&quot;: &quot;poetry&quot;,<br>      &quot;args&quot;: [&quot;run&quot;, &quot;main-app&quot;, &quot;start-mcp&quot;],<br>      &quot;cwd&quot;: &quot;/path/to/main/app&quot;<br>    },<br>    &quot;analytics-app&quot;: {<br>      &quot;command&quot;: &quot;poetry&quot;, <br>      &quot;args&quot;: [&quot;run&quot;, &quot;analytics&quot;, &quot;start-mcp&quot;],<br>      &quot;cwd&quot;: &quot;/path/to/analytics/app&quot;<br>    }<br>  }<br>}</pre><h3>Streaming Responses for Large Data</h3><p>For large datasets, consider streaming responses:</p><pre>async def handle_large_query(arguments: dict) -&gt; str:<br>    # Process in chunks<br>    results = []<br>    for chunk in process_in_batches(query_data(arguments)):<br>        results.extend(chunk)<br>        if len(results) &gt; 1000:  # Limit response size<br>            break<br>    <br>    return json.dumps({<br>        &quot;results&quot;: results,<br>        &quot;truncated&quot;: len(results) &gt;= 1000,<br>        &quot;total_available&quot;: get_total_count(arguments)<br>    })</pre><h3>Common Issues and Solutions</h3><h4>1. “Poetry could not find pyproject.toml”</h4><p><strong>Error</strong>: MCP server can’t find your project files.</p><p><strong>Solution</strong>: Configuration probably has the wrong directory. Use shell wrapper with explicit directory change:</p><pre>{<br>  &quot;command&quot;: &quot;/bin/bash&quot;,<br>  &quot;args&quot;: [&quot;-c&quot;, &quot;cd /full/path/to/project &amp;&amp; poetry run your-command&quot;]<br>}</pre><h4>2. “relation ‘table_name’ does not exist”</h4><p><strong>Error</strong>: Database tables not created.</p><p><strong>Solution</strong>: You likely forgot to run a migration — run migrations before starting MCP server:</p><pre>poetry run alembic upgrade head</pre><h4>3. JSON Parsing Errors in Claude Logs</h4><p><strong>Error</strong>: Unexpected non-whitespace character after JSON</p><p><strong>Cause</strong>: SQLAlchemy debug output mixing with JSON responses.</p><p><strong>Solution</strong>: Either disable SQLAlchemy echo or ignore these warnings:</p><pre>engine = create_engine(DATABASE_URL, echo=False)  # Disable in production</pre><h4>4. Module Import Warnings</h4><p><strong>Warning</strong>: RuntimeWarning: &#39;module&#39; found in sys.modules</p><p><strong>Solution</strong>: This warning is harmless when running MCP servers. It occurs due to Python’s module loading order but doesn’t affect functionality.</p><h4>Debugging MCP Connections</h4><p><strong>View MCP logs</strong>:</p><pre>tail -f ~/Library/Logs/Claude/mcp-server-your-app-name.log</pre><p><strong>Test MCP server manually</strong>:</p><pre>cd /your/project/path<br>poetry run python -m src.core.mcp.server<br># Should wait for input without errors</pre><p><strong>Add debug output to MCP handlers</strong>:</p><pre>async def handle_tool(arguments: dict) -&gt; str:<br>    try:<br>        # Your logic here<br>        result = process_data(arguments)<br>        return json.dumps(result)<br>    except Exception as e:<br>        # This appears in Claude logs<br>        print(f&quot;Debug: Tool failed with {arguments}&quot;, file=sys.stderr)<br>        print(f&quot;Error: {str(e)}&quot;, file=sys.stderr)<br>        return f&quot;Error: {str(e)}&quot;</pre><h3>Conclusion</h3><p>Building MCP-enabled applications opens up imaginative possibilities for AI interactions and augmentation — transforming static applications into intelligent partners that can analyze, strategize, and evolve with your needs . The combination of Pydantic’s type safety, FastAPI’s performance, PostgreSQL’s robustness, and MCP’s conversational interface creates a powerful foundation for intelligent applications.</p><p><strong>Key takeaways</strong>:</p><ul><li><strong>Pydantic models</strong> provide type safety across your entire stack</li><li><strong>MCP integration</strong> is surprisingly straightforward once you understand the stdio communication pattern</li><li><strong>Error handling and logging</strong> are crucial for debugging MCP connections</li><li><strong>The development experience</strong> is smooth with proper tooling and CLI commands</li><li><strong>Standardized AI integration</strong> — MCP provides the protocol layer that lets any LLM interact with your applications through well-defined tools</li></ul><p>The result is a system that enables natural conversations with your data, allows you to create complex queries through simple language, and provides intelligent insights.</p><p><strong>Next steps</strong>: The patterns demonstrated here extend naturally to production environments with proper authentication, advanced tool chaining, and rich user interfaces. The future of AI application development leverages LLM advances to unlock the full potential of our applications, transforming them from static data repositories with APIs into dynamic, intelligent partners.</p><p><em>Built with: Python 3.12, FastAPI, PostgreSQL, Pydantic, SQLAlchemy, Alembic, and Anthropic’s MCP</em></p><p><strong>About the Author</strong>: Mark Holton is a hands-on Software Architect at <a href="https://www.linkedin.com/company/shiftupai/">ShiftUp</a>, where we’re building AI agents that revolutionize Go To Market and Sales Intelligence.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f47a487009f5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Securing Personal Accounts with MFA/2FA and Strong Passwords]]></title>
            <link>https://markholton.medium.com/securing-personal-accounts-with-mfa-2fa-and-strong-passwords-7d0b441485d6?source=rss-6d66f9bc5525------2</link>
            <guid isPermaLink="false">https://medium.com/p/7d0b441485d6</guid>
            <category><![CDATA[2fa]]></category>
            <category><![CDATA[mfa]]></category>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[passwords]]></category>
            <dc:creator><![CDATA[Mark Holton]]></dc:creator>
            <pubDate>Fri, 06 Nov 2020 18:56:27 GMT</pubDate>
            <atom:updated>2020-11-06T23:48:12.349Z</atom:updated>
            <content:encoded><![CDATA[<p>The more time we spend online with various accounts to view and manage our finances, e-commerce, hobbies, and social media, the more we can be exposed to chances for our privacy or identity to be marginalized or even violated. Anyone who has had to deal with the fallout of a <a href="https://twitter.com/MarkHolton/status/1317910023956099072">compromised account</a> or set of accounts can tell you how <a href="https://www.theatlantic.com/notes/all/2016/12/getting-hacked-your-stories/510188/">painful and damaging </a>that can be. There are ways to greatly mitigate the risk of your personal accounts being compromised that you should use where possible — specifically set <strong>strong passwords and use a Password Manager, </strong>and enable <strong>Multi-factor Authentication (MFA) </strong>and/or <strong>Two-Factor Authentication (2FA)</strong>. Adding these additional layers of security is pretty basic with the right understanding and tools and <strong>should be a fundamental of all your online accounts where available</strong>. You should not ignore it for what you think is “convenience” — as the saying goes <em>“You can pay a little now, or a lot later”</em>.</p><p>I’ll briefly summarize some of the basics that you should use and take you through some example configurations to provide context for you to improve your own personal online security.</p><h3>Strong Passwords and Password Manager</h3><p>You have no doubt heard some variation of this before: “You should choose passwords that are <em>NN</em> characters long, contain special characters and/or are randomly generated”. But also without a doubt (admit it!) you hardly ever do that and likewise, you have many accounts <em>with the same dictionary password or name-based password, with a number or “!” slapped on the end</em>. You should be aware in many cases these can be very easily <a href="https://www.techrepublic.com/article/brute-force-and-dictionary-attacks-a-cheat-sheet/">hacked with brute force</a> by those who are motivated to get at your account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pTiZ6k2dmDonI8fql68XIQ.png" /><figcaption>You should choose passwords that are unique, of sufficient length, and it is preferable that they are randomly generated.</figcaption></figure><p>So what guidelines should you follow with setting your passwords to help protect against a brute force attack from succeeding:</p><ol><li>Longer passwords or <a href="https://www.sans.org/security-awareness-training/ouch-newsletter/2017/passphrases#:~:text=Passphrases%20are%20a%20simpler%20way%20to%20create%20and%20remember%20strong%20passwords.&amp;text=What%20makes%20these%20passphrases%20so,easy%20to%20remember%20and%20type.">password phrases </a>are better</li><li>Never use common words, phrases, your name, or combinations thereof</li><li>Choose unique passwords for each account</li><li>Ideally, randomly generate a password that you yourself could never guess nor remember, and store it in an encrypted, password management tool like <a href="https://1password.com/why-1password/">1Password</a>. Disclaimer: I don’t work for nor do I know anyone who works for 1Password. I have used them for over 12 years, and think they have the best password manager out there — it’s cross-OS, a great local Mac app, a great Android app, and <a href="https://1password.com/why-1password/#:~:text=More%20than%20just%20storing%20passwords,authentication%20or%20using%20unsecured%20HTTP.">does a lot more than store passwords securely</a>. Highly recommend you checking it out, along with other password managers, some of which are free: <a href="https://www.wired.com/story/best-password-managers/">https://www.wired.com/story/best-password-managers/</a>. Regardless of which manager you pick, pick one, and USE IT!</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dwmavh4R2sGS_a9jSGRxcw.png" /><figcaption>Using a password manager tool can help you not only store complex passwords that are impossible to guess and more difficult to hack, but it can remind you when passwords are duplicated.</figcaption></figure><p>Once you have your strong passwords and passphrases stored in your encrypted password manager, you’ll have to pick a strong password/passphrase for the manager itself. Passphrases here are good because they are not only long and complex but easy to remember. You should keep this passphrase private, in a private location that only you and your closest family member is aware of. It is only a single password, not 476 of them! Also, most password managers have an “<a href="https://support.1password.com/emergency-kit/">Emergency Kit</a>” which you should also store in a private place — it contains backup keys if you lose access to your account or forget your password. Keep this in a private place and share it with a trusted loved one.</p><blockquote>“Your Master Password is never shared with anyone, even us at AgileBits, which means that you’re the only person who can unlock your 1Password vaults and access your information” — <a href="https://support.1password.com/1password-security/#:~:text=Your%201Password%20data%20is%20kept,cryptographically%20secure%20pseudorandom%20number%20generators">1Password.com</a></blockquote><h3>Enable <strong>Multi-factor Authentication (MFA) </strong>and/or <strong>Two-Factor Authentication (2FA)</strong></h3><p>You have maybe heard these terms or read them, but don’t know what they mean. They are essentially the same thing, but 2FA (or sometimes referred to as “2-Step Verification”) is a subset of MFA — namely 2FA requires TWO distinct proofs of identity and is the simplest form of multi-factor authentication, and MFA means more than two factors involved.</p><p>In almost every case, two-factor authentication is an improvement in security over single-factor (password only) auth. If a password is stolen or obtained it is no longer enough for an attacker to gain access to your account. They need proof of your identity via another factor to gain access.</p><p>So what is the 2nd factor? It could be something that you know (a PIN), something in your possession (a badge or smartphone), or something that you are (a fingerprint, your face, or your voice). In practical terms for your online account (Google, Twitter, your Financial Institution) it is usually one or more of the following:</p><ul><li>SMS message with a numeric code sent to your phone at the time of login</li><li>A code generated from an Authenticator application (examples: <a href="https://duo.com/product/multi-factor-authentication-mfa/duo-mobile-app">Duo</a>, <a href="https://support.google.com/accounts/answer/1066447">Google Authenticator</a>)</li><li>A 2FA Security key (examples <a href="https://www.yubico.com/products/security-key/">here</a> and <a href="https://cloud.google.com/titan-security-key">here</a>) registered to you that you insert into your computer or smartphone and tap with your finger</li><li>For some apps, phones themselves can be used as a physical security key (E.g. for Google, any <a href="https://www.theverge.com/2019/4/10/18295348/google-android-phone-fido-webauthn-phishing-two-factor-authentication">phone running Android 7 or higher</a> can act as a security key)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/603/1*X5nqXkO26ZKGAj_hFcVC5A.png" /><figcaption>Once configured, an Authenticator app can be used as a 2FA device.</figcaption></figure><p>Where possible, it is a good idea to <strong>use multiple forms of authentication </strong>to verify your account. This doesn’t mean you are clicking “approve” on every key each time you log in! Usually, you are working on a trusted computer or device and don’t have to verify your identity every day. It just means that these 2nd factors can be used to verify that it is YOU in addition to your password. Where does this come in handy? Let’s say you’re like me, and when on vacation with your family, you leave your phone baking in the 100 deg sun while swimming. When back in your hotel room on your computer logging into your Gmail you realize that your 2nd Factor, your phone or your Authenticator app on your phone, is dead and out of commission. If you have multiple forms of 2FA you can “try another way” and use a YubiKey, a backup code (you should store your backup codes in a secure place, like a password manager), or an SMS when you get a replacement. In the case of Google Accounts, for instance, all of the above can be used to verify your identity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LjU8-QNBvbM2tfYAHKBzaw.png" /></figure><p>I hope this helps give you context on improved security online. By doing just these two things, you can dramatically reduce the potential of a bulk phishing, automated bot, or targeted attack! Please take the time to look at a Password Manager that will work for you and give it a try. As you gain comfort using it, you can migrate your online accounts, and turn on 2FA where available. Besides a solid upgrade in your online security and improved peace of mind with these steps, you will find that it makes your life easier. The tools for managing and looking up passwords removes the requirement for you to remember 25 (or many more) different password variations for different sites, and you won’t be using a single password for all your accounts. The added factor check for your identity has been shown to be <a href="https://boingboing.net/2019/05/20/screw-security-nihilism.html">incredibly effective at preventing account hijacking </a>and is something you should take the time to understand and adopt. If you have questions, leave a comment or send me a note, until then, safe travels!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7d0b441485d6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Volunteer Teaching]]></title>
            <link>https://markholton.medium.com/volunteer-teaching-fe0bfca1cbd9?source=rss-6d66f9bc5525------2</link>
            <guid isPermaLink="false">https://medium.com/p/fe0bfca1cbd9</guid>
            <category><![CDATA[education]]></category>
            <category><![CDATA[volunteering]]></category>
            <dc:creator><![CDATA[Mark Holton]]></dc:creator>
            <pubDate>Sat, 28 Sep 2019 23:29:50 GMT</pubDate>
            <atom:updated>2019-09-28T23:29:50.007Z</atom:updated>
            <content:encoded><![CDATA[<p>Most of the time during a workweek as a software engineer, I am “head-down” grinding on software (planning, collaborating, building, maintaining, meeting, researching), sometimes fighting fires. I love <a href="https://engineering.salesforce.com/building-a-fault-tolerant-data-pipeline-for-chatbots-47d74bc31f5b">architecting, developing</a>, and maintaining software — enjoy this grind, the challenges — but, as with most jobs, there are some stresses to be managed.</p><p>One activity I have been trying to make time for the last three years is volunteer teaching 1–2 hours per week. I started this because it was encouraged by my employer, <a href="https://medium.com/u/d85310c779d1">Salesforce #dreamjob</a> (https://www.salesforce.org/pledge-1/). Specifically, I have been helping the teachers in our local community. Usually, the help involves preparing teaching materials, organizing class materials, or working with a subset of kids who need extra instruction. I especially enjoy it when I can help teach kids Math.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KX9YFqdNNJnevArH6-L4_w.png" /></figure><p>It’s true that you, the volunteer, reap many (unexpected) benefits of volunteering. The biggest reward for me is helping a kid jump over a hurdle in learning a concept. Often, kids will start guessing at answers or take shortcuts. After the practice and explaining it from a few different angles, you see the “light bulb” go on when they “get it.”. Then you see their feeling of accomplishment across their face. Even though it’s just an hour or two per week, this feeling of helping a kid learn a fundamental can positively push me in a week. It can help put things into perspective.</p><p>Another personal benefit of volunteering is relationships. My kids go to this elementary school, so I get to know the teachers a little more. The students don’t ever call me by my name but instead call me “Evan’s Dad” or “Adriana’s Dad,” which is neat, and my kids seem to like. You feel a little more connected to the place you call home.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I8PvqvZw5NSGU4eqSjpBGQ.png" /><figcaption>Also, I get the chance to see my daughter at lunch for 10 minutes some days</figcaption></figure><p>I share this because it’s something that has added value to my life personally by helping teachers and students in our community. It feels good. I hope you will consider taking some time to volunteer in your town because you might discover the same benefits.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fe0bfca1cbd9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Fault-Tolerant Data Pipeline for Chatbots]]></title>
            <link>https://medium.com/salesforce-engineering/building-a-fault-tolerant-data-pipeline-for-chatbots-47d74bc31f5b?source=rss-6d66f9bc5525------2</link>
            <guid isPermaLink="false">https://medium.com/p/47d74bc31f5b</guid>
            <category><![CDATA[circuit-breaker]]></category>
            <category><![CDATA[fault-tolerance]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[kafka]]></category>
            <category><![CDATA[chatbots]]></category>
            <dc:creator><![CDATA[Mark Holton]]></dc:creator>
            <pubDate>Tue, 20 Aug 2019 15:06:01 GMT</pubDate>
            <atom:updated>2019-08-20T15:06:01.255Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building a Fault-Tolerant Data Pipeline for Einstein Bots</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y5EdpvAvQD83Q2AozmBkFg.jpeg" /></figure><h3>Background</h3><p><a href="https://www.salesforce.com/products/service-cloud/automated-customer-service/">Chatbots</a> can be a powerful force-multiplier for Service organizations. To give <a href="https://help.salesforce.com/articleView?id=bots_service_intro.htm&amp;type=5">Service Cloud customers</a> the ability to develop and <a href="https://help.salesforce.com/articleView?id=bots_service_events_log.htm&amp;type=5">debug</a> a custom-configured Chatbot effectively requires providing them with tools such as debug logs. Debug logs are a way to view the step-by-step execution of their Chatbot. In addition to debugging, it is helpful to see critical metrics that can highlight which portions of the bot are being used most often vs. those which are throwing exceptions. Whether it’s a call to a custom Apex script, an external request to an <a href="https://einstein.ai/">Einstein.ai</a> Natural Language Processing (NLP) endpoint, or tracking the conversation flowing between two dialogs, customers need to observe that their bot is executing as intended.<br> <br>To allow for these insights, the “engine” for Chatbots emits events containing data and metadata for each action taken, along with counts of critical metrics. A Chatbot administrator ultimately views these events and metrics. These streams of data flow asynchronously through the <a href="https://engineering.salesforce.com/building-a-scalable-event-pipeline-with-heroku-and-salesforce-2549cb20ce06">Chatbot Events Pipeline</a>. It is the pipeline’s responsibility to deliver this data and metadata reliably.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rR52cJcm_1UBiGHWmrCCrA.png" /><figcaption><strong>Figure 1:</strong> A small sample of debug logs for a chatbot session viewed by a Chatbot administrator</figcaption></figure><h3>Fault-Tolerance</h3><blockquote>“Failures are a given, and everything will eventually fail over time.” — <a href="https://medium.com/u/8859b1d1dade">Werner Vogels</a></blockquote><p><em>Preventing</em> faults before they occur is one goal we strive for as engineers. However, there will be times when not all goes as planned: services we may depend on outside of our control will be unavailable or will fail; perhaps a configuration that is external to our architecture might cause failures downstream, or maybe there is a network-level failure. <br> <br>At any scale, your data pipeline or service needs to anticipate and mitigate the fundamental and most common faults.</p><ul><li>If you are required to send data downstream via HTTP, it is inevitable that those endpoints will not be available or will be unresponsive at some point.</li><li>In the case of a data pipeline, it is likely you will be required to reprocess data from a point in time</li></ul><p>If your design does not handle these common conditions in a fault-tolerant manner, the result can not only negatively impact your service but also can affect the health of services upstream and downstream from it.</p><p>What critical design choices can you make to help address these common faults and increase the reliability of the data pipeline? What steps can you take to deliver data while also limiting the risk of service degradation?</p><p>Presented here are five architecture and development choices made in the creation of a fault-tolerant event pipeline for Einstein Bots (Figure 2), along with explanations for each.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s-yyMe4dq9Tzly88y5pJnA.png" /><figcaption><strong>Figure 2:</strong> Data flow diagram through the Chatbots Data Pipeline from KafkaConsumer through to HTTP endpoints</figcaption></figure><h3>1. Choose a fault-tolerant event streaming platform such as Apache Kafka</h3><blockquote>“How many times da I have to tell ya…the right tool for the right job!” — <a href="https://en.wikipedia.org/wiki/Scotty_(Star_Trek)">Montgomery Scott</a></blockquote><p>Apache Kafka is a durable and fault-tolerant publish-subscribe messaging system. While it is highly scalable, it is not just for high throughput use-cases. Kafka comes with configurable durability guarantees. Kafka replicates topic data across partitions in a cluster, and ideally, you should <a href="https://devcenter.heroku.com/articles/kafka-on-heroku#region-specific-guidance">spread these partitions across brokers in different network Availability Zones</a>.<br> <br>Kafka Consumers can fail and pick up where they left off, or where another Consumer in the <a href="https://kafka.apache.org/documentation/#intro_consumers">consumer-group</a> last processed events. Because Kafka retains messages (or events) for a configurable amount of time, it enables the ability for your Consumer to reprocess data from a given topic offset. <br> <br>Downstream from Kafka, you’ll need to ensure that your event consumers are following fundamental fault-tolerant practices when making HTTP requests from consumers to downstream destinations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GV7_DEa1xQooJizCQBUg5g.png" /><figcaption><strong>Figure 3:</strong> Data Flow Diagram of an HTTP UploadTask — showing relevant fault-tolerant paths</figcaption></figure><h3>2. Implement Timeouts and Retry Failed HTTP Posts</h3><h4>Timeouts</h4><p>For helping protect your service, a solid start to HTTP fault-tolerance is with sensible connection timeouts (7a in Figure 3 above). High latency responses from legitimate downstream endpoints are bound to occur. If you have not set a timeout as an upper limit for your HTTP connections, this can cause exhaustion of connections in your connection pool, causing delays or even failures for subsequent posts. You will want to use timing data from your logs to drive this timeout value. Start by setting a timeout value slightly larger than the median latency of a request (E.g., 1.5 * medianLatency). You don’t want to set the timeout too low and risk rejecting legitimate connections, but you want to ensure HTTP requests always continue to flow by not exhausting your service’s available connections.</p><h4>Retry Failed requests</h4><p>Whether your downstream request fails due to a timeout, or due to some other HTTP error response, you will want to retry that request (#10 in Figure 3 above) at some interval in attempts to deliver its payload. You should be respectful of the downstream services and not proliferate retries beyond a reasonable upper limit. For instance, if the downstream service is attempting to recover, hitting it with batch after batch of retries from your application will limit its ability to do so. In the Chatbot Events Pipeline, failed requests are retried up to a <strong>maximum</strong> of six times over 16 hours — if the downstream endpoint becomes stable and responsive during that time, the Consumers successfully deliver the payload without adding an avalanche of requests.</p><h3>3. Design with Idempotence and Upsert Semantics</h3><p>Life is much less stressful with idempotence. Most commonly, this will apply when you are intentionally reprocessing events from a specific Kafka topic offset, but there can be other situations where assurance of not creating duplicate records can save many headaches for you and your customers. The main design trait here is to avoid creating duplicate data downstream during reprocessing.<br> <br>One related best-practice is to ensure each of your events has a universally unique identifier (UUID) and to upsert into downstream datastores with this value. Subsequent upserts then can check for this and update the row or avoid duplicates. Whether you are running an UPSERT or checking for duplicates before INSERT is a decision for you and your team, but the key is to design for reprocessing such that you avoid generating duplicate data.</p><h3>4. Implement a CircuitBreaker per Downstream Endpoint</h3><p><a href="https://martinfowler.com/bliki/CircuitBreaker.html">CircuitBreakers</a> will significantly aid with protection for your service and each downstream endpoint (#5 and #8 in Figure 3 above). The high-level concept is simple. A buffer holds the health of each HTTP endpoint in memory; if the number of failures in that buffer surpasses a given threshold, the circuit is set to OPEN, and subsequent calls to that endpoint within a mandatory waitInterval are short-circuited as errors, providing two significant benefits:</p><ol><li>If posts to a downstream URL are failing consistently, your service does not wait an unnecessary amount of time (up to your timeout) for every potential request. By not wasting resources on an endpoint in a known-failed-state, your service can more readily service requests to other healthy endpoints.</li><li>By not sending traffic to a struggling endpoint, you are not pelting that endpoint with requests, and allowing it an increased opportunity to recover.</li></ol><p>After the mandatory waitInterval has passed in an OPEN circuit, requests start to trickle to the target in a HALF_OPEN state. If the number of failures during this sample phase does not exceed your configured threshold, that endpoint has “healed” (the circuit is set back to CLOSED state), and requests begin flowing again to that endpoint! <br> <br>There are some battle-tested open-source <a href="https://resilience4j.readme.io/docs/circuitbreaker">CircuitBreaker implementations </a>available and worth checking out.</p><h3>5. Implement a Bulkhead per Downstream Endpoint</h3><p>As you are sending data downstream, you should ensure that the number of concurrent requests you send downstream to a given endpoint is limited. The <em>Bulkhead Pattern</em> does precisely this (see #6 in Figure 3 above). As is the case of the CircuitBreaker, this helps to protect your service and the downstream service you are posting to:</p><ol><li>If you implement a bulkhead, you limit the number of concurrent requests to that downstream endpoint; it also distributes requests from your service more equally across endpoints. In other words, bulkheads prevent the overuse of a pool to a given endpoint. Even with timeouts and CircuitBreakers, there is a risk that a given endpoint could consume a disproportionate number of threads, temporarily blocking your service’s ability to post elsewhere. For example, if your service is posting downstream to Endpoint A, Endpoint B, and Endpoint C and requests to Endpoint C become unresponsive — without protection from a bulkhead you risk the case of your service waiting in line for Endpoint C requests to complete or timeout.</li><li>By limiting the number of concurrent requests to a given endpoint, you are setting an upper limit at any given moment for the requests sent from your service to that endpoint. Even with fanned-out Executor threads performing HTTP posts, for instance, you can ensure all requests pass through a Bulkhead and are therefore limited.</li></ol><p>I hope you found these ideas insightful, thought-provoking, and helpful towards your development efforts. Please share your opinion in the comments or feel free to clap your hands. Have a fault-tolerant year!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=47d74bc31f5b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/salesforce-engineering/building-a-fault-tolerant-data-pipeline-for-chatbots-47d74bc31f5b">Building a Fault-Tolerant Data Pipeline for Chatbots</a> was originally published in <a href="https://medium.com/salesforce-engineering">Salesforce Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Scalable Event Pipeline with Heroku and Salesforce]]></title>
            <link>https://medium.com/salesforce-engineering/building-a-scalable-event-pipeline-with-heroku-and-salesforce-2549cb20ce06?source=rss-6d66f9bc5525------2</link>
            <guid isPermaLink="false">https://medium.com/p/2549cb20ce06</guid>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[event-driven-architecture]]></category>
            <category><![CDATA[heroku]]></category>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[scale]]></category>
            <dc:creator><![CDATA[Mark Holton]]></dc:creator>
            <pubDate>Thu, 31 Jan 2019 17:36:00 GMT</pubDate>
            <atom:updated>2019-01-31T17:36:00.946Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building a Scalable Event Pipeline with Heroku and Salesforce</h3><p>Have you heard of<a href="https://www.salesforce.com/blog/2017/11/the-magic-of-einstein-bot"> Chatbots</a>? In Salesforce Service Cloud, a surging number of customers across the globe are finding Chatbots to be a useful addition to their Service offerings. Chatbots are an exciting new technology, and an enabler for organizations and teams who embrace automation. By setting up conversational dialogs and rules, custom scripts, and a sprinkling of machine learning or artificial intelligence, a carefully configured chatbot can answer many targeted questions for your customers.</p><p>In order for this to work for our customers at scale, there is a lot of work that went in behind the scenes! Enter: the Event Pipeline.</p><h3>How is Chatbots related to an Event Pipeline?</h3><p>When building an application at Chatbots scale, the need to reliably share data, export logs, and collect metrics is critically important. This data is used to support the application, the users, and their businesses.</p><p>The Chatbot platform required an architecture to reliably export “event logs” or “debug logs” from our main Chatbot Runtime application. Customers themselves need these logs for key insights, such as:</p><ul><li>Auditing Chatbot’s logical flow — is it working and performing as intended?</li><li>Pinpointing any exceptions that are occurring within the logic of their bot</li><li>Pinpointing any exceptions occurring in custom code they created as part of an Invocable Action or Invocable Flow</li></ul><p>Once we defined the attributes an event would contain, we needed a way to export these events in near real-time for each user session within an Organization. These events provide crucial visibility into the logical steps a bot takes when responding to a user.</p><h3>What drove our architectural design?</h3><p>The main design questions were:</p><ul><li>How could we ensure the events would be reliably delivered, without degrading the performance of the main app?</li><li>How can we ensure resilient delivery of events to individual Salesforce Orgs, in a manner that would scale out as the volume of these events increased over time?</li></ul><p>Answering these key design questions led to an architectural design that utilized Salesforce’s own Heroku Platform, and namely<a href="https://www.heroku.com/kafka"> Apache Kafka on Heroku</a>. An event pipeline built on Kafka enabled us to design the pipeline’s characteristics to meet our scalability needs, targeting volumes of tens of million events per day.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_PSQbXxKruOlMDaT" /></figure><p><strong>Figure 1:</strong> Schematic of DebugLogs pipeline from Chatbot Runtime to downstream data stores used</p><p>The event pipeline built and used today transmits events from an asynchronous and non-blocking Producer with low latencies. Rather than Chatbot Runtime being overloaded with processing and uploading event data to external sources via HTTP posts, this design limits Chatbot Runtime’s responsibility to simply constructing and buffering these events into the pipeline. The responsibility of data upload via an HTTP post or other means is passed to a downstream Consumer. This results in a clean separation of concerns and direct paths to scaling these features, with less impact on Chatbot Runtime’s core responsibility of processing bot messages.</p><p>These events in transit are stored in a Kafka topic for up to 7 days, with a carefully selected number of partitions that allow us to scale out and deliver these events in near real-time. Consumers read from this topic, collect and batch events, and upsert bulk sets of data to downstream data stores used by a given organization.</p><h3>Benefits of this Architecture</h3><p>This architecture allowed us to design the pipeline and consumers with 3 large benefits in mind:</p><ol><li><strong>Defer high latency HTTP calls</strong></li></ol><ul><li>If the number of events corresponded to an increase in HTTP requests, performance in the main app would quickly start to degrade.</li><li>Instead of posting events via HTTP from the main app, which can involve high latencies, events are emitted into a Kafka topic via an asynchronous and non-blocking Producer. Emitting an event takes about 1ms. Even at extremely high volumes of events, this is not impactful to the main application’s performance</li><li>The consumers then read and batch events to efficiently deliver those batched payloads downstream</li><li>As an added optimization, the HTTP posts by the consumers happen asynchronously via a pool of executors allowing multiple posts to happen in parallel</li></ul><p><strong>2. Tailor the size and configuration of our Kafka cluster and topics for the projected volume of events</strong></p><ul><li>By carefully selecting the number of partitions per broker, you can balance the need to <em>scale out</em> Consumers processing data, alongside the performance of the cluster itself in terms of rebalancing and replication.</li><li>The number of partitions per topic is a directly limiting factor on the number of consumers that can read from a given topic in parallel. Too few partitions and you limit throughput; too many and you risk consuming higher resources, which increases time to re-elect leaders when brokers are recovering from failure.</li><li>By structuring events and consumers so that events can be processed in any order, you can parallelize consumers and evenly distribute events across each partition; if order of events is vital, you have an option to assign a class of events to a given partition by giving it a key (e.g. a session ID or an org ID).</li><li>Other key reliability and performance considerations for your Kafka cluster are number of brokers in each availability zone, replication factor, data retention policy, and event compression.</li></ul><p><strong>3. Allow for efficient failover queues and reprocessing</strong></p><ul><li>In the event a downstream datastore is not available at the time of publishing consumed data, you want your system to try and re-deliver this data downstream at a later time</li><li>Processes that rely on HTTP, such as HTTP bulk posts, are destined to have failure rates greater than 0. For these processes, retry topics are a great method of identifying failed deliveries and retrying.</li><li>Retry topics in your cluster act as queues that other retry consumers can consume from and attempt to re-post at predefined intervals. By emitting failed bulk posts into retry topics, you can add a high degree of bulk post resiliency.</li><li>By handling failures and retries via special retry topics, each queue can be processed efficiently and move forward, without causing your pipeline to stagnate or back up.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Aqf_N1J7gqoN0ofZ" /></figure><p><strong>Figure 2:</strong> Example graphs of Chatbots Event Pipeline in Production delivering millions of events per day used by Organizations building bots. Note: these numbers are not showing actual Production numbers.</p><h3>Summary</h3><p>When building your application or service, you will likely have a need to publish events for a variety of use-cases and business demands. An effective way to do this and to decouple the performance of your main app from the publishing pipeline is to defer HTTP publishing downstream. Apache Kafka, and especially a managed Kafka cluster such as the one offered by Heroku, is a battle-tested platform that provides this capability. By using this platform and some key design considerations, you can reliably grow your event pipeline without sacrificing performance or scalability of your core services.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2549cb20ce06" width="1" height="1" alt=""><hr><p><a href="https://medium.com/salesforce-engineering/building-a-scalable-event-pipeline-with-heroku-and-salesforce-2549cb20ce06">Building a Scalable Event Pipeline with Heroku and Salesforce</a> was originally published in <a href="https://medium.com/salesforce-engineering">Salesforce Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Leadership and Trust]]></title>
            <link>https://markholton.medium.com/leadership-and-trust-63d795c9697d?source=rss-6d66f9bc5525------2</link>
            <guid isPermaLink="false">https://medium.com/p/63d795c9697d</guid>
            <category><![CDATA[leadership]]></category>
            <category><![CDATA[trust]]></category>
            <dc:creator><![CDATA[Mark Holton]]></dc:creator>
            <pubDate>Tue, 16 May 2017 00:34:19 GMT</pubDate>
            <atom:updated>2017-05-16T00:34:19.757Z</atom:updated>
            <content:encoded><![CDATA[<p>Really like this excerpt from the book I am reading, <em>The Speed of Trust</em>. This resonates with me, especially this simple definition of leadership:</p><blockquote>Simple definition of <strong>leadership</strong>. Leadership is <strong>getting results in a way that inspires trust</strong>. Maximizing current contribution, and your ability to contribute in the future by establishing the trust that makes it possible.</blockquote><blockquote>The means to the end, are as important as the ends. How you go about achieving results are as important as the results themselves. Because when you establish trust, you increase your ability to get results the next time. And there’s always a next time. To get things done in ways that destroy trust is not only short-sighted and counterproductive, it is ultimately unsustainable.</blockquote><blockquote>As the courageous explorer, Sir Earnest Shackleton put it: “Life to me is the greatest of all games. The danger lies in treating it as a trivial game; a game to be taken lightly, and a game in which the rules don’t matter much. The rules matter a great deal. The game has to be played fairly or it is no game at all. And even to WIN the game is not the chief end. The <strong>chief end is to win it honorably and splendidly</strong>.”</blockquote><blockquote>“Trust is key to long term success”.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bsY9GNxaZa17N1GOdzMBwg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=63d795c9697d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Portland Marathon 2016]]></title>
            <link>https://markholton.medium.com/portland-marathon-2016-422c11d0eaec?source=rss-6d66f9bc5525------2</link>
            <guid isPermaLink="false">https://medium.com/p/422c11d0eaec</guid>
            <category><![CDATA[running]]></category>
            <category><![CDATA[portlandmarathon]]></category>
            <category><![CDATA[marathon]]></category>
            <category><![CDATA[race]]></category>
            <dc:creator><![CDATA[Mark Holton]]></dc:creator>
            <pubDate>Mon, 10 Oct 2016 05:19:30 GMT</pubDate>
            <atom:updated>2016-10-10T05:19:30.570Z</atom:updated>
            <content:encoded><![CDATA[<p>Portland Marathon 2016</p><p>Today I ran the Portland Marathon and finished the race in 3 hours 53 minutes and 09 seconds officially.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zr1SzyIE4b8yAmhx9SY95A.jpeg" /><figcaption>Official Race Results</figcaption></figure><p>I want to share some of my thoughts and feelings on the race, along with what appears to be a mistake by the race organizers that I hope can get corrected or at least acknowledged.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oTb6eHsqUUg_B8v5wUzVYA.jpeg" /><figcaption>GPS splits, mile by mile</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*axoWr4PTXJg6gpJOwtVwcg.jpeg" /><figcaption>Watch at finish line 8&#39;44&quot;/mi for 26.68 miles</figcaption></figure><p>Official results and my Mile by mile splits shown above, along with my watch showing 26.68 miles run at 3:53:10 when I crossed the finish line.</p><p>Some unexpected bad weather rolled in and we raced much of the race since mile 9 in a very steady rain. Overcoming these conditions to average 8:44/mi, very close to my 8:39/mi goal is something I’m proud of.</p><p>I was confused after the race how I could hit many of the times per mile I targeted and be 4 minutes off my target pace.</p><p>If you look at my race results, you’ll notice an odd result in the official results showing I ran the first 5km (3.1 mi) at a pace of 10:08/mi. Yet my splits show I ran the first 3 mi in 8:43, 8:40, 8:59.</p><p>During the race, when crossing the 5k sign, both of my watches read 3.55 mi, not 3.1. I started asking other runners during the race who said they had the same mileage. We assumed the signage was wrong.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YqRfOMhMhagaIYwluMh5kA.jpeg" /><figcaption>Noticed 10&#39;s of other runners on Strava ran 26.65+ mi or more, with GPS data showing they added 0.4 mi in first mile</figcaption></figure><p>After noticing this, I also noticed that hundreds of runners had run 26.65+ miles, not 26.2. Usually you can add some distance by not cornering properly, an aware of that as I have run in 20+ races, and this is my 4th full marathon. But it is odd to add a full 0.4 miles.</p><p>After looking at my GPS on the map, along with the course map, it appears our corral, Corral C, ran a full 0.4 miles extra in the first mile.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M1iPuu97rvfj5tLdpBrpkA.jpeg" /><figcaption>GPS data showing our route at start of race</figcaption></figure><p>The “stair step” you see above which heads East on Hoyt, was not the prescribed route for the marathon shown below. The official course route is to turn right off of 4th street onto Couch, and then a right onto Naito.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DFq9xr5ldn84sKGqbf5p9A.jpeg" /><figcaption>Pink arrows summarizing extra distance run</figcaption></figure><p>As the corrals go off, they are separated between other corrals starting by approximately 5 minutes. Our corral C started approximately at 7:10. My best guess is our corral had between 500–800 runners in it, maybe more, out of the 10,000+ in the marathon. It is a large mass of runners, elbow to elbow at the start.</p><p>While I know for certain all of us headed down this path together, I don’t know why. Was the course not adequately marked? I do know that the first mile of a race as big as this is jam packed with runners within 1–3&#39; of each other. Taking a “wrong turn” is not something we do in the middle of this pack. I can only guess, for whatever reason, the lead-out group of Corral C missed the turn, we all followed, including the 3:45&quot;Lizard” pace group.</p><p>In hindsight, I am 100% sure we’d all do the same thing. Breaking off from the group on a turn in mile 1, when the massive corral is heading down a road, would seem like a very strange move. Runners are worried about pacing, calming down, etc, not “is my corral following the correct course route in mile 1&quot;.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wksc8055JSDxTEDDEFu-7w.jpeg" /></figure><p>It all makes perfect sense now why both of my watches read 3.55 at the 5k sign, and why my results show this 10:00+ avg pace at the 5k split. Also explains while I was hitting my goal times by my watch, the end result was 3:53:09 and not the 3:49 I would have expected — we simply ran an extra 0.4 miles within the first mile.</p><p>I am hopeful the Portland Marathon rectifies this for us in Corral C in some way.</p><p>I am really happy and proud of this effort, my 4th marathon, and 3rd Portland Marathon. But having this occur my Marathon that I prepared hard for taints it a bit. I hold the Portland Marathon in high esteem, and hope this can be at least acknowledged by race organizers, or ideally adjusting our official times in Corral C.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=422c11d0eaec" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Golang’s Upcoming 1.6 Release]]></title>
            <link>https://markholton.medium.com/golang-s-upcoming-1-6-release-20594ee10607?source=rss-6d66f9bc5525------2</link>
            <guid isPermaLink="false">https://medium.com/p/20594ee10607</guid>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Mark Holton]]></dc:creator>
            <pubDate>Tue, 05 Jan 2016 05:54:56 GMT</pubDate>
            <atom:updated>2016-01-05T05:54:56.147Z</atom:updated>
            <content:encoded><![CDATA[<p>The Go 1.6 beta is expected in February 2016. Proactively, the Go team releases the draft of the release notes — worth a look if you’re interested in seeing what’s coming soon:</p><p><a href="https://tip.golang.org/doc/go1.6">Go 1.6 Release Notes DRAFT</a></p><p>Here are the three updates from the upcoming 1.6 release which I am most looking forward to:</p><h3>In the Go 1.6 Release:</h3><h3>1. Vendoring support is no longer considered experimental</h3><blockquote>Go 1.5 introduced experimental support for vendoring, enabled by setting the GO15VENDOREXPERIMENT environment variable to 1. Go 1.6 keeps the vendoring support, no longer considered experimental, and enables it by default. It can be disabled explicitly by setting the GO15VENDOREXPERIMENT environment variable to 0. Go 1.7 will remove support for the environment variable.</blockquote><blockquote>For details about vendoring, see the documentation for the <a href="https://tip.golang.org/cmd/go/#hdr-Vendor_Directories">go command</a> and the <a href="https://golang.org/s/go15vendor">design document</a>.</blockquote><h3>Core Library:</h3><h3>2. HTTP/2 protocol support</h3><blockquote>Go 1.6 adds transparent support in the <a href="https://tip.golang.org/pkg/net/http/">net/http</a> package for the new <a href="https://http2.github.io/">HTTP/2 protocol</a>. Go clients and servers will automatically use HTTP/2 as appropriate when using HTTPS. There is no exported API specific to details of the HTTP/2 protocol handling, just as there is no exported API specific to HTTP/1.1.</blockquote><h3>3. Runtime detection of concurrent misuse of maps</h3><blockquote>As always, if one goroutine is writing to a map, no other goroutine should be reading or writing the map concurrently. If the runtime detects this condition, it prints a diagnosis and crashes the program. The best way to find out more about the problem is to run the program under the <a href="https://blog.golang.org/race-detector">race detector</a>, which will more reliably identify the race and give more detail.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=20594ee10607" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[“I fell in love with the work”]]></title>
            <link>https://markholton.medium.com/i-fell-in-love-with-the-work-1b22c64b090?source=rss-6d66f9bc5525------2</link>
            <guid isPermaLink="false">https://medium.com/p/1b22c64b090</guid>
            <category><![CDATA[behappyinyourwork]]></category>
            <category><![CDATA[seinfeld]]></category>
            <category><![CDATA[dream-job]]></category>
            <dc:creator><![CDATA[Mark Holton]]></dc:creator>
            <pubDate>Tue, 05 Jan 2016 04:50:45 GMT</pubDate>
            <atom:updated>2016-01-05T05:07:45.265Z</atom:updated>
            <content:encoded><![CDATA[<p>I enjoy Jerry Seinfeld’s comedy, and love coffee. Seinfeld’s internet version of ‘A Show About Nothing’ is usually a nice double-shot of relaxing entertainment. Despite generally not enjoying politicians, or politics, this season’s premier with the President was no exception. I especially enjoyed the following thought-provoking exchange:</p><blockquote>Obama: “Let me ask you a question. You’re a funny guy. You go on some late night talk shows… people think you’re funny, they give you a show… and then next thing you know you’ve made a ridiculous amount of money…”</blockquote><blockquote>Seinfeld: “So much more than you 😉 and yet… how do I seem to you? Do I seem spoiled? Out of touch?”</blockquote><blockquote>Obama: “The questions is: How did you calibrate dealing with that? At a certain point, you might have thought to yourself I’m more than just a comedian, I’m going to make the Jewish version of Citizen Kane. How did you keep perspective?”</blockquote><blockquote>Seinfeld: “I’ll give you the real answer. It’s got to be similar to your life. <strong>I fell in love with the work</strong>. <strong>And the work was joyful, and difficult, and interesting, and that was my focus. And that’s it.</strong>”</blockquote><p>What do you find joyful, difficult, and interesting about your chosen work? Is it your Dream Job?</p><p><a href="http://comediansincarsgettingcoffee.com/president-barack-obama-just-tell-him-you-re-the-president">President Barack Obama - Just Tell Him You&#39;re the President - Episode - Comedians In Cars Getting Coffee by Jerry Seinfeld</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1b22c64b090" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[2015 US Open at Chambers Bay]]></title>
            <link>https://markholton.medium.com/2015-us-open-at-chambers-bay-a860a8e4113?source=rss-6d66f9bc5525------2</link>
            <guid isPermaLink="false">https://medium.com/p/a860a8e4113</guid>
            <category><![CDATA[us-open]]></category>
            <category><![CDATA[chambers-bay]]></category>
            <category><![CDATA[golf]]></category>
            <dc:creator><![CDATA[Mark Holton]]></dc:creator>
            <pubDate>Mon, 22 Jun 2015 18:36:18 GMT</pubDate>
            <atom:updated>2015-06-22T18:58:40.663Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8tc4soKSjqDghCd8oW8SQg.jpeg" /><figcaption>View from the 18th hole grandstand at Chambers Bay in the 2015 United States Open</figcaption></figure><p>My friend Derek found us some tickets for the US Open on Friday. It was great to get a day away from responsibilities and get out to the US Open.</p><p>Some thoughts to share on the experience… I’ll start with the bad and end with the good.</p><p>These were the worst tournament greens (professional or amateur) I have ever seen in person. It reflected that on tv, but in person it was really shocking how bad they looked. It looked like Hueston Woods near Miami University at the end of the summer in a drought where they weren’t allowed to water.</p><p>Chambers Bay was a terrible course to walk as a spectator. They have large mounds that would be a perfect amphitheater for holes, but they don’t use them (fear of lawsuits after US Am?). So as a walking spectator you are 20 yards from the green, 20–30 yards from the fairway, and many times with a hill in your way. There is no way to follow groups hole to hole. The walks are in sand. Walking up #14 felt like we were Walter Payton training for the NFL season. Up a 200&#39; hill in sand. There are only a few spots where you can get up close on a tee box. You really had to find a couple spots and sit there. Or sit in the designated bleachers.</p><p>Friday was still a very enjoyable day. We left the house at about 8:10 a.m. and arrived home about 11 pm. It was a great day on the links and we saw everyone: Spieth, Day, Rose, Tiger Woods, Phil Mickelson, Kuchar, Sergio, DJ… you name the player, we saw them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_dcRaf2U8YhMxbeqA4mC1Q.jpeg" /><figcaption>Rory McIlroy on the 6th fairway in round 2 of the 2015 US Open</figcaption></figure><p>Main takeaway: these players today are incredible. I think they are 4 shots better per round than players were 20 years ago. Whether that’s tech, fitness, etc, I don’t know. But the top players rarely miss a shot. And the bottom half of the stack is far better. I went to the Western Open almost every year growing up between 1990 and 2000 and the players then did not consistently hit the shots I saw Friday. On the 540 yard par 4, downhill, 14th hole, they had the pin tucked over a bunker between two ridges on FRIDAY. We sat there for 2.5 hours sipping lemonade. 70% of the players hit their drive down the hill and were left with short irons. And 70% of them landed it on that spot with a 15&#39; radius. It was so firm, required 2 perfect shots.</p><p>The 4th hole (proximal to the 14th) is an uphill 495 yard par 4. The fairway is wide, but if you land on the right side it kicks down the slope into or near the bunker/fescue. Most of these guys just rip it down the left side 300+ yards up the hill. That approach is 2+ clubs uphill, very steep. Friday the pin was tucked in the right corner, over a bunker with a ridge 10 feet behind it. Unreal the number of balls that land in a 15&#39; radius near the pin.</p><p>Cabrera, Bubba and Phil group… never seen 3 players hit the ball this far. Phil was by far the shortest. Cabrera hit a driver on uphill 508 yard par 4 #7 that was so deep and so accurate. Not sure of the distance, it was on a line that was ridiculously right, and ended up carrying everything. Bubba stepped up and hit his drive within 10 feet of Cabrera. Phil swung and one hand fell off the club on his follow through… he was 20 yards behind them but in the fairway.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x2Adym6DF_KeIhFFj9Z32g.jpeg" /><figcaption>9th green at the 2015 US Open at Chambers Bay</figcaption></figure><p>Lastly, besides Phil, Cabrera, Fowler, and Spieth to some extent… saw very few players interact with the crowd in any way. They are so focused, but in some ways it comes off as aloof. But what a difference it makes as a fan when Phil walks by you, seemingly looks you in the eye and nods his head and/or smiles. Or Fowler walks by, scans the crowd and tips his hat. These guys are throwbacks to Watson back in the 80&#39;s 90&#39;s who would do the same thing. Classy display as a competitor, and they do the little things that make a connection with the crowd. It’s no wonder, besides their play, why they last as fan favorites.</p><p>We are in for some great viewing at the British ..and the years ahead.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a860a8e4113" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>