Model Context Protocol Documentation
Welcome to the comprehensive guide for using Model Context Protocol (MCP) in your AI-powered applications. This documentation will help you understand what MCP is, how to use it, and how to select the right MCP servers for your needs.
Overview
Model Context Protocol revolutionizes how AI agents interact with tools, data sources, and services by providing a standardized interface that ensures security, controllability, and extensibility.
Documentation Sections
Navigate through our comprehensive MCP documentation
What is Model Context Protocol?
Understanding the core concepts and architecture of MCP.
Core Concepts
Model Context Protocol (MCP) is a standardized way for Large Language Models (LLMs) to securely access tools and data sources. It provides a flexible and controlled interface that allows AI models to interact with various services while maintaining security and control.
MCP Servers
Implementations that provide specific functionality through a standardized interface. Each MCP server exposes a set of tools or data sources that LLMs can interact with.
SDKs & Libraries
Development kits in TypeScript and Python that make it easy to create MCP servers and clients. These provide all the necessary tools to implement the protocol.
Tools
Specific functions that an MCP server exposes to LLMs. Tools can perform actions like searching the web, accessing databases, or interacting with external APIs.
Resources
Data sources that an MCP server makes available to LLMs. These can include documents, databases, or any other type of information that can be queried or manipulated.
How MCP Works
MCP establishes a standardized communication protocol between LLMs and external tools or data sources. Here's a simplified flow of how it works:
- LLM Request: The LLM generates a request to use a specific tool or access a data source.
- MCP Client: The client formats this request according to the MCP specification and sends it to the appropriate MCP server.
- MCP Server: The server processes the request, executes the required functionality, and returns the results.
- Response Integration: The response is formatted and returned to the LLM, which can then incorporate this information in its reasoning.
Benefits of MCP
Standardization
Common interface for all tools, making them easy to discover, integrate, and use across different LLM systems.
Security
Controlled access to external resources with permission management and authentication.
Extensibility
Easy to create new tools and integrate them into existing systems without changing the core protocol.
Using Local MCP Client
Setting up and running your own MCP servers on your local infrastructure.
Getting Started with Local Installation
Running your own MCP servers locally gives you complete control over your data and functionality. Follow these steps to set up a local MCP environment:
Prerequisites
- Node.js 18+ or Python 3.8+
- Package manager (npm, yarn, pip)
- Basic knowledge of JavaScript/TypeScript or Python
1. Install the MCP SDK
npm install @model-context-protocol/sdk
2. Create a basic MCP server
import { MCPServer } from '@model-context-protocol/sdk';
// Create a new MCP server instance
const server = new MCPServer({
id: 'my-mcp-server',
name: 'My MCP Server',
description: 'My first MCP server implementation'
});
// Register a simple tool
server.registerTool({
id: 'hello',
name: 'Hello Tool',
description: 'Say hello to someone',
parameters: {
type: 'object',
properties: {
name: {
type: 'string',
description: 'The name to say hello to',
},
},
required: ['name'],
},
handler: async (params) => {
const { name } = params;
return { result: `Hello, ${name}!` };
},
});
// Start the server on port 3000
server.listen(3000, () => {
console.log('MCP server running on http://localhost:3000');
});
3. Run your MCP server
npx ts-node server.ts
Advanced Local MCP Features
Custom Authentication
Implement custom authentication mechanisms to control access to your MCP server.
Learn moreResource Configuration
Define complex resources that require configuration or connection to databases.
Learn moreServer Clustering
Run multiple MCP servers in a cluster for high availability and load balancing.
Learn moreDocker Deployment
Package your MCP server in a Docker container for easy deployment and scaling.
Learn moreLocal MCP Benefits
- Complete control over your data and code
- No external dependencies or subscription fees
- Custom integration with your existing systems
- Higher security for sensitive applications
Using Our Hosted MCP Client
Leverage our managed MCP platform to get started quickly without infrastructure concerns.
Hosted MCP Platform
Our hosted MCP platform provides a managed environment where you can deploy and run your MCP servers without worrying about infrastructure, scaling, or maintenance. This is the quickest way to get started with MCP.
Getting Started with Hosted MCP
- Create an Account: Sign up for our hosted MCP platform to get your API key and access to our dashboard.
- Create a Project: From the dashboard, create a new MCP project with a name and description.
- Deploy Your MCP Server: Upload your MCP server code or use our templates to create a new server.
- Configure Authentication: Set up authentication methods and access controls for your MCP server.
- Start Using Your MCP: Integrate your hosted MCP server with your application using the provided endpoints.
Quick Integration
Connect to a hosted MCP server with just a few lines of code
import { MCPClient } from '@model-context-protocol/client';
// Initialize the client with your MCP server URL and API key
const client = new MCPClient({
serverUrl: 'https://api.mcp.4agent.ai/v1/your-project-id',
apiKey: 'YOUR_API_KEY',
timeout: 30000 // optional timeout in milliseconds
});
// Call a tool on the MCP server
async function greetUser() {
try {
const response = await client.invokeTool('hello', {
name: 'World'
});
console.log(response.result); // Output: "Hello, World!"
return response;
} catch (error) {
console.error('Error calling tool:', error);
throw error;
}
}
greetUser();
Hosted MCP Features
Automatic Scaling
Your MCP servers automatically scale based on demand, ensuring optimal performance under any load.
Usage Analytics
Detailed analytics on tool usage, performance metrics, and error rates to help optimize your implementation.
Integrated Security
Built-in security features including API key management, rate limiting, and audit logs.
MCP Catalog and Selection Guide
Browse the comprehensive catalog of MCP servers and learn how to choose the right ones for your application.
Understanding the MCP Catalog
Our MCP catalog contains hundreds of ready-to-use MCP servers for various domains and functionalities. From data processing to external API integrations, you can find MCP servers for almost any task.
MCP Categories
Tools
General-purpose utilities like file handling, data processing, and system operations.
Database
Connectors for various databases and storage systems, from SQL to vector databases.
Chat
Chat models and conversation interfaces for interactive AI applications.
Image
Image generation, manipulation, and analysis services for visual content.
Audio
Audio processing, transcription, and generation services for sound content.
DevOps
Tools for infrastructure management, CI/CD, monitoring, and deployment.
How to Choose the Right MCP
Selecting the right MCP servers for your application depends on various factors. Here's a guide to help you make the best choice:
Assess Your Requirements
Start by identifying the specific functionality you need. Do you need data storage, external API access, or specialized processing capabilities? Make a list of the core features your application requires.
Consider Integration Type
MCP servers offer different integration types: API-based, SDK-based, or direct integration. Choose based on your development environment and technical requirements:
- API: Best for cross-platform compatibility and loose coupling
- SDK: Provides deeper integration and type safety in your code
- Direct: For specialized use cases requiring tight integration
Evaluate Complexity
MCP servers are rated by complexity (low, medium, high). Choose a complexity level that matches your team's technical expertise and the time you can dedicate to integration:
- Low: Simple APIs with minimal configuration, good for rapid development
- Medium: More features but requires some setup and configuration
- High: Advanced functionality with extensive options, may require deeper technical knowledge
Check MCP Type
MCP servers are categorized by their source and support model:
- Official: Developed and maintained by established providers with formal support
- Community: Open-source implementations maintained by the community
- Reference: Example implementations for educational purposes
Consider Pricing
Evaluate the pricing model and ensure it aligns with your budget and usage patterns. Some MCPs are free, others offer tiered pricing, and some use usage-based billing.
Check Usage Statistics
Popular MCPs with high usage counts often indicate reliable, well-tested implementations. However, newer MCPs might offer cutting-edge features despite lower usage numbers.
Review Documentation and Examples
Evaluate the quality of documentation, implementation guides, and code examples to ensure smooth integration into your project.
Popular MCP Combinations
Certain MCP combinations work well together for specific use cases. Here are some recommended configurations:
AI Assistant Stack
For building conversational AI assistants
- ChatGPT MCP
Core conversation capabilities
- VectorDB MCP
Knowledge retrieval
- Memory MCP
Persistent conversation context
Frequently Asked Questions
Common questions about MCP and their answers.
What makes MCP different from other AI integration approaches?
MCP provides a standardized protocol for AI models to interact with tools and data sources. Unlike custom integrations, MCP offers a unified interface, security controls, and a consistent experience across different LLMs and tools. This standardization makes it easier to discover, integrate, and manage AI capabilities.
Can I use MCP with any language model?
Yes, MCP is designed to work with any LLM that follows the protocol specification. Many popular models like ChatGPT, Claude, and open-source models support MCP natively or through adapters. Our SDKs make it easy to connect various models to the MCP ecosystem.
Is MCP secure for handling sensitive data?
MCP is built with security in mind. It includes features like authentication, permission management, and controlled access to resources. When using local MCP clients, your data remains within your infrastructure. Our hosted service offers enterprise-grade security features including encryption, audit logs, and compliance with industry standards.
How much does it cost to use MCP?
The core MCP protocol and SDKs are open-source and free to use. If you're self-hosting, you only pay for your infrastructure costs. Our hosted MCP platform offers various pricing tiers starting with a free tier for individual developers, professional plans for teams, and enterprise options for large organizations.
Can I create my own custom MCP servers?
Absolutely! Creating custom MCP servers is straightforward using our SDKs for TypeScript or Python. You can implement tools that expose your specific functionality or data sources, and even publish them to the MCP catalog for others to use. Our documentation includes detailed guides for building custom MCP servers.
What's the difference between MCP and other AI frameworks like LangChain?
MCP is focused on providing a standardized protocol for tool and data access, while frameworks like LangChain offer higher-level abstractions for building AI applications. In fact, they complement each other well - you can use LangChain to build your application flow and MCP to standardize how your AI interacts with external tools and services.
How do I handle versioning and compatibility in MCP servers?
MCP includes versioning mechanisms in the protocol specification. When you create an MCP server, you can specify which versions of the protocol you support. Clients can then negotiate the appropriate version to use. Our SDKs handle most of the compatibility details automatically, ensuring smooth upgrades and backward compatibility.
Can MCP work in environments with limited connectivity?
Yes, MCP is designed to be flexible in various networking environments. For offline or limited connectivity scenarios, you can deploy local MCP servers that don't require external access. The protocol also supports asynchronous operations for handling intermittent connectivity issues.
Still Have Questions?
Get help from our community or support team