✨ From vibe coding to vibe deployment. UBOS MCP turns ideas into infra with one message.

Learn more

UBOS Asset Marketplace: Empowering AI Agents with the Model Context Protocol (MCP) Framework

In the rapidly evolving landscape of Artificial Intelligence, the need for AI agents to seamlessly interact with external data sources and tools is paramount. This is where the Model Context Protocol (MCP) comes into play. MCP provides a standardized way for applications to supply context to Large Language Models (LLMs), enabling more intelligent and context-aware AI interactions. UBOS, as a full-stack AI Agent Development Platform, recognizes the critical importance of MCP and offers robust support for it through its Asset Marketplace.

This document focuses on the @ronangrant/mcp-framework, a TypeScript framework specifically designed for building MCP servers. This framework simplifies the development process, offering a structured and efficient way to create servers that facilitate communication between AI models and the external world. This specific version of the framework prioritizes compatibility and reliability by using console-only logging and eliminating file system dependencies, mitigating common errors.

Understanding the MCP Framework and Its Significance

The Model Context Protocol (MCP) is more than just a technical specification; it’s a foundational element for building intelligent and versatile AI agents. Imagine an AI agent tasked with generating a financial report. Without MCP, the agent would be limited to the data it inherently possesses. With MCP, however, the agent can leverage external APIs to fetch real-time stock prices, access market analysis reports, and even integrate with accounting software to gather relevant financial data. This expanded access allows the AI agent to generate a comprehensive and accurate financial report, far exceeding its initial capabilities.

By standardizing the way applications provide context to LLMs, MCP unlocks a new level of potential for AI applications across diverse industries. It allows developers to create AI agents that are not only intelligent but also deeply integrated with the real-world data and tools they need to perform complex tasks effectively.

The @ronangrant/mcp-framework: A Practical Solution for MCP Server Development

The @ronangrant/mcp-framework is a TypeScript framework that dramatically simplifies the process of building MCP servers. It offers a range of features that streamline development, including:

  • Automatic Discovery: The framework automatically discovers and loads tools, resources, and prompts based on directory structure. This eliminates the need for manual configuration and reduces the risk of errors.
  • TypeScript-First Development: Built with TypeScript, the framework provides full type safety, enhancing code reliability and developer productivity.
  • Built on the Official MCP SDK: The framework is built on the official MCP SDK, ensuring compatibility and adherence to MCP standards.
  • Easy-to-Use Base Classes: Provides base classes for tools, prompts, and resources, simplifying the creation of custom components.
  • Multiple Transport Support: Supports stdio and SSE (Server-Sent Events) transports, providing flexibility in how the server communicates with clients.
  • Out-of-the-Box Authentication: Offers authentication options for SSE endpoints, enhancing security.

Key Features of @ronangrant/mcp-framework

  1. Simplified Logging: This fork replaces file-based logging with console-only logging, enhancing compatibility and reliability. The removal of file system dependencies eliminates ENOENT errors, streamlining debugging and deployment.

  2. Easy Installation: Installing the framework is straightforward using npm: npm install @ronangrant/mcp-framework

  3. Intuitive API: Creating a new MCP server is simple, as demonstrated by the code example:

    typescript import { MCPServer } from ‘@ronangrant/mcp-framework’;

    const server = new MCPServer({ name: “my-server”, version: “1.0.0” });

    await server.start();

  4. CLI Tooling: The framework includes a powerful CLI for managing MCP server projects. You can create new projects, add tools, prompts, and resources using simple commands:

    • mcp create <your project name here> - Creates a new project.
    • mcp add tool <tool name> - Adds a new tool.
    • mcp add prompt <prompt name> - Adds a new prompt.
    • mcp add resource <resource name> - Adds a new resource.

Use Cases: Unleashing the Power of MCP Servers

The @ronangrant/mcp-framework facilitates the creation of MCP servers that can be used in a wide array of applications. Here are a few illustrative use cases:

  • Enhanced Customer Support Bots: Imagine a customer support bot that can access real-time product information, customer order history, and support documentation via an MCP server. This allows the bot to provide more accurate and personalized support, resolving customer issues quickly and efficiently.
  • AI-Powered Financial Analysis: An MCP server can connect an AI agent to financial data sources, enabling it to perform complex financial analysis, generate reports, and provide investment recommendations.
  • Automated Content Creation: An AI agent can leverage an MCP server to access various data sources, such as news articles, social media feeds, and research papers, to generate engaging and informative content for websites, blogs, and social media platforms.
  • Intelligent Task Management: An MCP server can integrate an AI agent with task management systems, allowing it to automate task creation, prioritization, and assignment, improving team productivity and efficiency.
  • Dynamic Pricing Optimization: By connecting an AI agent to real-time market data and competitor pricing information via an MCP server, businesses can dynamically adjust prices to maximize revenue and maintain a competitive edge.

