Final Project — Building a Smart Business Assistant

Episode 10 20 min

What We Have Covered So Far

Congratulations — you have made it to the final episode of the MCP — Building AI-Connected Tools series. It has been quite a journey: we started with what MCP is and why it matters, set up our first server, learned to build custom servers, explored Resources and Prompts, connected everything to Claude and other models, and took security seriously.

Now it is time to put all the pieces together and design a real project: a smart business assistant that coordinates multiple MCP servers to handle complex, multi-step tasks.

About This Episode
This episode focuses on architecture and design rather than heavy coding. The goal is to see how the different MCP components fit together like building blocks to form a working system. Code snippets are conceptual and brief — the emphasis is on the “why” and the “how to think about it.”

What Are We Building?

Imagine you run a company (or work at one) and face dozens of questions every day:

  • “What were our sales last month?”
  • “What feedback have we received on the new product?”
  • “Prepare a summary report for tomorrow’s meeting.”
  • “Let the sales team know the new campaign has launched.”
  • “Search our internal docs for the vacation policy.”

Each of these currently requires a different tool: a finance dashboard, CRM, email client, messaging app, internal wiki. Ten tabs, ten passwords, ten different interfaces.

Now imagine a single AI assistant that handles all of this from one place. You tell it what you need in plain language, and it figures out which tool to use, fetches the data, processes it, and delivers the result. That is exactly what you can build by combining multiple MCP servers.

Analogy
Think of an exceptional executive assistant — someone who knows the financial system, can send emails, has the company handbook memorized, and is fluent in the CRM. You just say “I need this done” and they handle every step. We are designing the digital version of that assistant — powered by MCP.

System Architecture

Our smart assistant is made up of three distinct layers. Each layer has a clear responsibility and operates independently:

Layer 1: MCP Servers (Specialized Brains)

Each MCP server has a single area of expertise, much like departments in a company:

  • Database Server: Connected to the company database — sales, customers, products. Any time you need numbers, this server answers.
  • RAG Server: Searches internal documents — policies, reports, training materials. When someone asks “What is our return policy?”, this server handles it.
  • Communication Server: Sends messages — email, Slack, SMS. Whenever information needs to reach someone, this server steps in.
  • Analytics Server: Analyzes data and produces reports. It turns raw numbers into actionable insights.
Tip
You do not need to build all of these from scratch. Ready-made MCP servers exist for PostgreSQL, Slack, GitHub, and many other services. The art is knowing which servers to combine and when to build a custom one for your specific needs.

Layer 2: AI Client (Central Brain)

This is the language model (such as Claude) connected to all the MCP servers. It acts as the orchestrator. When you ask a question, the model:

  1. Analyzes your request and understands the intent
  2. Decides which server(s) to call
  3. Gathers information from multiple servers if needed
  4. Combines and analyzes the data
  5. Presents the final result in a useful format

The key point is that the language model decides on its own which tools to use. You do not need to hardcode a workflow. Just write clear tool descriptions and the model handles the rest. This is the concept of an AI Agent — the language model acting as an intelligent decision-maker.

Layer 3: User Interface (Frontend)

This could be a web chatbot, a Telegram bot, a Slack bot, or even a dashboard. What matters is that the user can express their request in natural language. The beauty of this architecture is that the UI has no direct connection to the MCP servers — it only talks to the language model, and the model does the rest.

Designing the Database Server

Let us look at the first server in more detail. The Database Server connects to your company database and exposes tools for accessing business data.

Required Tools:

// Database Server tools
tools: [
  {
    name: "query_sales",
    description: "Get sales data for a given period",
    parameters: { start_date, end_date, product_id? }
  },
  {
    name: "get_customer_info",
    description: "Get customer details by ID or name",
    parameters: { customer_id?, name? }
  },
  {
    name: "get_product_stats",
    description: "Product performance statistics",
    parameters: { product_id, period }
  }
]

The critical rule: tools should be read-only, at least initially. You do not want AI modifying your database without your explicit approval. This is the Least Privilege principle we covered in the security episode.

Warning
Never give AI direct SELECT * access or the ability to run arbitrary SQL. Define specific, constrained tools. The AI should only access data through pre-defined tool interfaces. Remember: language models can be prompt-injected and may attempt to run destructive queries.

Resources for Static Data:

Some information rarely changes and does not need a query each time. Define these as Resources:

resources: [
  {
    uri: "db://schema/tables",
    name: "Database Schema",
    description: "List of all tables and their columns"
  },
  {
    uri: "db://config/products",
    name: "Product Catalog",
    description: "Current product list with categories"
  }
]

This way, the language model knows the database structure from the start and does not need to ask you every time. It also improves performance and reduces token costs.

Designing the RAG Server

The second server handles internal document search. If you have read the RAG from Zero to Production series, you are familiar with Retrieval-Augmented Generation. Here, we are packaging RAG as an MCP server so that any client can use it.

Why RAG as an MCP Server?

Simple: because you want the same RAG system accessible from any client. Whether the user is on the web chat, Slack, or a CLI tool, they all connect to the same RAG server. Build once, use everywhere — the core benefit we discussed in episode one.

// RAG Server tools
tools: [
  {
    name: "search_documents",
    description: "Search company docs using semantic search",
    parameters: { query, department?, doc_type? }
  },
  {
    name: "get_document",
    description: "Get full content of a specific document",
    parameters: { document_id }
  }
]

// Pre-defined prompts
prompts: [
  {
    name: "summarize_policy",
    description: "Summarize a company policy in plain language",
    arguments: { policy_name }
  }
]
Analogy
The RAG server is like a digital librarian. When you have a question, the librarian searches through all the documents, finds the most relevant ones, and presents them to you. Unlike simple keyword search (like Ctrl+F), it understands the meaning of your question. If you ask about “time-off rules,” it can find a document titled “HR Policies” that contains the relevant information.

Designing the Communication Server

This server handles outbound communication. Anywhere a message needs to be sent — email, Slack, SMS, notifications — this server takes over:

tools: [
  {
    name: "send_email",
    description: "Send email (requires human approval)",
    parameters: { to, subject, body, cc? }
  },
  {
    name: "send_slack_message",
    description: "Send a Slack message to a channel or user",
    parameters: { channel, message }
  },
  {
    name: "create_task",
    description: "Create a task in project management tool",
    parameters: { title, assignee, due_date?, priority? }
  }
]
Important
The Communication Server is the most sensitive server in the system because it has external impact. Other tools only read data, but this one communicates with the outside world. Always enable human-in-the-loop confirmation. The AI should never send an email or message without your approval. Add a confirmation step: “I’d like to send this email — do you approve?”

The Magic of Composition — A Real Scenario

Let us see what happens when all servers work together. Suppose you ask your assistant:

“Summarize last month’s sales report, and if we are behind target, send the results to the sales team.”

Sounds like a simple request. Behind the scenes, the smart assistant goes through these steps:

  1. Understanding the request: The language model identifies the need for sales data, target data, and potentially messaging
  2. Database Server → query_sales: Fetches last month’s detailed sales data
  3. Database Server → get_product_stats: Adds per-product performance to identify strengths and weaknesses
  4. RAG Server → search_documents: Finds the monthly sales targets from internal documentation for comparison
  5. Analysis and decision: The language model compares actual sales against targets — are we behind?
  6. Report generation: Writes a clear, professional summary of the situation
  7. Communication Server → send_slack_message: If behind target, prepares the report for the sales team channel (pending your approval)

Seven steps. But you only said one sentence. This is the power of composing MCP servers. Each server solves one piece of the puzzle, and the language model assembles them.

Tip
Notice that the model also made a conditional decision: “if we are behind, send it.” This is the Agent capability — the model does not just call tools mindlessly, it reasons about results and decides what to do next.

Client Configuration

To connect all servers to a single client, the configuration looks like this. Notice how local and remote servers coexist:

{
  "mcpServers": {
    "database": {
      "command": "node",
      "args": ["./servers/database/index.js"],
      "env": {
        "DB_HOST": "localhost",
        "DB_NAME": "company_db"
      }
    },
    "rag": {
      "url": "http://rag-server:3001/mcp",
      "headers": {
        "Authorization": "Bearer ${RAG_API_KEY}"
      }
    },
    "communication": {
      "url": "http://comm-server:3002/mcp",
      "headers": {
        "Authorization": "Bearer ${COMM_API_KEY}"
      }
    }
  }
}

Notice: the Database Server runs locally (stdio) because it needs direct database access and traffic should not cross the network. The RAG and Communication servers run remotely (HTTP) because they may live on separate machines or serve multiple clients simultaneously.

Error Handling and Resilience

In real systems, things go wrong. A server might be down, the database slow to respond, or an external API might return errors. A good system must be prepared:

1. Appropriate Timeouts

Every tool needs a defined timeout. If the database does not respond within 30 seconds, return an error rather than making the user wait indefinitely. A bad user experience is worse than no answer at all.

2. Smart Fallbacks