Integrating with UBOS: A Seamless AI Agent Development Experience

UBOS provides a comprehensive platform for building and deploying AI agents. Integrating the @ronangrant/mcp-framework with UBOS allows you to leverage the framework’s capabilities within the UBOS ecosystem, creating a seamless AI agent development experience.

With UBOS, you can:

  • Orchestrate AI Agents: Design and manage complex multi-agent systems with ease.
  • Connect to Enterprise Data: Securely connect your AI agents to your existing enterprise data sources.
  • Build Custom AI Agents: Customize AI agents using your own LLM models.
  • Deploy and Scale: Deploy and scale your AI agents effortlessly on the UBOS platform.

By combining the power of the @ronangrant/mcp-framework with the capabilities of UBOS, you can unlock the full potential of AI agents, transforming your business and driving innovation.

Development Workflow with @ronangrant/mcp-framework

The typical development workflow using the @ronangrant/mcp-framework involves the following steps:

  1. Project Creation: Use the CLI to create a new MCP server project: mcp create my-mcp-server
  2. Adding Components: Add tools, prompts, and resources as needed using the CLI: mcp add tool data-fetcher
  3. Implementation: Implement the logic for your tools, prompts, and resources using TypeScript.
  4. Building: Build the project using npm run build.
  5. Testing: Test the MCP server locally using tools like Claude Desktop (configuration examples provided in the original documentation).
  6. Deployment: Deploy the MCP server to a suitable environment.

Transport Configuration Options

The framework offers flexibility in configuring the transport layer. You can choose between the default stdio transport or the sse transport. The sse transport allows you to configure CORS (Cross-Origin Resource Sharing) settings and authentication methods, providing enhanced security and control.

stdio Transport

The stdio transport is the default transport and is suitable for local development and testing.

typescript const server = new MCPServer({ transport: { type: “stdio” } });

SSE Transport

The sse transport is suitable for production environments and allows you to configure CORS and authentication.

typescript const server = new MCPServer({ transport: { type: “sse”, options: { port: 8080, cors: { allowOrigin: “https://myapp.com”, allowMethods: “GET, POST”, allowHeaders: “Content-Type, Authorization”, exposeHeaders: “Content-Type, Authorization”, maxAge: “3600” } } } });

Authentication Options for Enhanced Security

The @ronangrant/mcp-framework provides optional authentication for SSE endpoints. You can choose between JWT (JSON Web Token) and API Key authentication, or implement your own custom authentication provider.

JWT Authentication

typescript import { MCPServer, JWTAuthProvider } from “mcp-framework”; import { Algorithm } from “jsonwebtoken”;

const server = new MCPServer({ transport: { type: “sse”, options: { auth: { provider: new JWTAuthProvider({ secret: process.env.JWT_SECRET, algorithms: [“HS256” as Algorithm], headerName: “Authorization” }), endpoints: { sse: true, messages: true } } } } });

API Key Authentication

typescript import { MCPServer, APIKeyAuthProvider } from “mcp-framework”;

const server = new MCPServer({ transport: { type: “sse”, options: { auth: { provider: new APIKeyAuthProvider({ keys: [process.env.API_KEY], headerName: “X-API-Key” }) } } } });

Conclusion: Embracing MCP for Intelligent AI Agents

The Model Context Protocol (MCP) is a crucial enabler for building intelligent and versatile AI agents. The @ronangrant/mcp-framework provides a robust and efficient way to create MCP servers, simplifying the development process and allowing you to focus on building innovative AI applications.

By integrating the @ronangrant/mcp-framework with the UBOS platform, you can unlock the full potential of AI agents, transforming your business and driving innovation. Embrace MCP and empower your AI agents with the context they need to excel.

Furthermore, the framework’s MIT license ensures its accessibility and promotes its widespread adoption within the AI community. As UBOS continues to champion the advancement of AI agent technology, the integration of robust MCP frameworks like @ronangrant/mcp-framework remains a cornerstone of its strategy.

Featured Templates

View More
AI Agents
AI Video Generator
252 2007 5.0
AI Characters
Sarcastic AI Chat Bot
129 1713
AI Assistants
Image to text with Claude 3
152 1366
AI Engineering
Python Bug Fixer
119 1433

Start your free trial

Build your solution today. No credit card required.

Sign In

Register

Reset Password

Please enter your username or email address, you will receive a link to create a new password via email.