If a server is unavailable, the assistant should communicate clearly: “I cannot access the sales database right now. Would you like me to try again later?” Rather than crashing entirely, the system should degrade gracefully.

3. Retry with Backoff

For transient errors (like network timeouts), implement retry with exponential backoff. First attempt after 1 second, second after 2 seconds, third after 4 seconds. After three tries, stop and inform the user.

Tip
A useful pattern is giving each MCP server a health_check tool. The client can check server health before starting work. If a server is down, it can inform the user upfront: “The database is currently unavailable, but I can search the documents.”

Building Incrementally

A very common mistake is trying to build everything from day one. Do not do that. Build in phases, and make sure each phase is stable and tested before moving to the next:

Phase 1: Database Server Only (Weeks 1-2)

Start with a single server. Just the database. Three or four simple tools: reading sales, customer info, product stats. Make sure it works correctly, errors are handled, and security is solid. Use it yourself daily.

Phase 2: Add RAG (Weeks 3-4)

Once the Database Server is stable, add the RAG server. Now your assistant reads from the database and searches documents. Watch how the model decides between the two servers. Does it choose correctly? Are the tool descriptions clear enough?

Phase 3: Communication (Weeks 5-6)

Add the Communication Server, but always with human-in-the-loop. No message should be sent without your approval. Test this phase with a small number of users.

Phase 4: Automation (After 2 Months)

Once you know the system well and trust it, you can automate certain workflows. For example: “Every morning at 8 AM, summarize yesterday’s sales and post to Slack.” But keep human approval for important emails.

Analogy
Building this system is like building a house. First the foundation (Database Server), then the walls (RAG), then plumbing and electrical (Communication), and finally smart home automation. If you try to build everything simultaneously, the house collapses.

Testing and Validation

Before handing the system to your team, test it thoroughly yourself. This checklist will help:

  • Test each server individually: Ensure each server works correctly on its own — try various inputs, verify outputs
  • Integration tests: Design scenarios that involve multiple servers simultaneously (like the sales report example)
  • Failure tests: Deliberately shut down a server and observe how the system reacts. Does it give a clear error message?
  • Security tests: Try accessing unauthorized data through AI — test for prompt injection
  • User testing: Have a non-technical person use it and observe where they get confused or receive unexpected results

Series Recap

Let us take a bird’s-eye view of the journey we have completed:

  1. What Is MCP and Why Does It Matter? — The protocol concept, the M×N problem, and why MCP is like USB for AI
  2. Setting Up Your First MCP Server — Hands-on installation, first run, and connecting to Claude Desktop
  3. Building a Custom MCP Server — Building a server from scratch with the TypeScript SDK
  4. Resources and Prompts — Read-only data and interaction templates
  5. Connecting to Claude and Other Models — Configuring various clients
  6. Security and Best Practices — Least Privilege, input validation, sandboxing
  7. MCP in Production — Docker, monitoring, scaling
  8. Final Project (this episode) — Combining all concepts into a real system
An Honest Note
MCP is still a relatively young technology that is evolving rapidly. Some of the tools and approaches that are best practices today may be superseded by better methods in a few months. But the fundamental concepts you learned in this series — client-server architecture, good tool design, security, testing — these do not change, and they will serve you well regardless of what comes next.

Next Steps

Now that you have learned MCP concepts, several exciting paths lie ahead:

Go Deeper:

  • If you want to learn more about building AI Agents — read the Agents series. MCP without agents is only half its potential.
  • If building a RAG server interests you — check out the RAG from Zero to Production series for a deep dive into embeddings, vector stores, and evaluation.
  • If you want to customize models on your own data — read the Practical Fine-tuning series.

Get Hands-on:

  • Build a simple MCP server for a real need — such as accessing your company’s API
  • Explore the community’s ready-made MCP servers and experiment with combining them
  • Contribute to the official MCP repository — even a small bug fix is valuable

Useful Resources:

Conclusion

MCP represents a fundamental shift in how AI interacts with the real world. Language models used to be trapped in a bubble — intelligent but unable to take real action. With MCP, they can connect to any tool and any data source. And crucially, that connection is standardized and secure — not a temporary hack.

In this series, you learned that MCP is not just an API wrapper. It is a complete protocol with Tools, Resources, and Prompts. You learned to build servers, connect them to clients, keep them secure, and deploy to production. And in this final episode, you saw how to compose multiple servers into a real smart assistant.

I hope this series has been valuable to you. If you have questions or would like to discuss implementing MCP in your business, I would be happy to talk.