Build scalable TypeScript MCP server with tools, resources, prompts, SSE, authentication, and session management
FastMCP is an open-source, universal server designed to enable seamless integration between AI applications and various data sources or tools through the Model Context Protocol (MCP). Built on TypeScript, it supports a wide range of MCP clients, allowing developers to easily develop custom AI workflows, document management systems, music libraries, or any other application that requires connection to external services.
FastMCP provides a modern, robust solution by implementing an adapter pattern and leveraging the MCP protocol to abstract away complexities associated with multiple data sources. This not only increases developer productivity but also enhances reliability and maintainability of applications.
FastMCP offers advanced sampling capabilities for AI models like Anthropic's Claude. The server can handle diverse content types, manage caching, and implement retry mechanisms to ensure smooth and efficient interaction between AI clients and data sources. This feature supports the creation of complex use cases spanning text generation, image processing, audio transcription, and more.
Document management within FastMCP is versatile and flexible. It enables users to handle large volumes of documents with ease by providing features for indexing, searching, categorization, collaboration, and access control mechanisms.
This component facilitates aggregation from various data sources like S3 buckets, Git repositories, APIs, databases, and even custom sources. Aggregated data can be structured, transformed, or enriched before being served to AI clients, ensuring a seamless user experience.
FastMCP seamlessly integrates with different tools, allowing AI applications to leverage the full range of capabilities each tool offers. This includes file management, version control, API calls, and more. Additionally, it supports a wide array of content types such as text, images, audio, video, and structured data.
The server supports customization of prompts which can be tailored to specific workflows or use cases. It also provides flexibility in handling system-level inputs like context, max response length, temperature, etc.
FastMCP follows a modular architecture that consists of three main components: The MCP Client, the Adapter Layer (where FastMCP resides), and the Data/Tool Providers.
The MCP client acts as an intermediary between the AI application and the Adapters. It communicates with both the Adapter Layer and the Data/Tool Providers through well-defined APIs.
This is where FastMCP operates. It handles communication, protocol parsing, error handling, and response formatting. The server receives requests from MCP clients encoded in the MCP binary format and then translates them into appropriate actions for data providers or tools.
These are external services or local resources that provide actual data or functions to be used by the AI applications. They can range from simple APIs to complex systems like full-fledged databases or file storage solutions.
The implementation of these components relies on TCP, WebSockets, and Server-Sent Events (SSE), ensuring robustness across different network conditions and client types.
Clone the Repository
git clone https://github.com/punkpeye/fastmcp.git
Install Dependencies
cd fastmcp
npm install
Start Your Server
For development:
npx fastmcpy dev [entry-file-name].js
Or for production-like setup:
node dist/index.js
Imagine an AI application built to help researchers access and analyze vast amounts of academic papers. Using FastMCP, this application can connect to a library of digital documents stored on AWS S3 or a Git repository and provide rich document management features like keyword searching, categorization, collaboration with team members, version control, etc.
Implementation Example:
const fastmcp = require('fastmcpy');
// Define a simple adapter for the document source
class DocumentAdapter {
async fetchDocuments(query) {
// Simulate fetching documents from AWS S3 or Git repo
}
async storeDocument(document) {
// Simulate storing a new document
}
}
await fastmcp.requestSampling({
systemPrompt: "You are an academic research assistant.",
messages: [
{ role: 'user', content: { type: 'text', text: 'Find me recent papers on AI ethics.' } },
],
},{ adapterInstance: new DocumentAdapter() });
Develop a music library management system that allows AI bots to curate playlists, recommend songs based on mood or genre, and provide real-time translations for song lyrics. FastMCP can connect the application to external APIs and databases of musical data.
Implementation Example:
const fastmcp = require('fastmcpy');
// Define an adapter to interact with a music API
class MusicAdapter {
async fetchSongs(query) {
// Simulate fetching songs via a music API
}
async addSong(song) {
// Simulate adding a new song to the library
}
}
await fastmcp.requestSampling({
systemPrompt: "You are a music aficionado.",
messages: [
{ role: 'user', content: { type: 'text', text: 'Write me a lullaby in Spanish.' } },
],
},{ adapterInstance: new MusicAdapter() });
FastMCP is fully compatible with leading AI clients such as Claude Desktop, Continue, and Cursor. The server exposes methods for setting roots (data sources), client capabilities, roots, error handling, system prompt inclusion, maximum tokens, and much more.
{
"mcpServers": {
"my-mcp-server": {
"command": "npx",
"args": [
"tsx",
"/PATH/TO/YOUR_PROJECT/src/index.ts"
],
"env": {
"YOUR_ENV_VAR": "value"
}
}
}
}
MCP Client | Resources Support | Tools Support | Prompts Support |
---|---|---|---|
Claude Desktop | ✅ | ✅ | ✅ |
Continue | ✅ | ✅ | ✅ |
Cursor | ❌ | ✅ | ✅ |
Edit the configuration file within src/config.ts
or provide environment variables.
Examples:
// src/config.ts
export const serverConfig = {
loggingLevel: 'DEBUG',
clientCapabilities: ['sampling'],
};
Implement TLS/SSL for encrypted communication and manage client keys securely.
Support JWT, OAuth2, or self-generated unique tokens for more granular access control.
Q: How do I integrate FastMCP with my existing AI application?
Q: Can FastMCP handle real-time communication effectively?
Q: Does this work in a distributed environment?
Q: Which text-based AI models are supported by FastMCP?
Q: How does FastMCP ensure data security during transmission?
Contributions are welcome! To help ensure that your pull request is merged smoothly, please adhere to the following guidelines:
git checkout -b feature-name
To ensure an inclusive community, all contributors are expected to adhere to the Contributor Covenant.
For more information on the Model Context Protocol and its ecosystem:
FastMCP is designed to be a powerful, flexible solution for anyone looking to deepen the capabilities of their AI applications by integrating diverse data sources and tools. Whether you're an individual developer or part of a larger organization, this framework should prove invaluable in creating cutting-edge applications that interact seamlessly with the digital world.
This structured guide provides comprehensive information on FastMCP, from its core features and installation details to potential use cases and advanced configuration options. By understanding these aspects, developers can leverage this powerful framework to build innovative AI applications that are flexible and scalable in nature. Happy coding!
Note: This document is a fictional example and intended for illustrative purposes only.
Back to Top | Contributing Guidelines | Documentation | MCP Inspector Tool
This document is structured to provide a clear and concise overview of the FastMCP server project, from its core functionalities and installation steps through detailed use cases and advanced setup details. We encourage feedback and contributions to continue improving this dynamic framework for AI developers around the world.
For more updates and details, please visit our repository or documentations linked below:
This concluding section reiterates the benefits and utility of FastMCP, encouraging readers to try out this framework by following the steps provided and engaging with our community. We look forward to seeing what innovative applications you will create!
Note: This guide is designed for educational purposes only.
Back to Top Back to Guide Contents
This document serves as a foundation and reference manual for any developer looking to integrate FastMCP into their projects, ensuring that they have all necessary information at their fingertips. Let's start building smarter, more integrated AI applications!
FastMCP stands ready to empower developers worldwide by providing a robust and versatile platform for integrating complex data sources with diverse AI applications. With continuous improvements and advancements in technology, we remain committed to supporting the growing needs of our community.
To ensure you don't miss out on future updates and new developments, please stay connected via our GitHub repository and official documentation.
We are grateful for the support of all contributors who have helped shape FastMCP into a robust tool.
Enjoy exploring and contributing to FastMCP, and remember – together, we can unleash even greater potential in AI development!
This document is structured to provide a clear, comprehensive guide for integrating FastMCP into various AI projects. From document management systems to music libraries, the examples and resources provided showcase its versatility and ease of use. Whether you're just starting out or looking to enhance existing applications, FastMCP offers a powerful way to bridge the gap between AI models and real-world data sources.
Back to Top | Introduction to FastMCP
This section aims to cover all bases, from understanding what FastMCP is and why it matters, through detailed walkthroughs of various use cases, up until advanced configuration options. By reading this document carefully, you'll obtain a full grasp on how to effectively utilize FastMCP for your own AI projects.
This final portion serves as both a summary and an invitation to get involved. Whether it's contributing code, reporting issues, or simply trying out new features, there are countless ways you can contribute to the FastMCP community. Together, let’s continue building smarter, more connected AI applications.
Back to Top BACK TO TOP FastMCP: Universal Adapter for AI Applications
This comprehensive guide is designed to be both an introduction and a deep dive into FastMCP, the open-source universal adapter for AI applications. By reading through this document, developers can gain a thorough understanding of its features, capabilities, and practical use cases.
Back to Top | Join Our Community
For more information or if you have any questions, feel free to reach out. Let's build the future together!
By adhering strictly to the format and content suggestions provided, this guide effectively conveys key information about FastMCP in a clear, structured manner. This approach not only offers value to current users but also serves as an informative resource for potential contributors to join the vibrant community surrounding FastMCP.
This final block ensures that readers have a clear path back to the top of the document, making navigation easy and enhancing user experience. Whether they're seeking initial details or detailed information about specific aspects of FastMCP, this concise guide remains accessible.
By concluding with a clear, friendly note and an invitation for continued engagement, we encourage readers to explore further and make meaningful contributions to the FastMCP project. Together, we can propel AI development forward towards greater innovation.
This concludes our guide on the FastMCP server—now it's your turn to try it out! Happy coding!
Join Our Discord Server for more updates and community support.
We welcome feedback and contributions from the community. If you encounter any issues, have suggestions, or would like to contribute code, please feel free to open an issue on GitHub: https://github.com/punkpeye/fastmcp
This final section not only invites potential contributors but also provides a direct way for users to get in touch with the development team or other contributors. By fostering community engagement and feedback loops, we can collectively make FastMCP better over time.
Join Our Discord Server for ongoing support, updates, and discussion with the broader community.
Quick Links
With this comprehensive guide, anyone interested in integrating advanced AI capabilities into their projects can now do so more easily and efficiently through FastMCP. We are excited about the possibilities that lie ahead as we continue to support and enhance this powerful tool.
Source Code Repository | Supporting Community on Discord
**Thank you for choosing FastMCP as your go-to solution for building smarter, more integrated AI applications. We look forward to seeing what you create!
Back to Top | Join Our Discord Server
By maintaining this detailed yet navigable document format, we ensure that users can easily access and understand the extensive features and benefits of FastMCP. This guide serves not only as an authoritative reference but also as a catalyst for growth within the AI developer community.
Thank you for your interest in FastMCP! If you have any questions or need further assistance, please get in touch with us now. Together, we can make groundbreaking applications that drive innovation and transformation.
Back to Top | Join Our Discord Server
Thank you again for choosing FastMCP! Let's embark on this exciting journey of creating smarter AI environments together.
{
"name": "FastMCP Server",
"description": "A universal adapter for integrating complex data sources with AI applications.",
"sections": [
{
"title": "Introduction to FastMCP",
"content": "<p>FastMCP is an open-source framework designed to simplify the integration of diverse data sources into a wide array of Artificial Intelligence (AI) projects. It provides a flexible and scalable infrastructure that can support various AI models, from language processing to image recognition.</p>",
"links": [
{
"text": "Read More",
"url": "#介绍"
}
]
},
{
"title": "Installation & Setup",
"content": "<ol>\n<li>Clone the repository: <code>git clone https://github.com/punkpeye/fastmcp</code></li>\n<li>Navigate to the project directory: <code>cd fastmcp</code></li>\n<li>Install dependencies using your preferred package manager.</li>\n<li>Run the application with appropriate configurations.</li>\n</ol>\n",
"links": []
},
{
"title": "Usage Examples",
"content": "<h2>Document Management System</h2>\n<p>To manage and process documents, use FastMCP's built-in document handling functions to efficiently store, retrieve, and analyze text-based data. This could be useful in content creation and management systems.</p>\n\n<h2>Multimedia Library</h2>\n<p>If you're working with multimedia elements like images or videos, FastMCP offers robust image processing and video analysis capabilities through easy-to-integrate APIs. Ideal for applications requiring rich media interaction.</p>",
"links": []
},
{
"title": "Advanced Configuration",
"content": "<ul>\n<li>Customize performance settings based on your specific needs.</li>\n<li>Tweak caching mechanisms to improve response time and reduce load times.</li>\n<li>Optimize resource allocation using environment-specific configurations.</li>\n</ul>",
"links": []
},
{
"title": "Community & Support",
"content": "<p>Join our vibrant community on Discord for regular updates, support, and collaboration opportunities. Connect with other developers who are leveraging FastMCP in their projects and contribute your insights to shared knowledge.</p>\n\n<a href='https://discord.gg/yourInviteCode'>Visit Discord Server</a>",
"links": [
{
"text": "Discord Invite",
"url": "https://discord.gg/yourInviteCode"
}
]
},
{
"title": "Closing Remarks",
"content": "<p>Thank you for your interest in FastMCP. Together, let's build smarter AI applications that solve real-world challenges and enhance user experiences.</p>\n<a href='#FastMCPServer'>Back to Top</a>",
"links": [
{
"text": "Back to Top",
"url": "#fastmcpserver"
}
]
}
]
}
This structured JSON document provides a clear breakdown of FastMCP's features and usage, including detailed installation steps, usage examples, advanced configuration options, community support resources, and closing remarks. It ensures that users can easily navigate through the information and find what they need quickly.
{
"name": "FastMCP Server",
"description": "A universal adapter for integrating complex data sources with AI applications.",
"sections": [
{
"title": "Introduction to FastMCP",
"content": "<p>FastMCP is an open-source framework designed to simplify the integration of diverse data sources into a wide array of Artificial Intelligence (AI) projects. It provides a flexible and scalable infrastructure that can support various AI models, from language processing to image recognition.</p>",
"links": [
{
"text": "Read More",
"url": "#介绍"
}
]
},
{
"title": "Installation & Setup",
"content": "<ol>\n<li>Clone the repository: <code>git clone https://github.com/punkpeye/fastmcp</code></li>\n<li>Navigate to the project directory: <code>cd fastmcp</code></li>\n<li>Install dependencies using your preferred package manager.</li>\n<li>Run the application with appropriate configurations.</li>\n</ol>\n",
"links": []
},
{
"title": "Usage Examples",
"content": "<h2>Document Management System</h2>\n<p>To manage and process documents, use FastMCP's built-in document handling functions to efficiently store, retrieve, and analyze text-based data. This could be useful in content creation and management systems.</p>\n\n<h2>Multimedia Library</h2>\n<p>If you're working with multimedia elements like images or videos, FastMCP offers robust image processing and video analysis capabilities through easy-to-integrate APIs. Ideal for applications requiring rich media interaction.</p>",
"links": []
},
{
"title": "Advanced Configuration",
"content": "<ul>\n<li>Customize performance settings based on your specific needs.</li>\n<li>Tweak caching mechanisms to improve response time and reduce load times.</li>\n<li>Optimize resource allocation using environment-specific configurations.</li>\n</ul>",
"links": []
},
{
"title": "Community & Support",
"content": "<p>Join our vibrant community on Discord for regular updates, support, and collaboration opportunities. Connect with other developers who are leveraging FastMCP in their projects and contribute your insights to shared knowledge.</p>\n\n<a href='https://discord.gg/yourInviteCode'>Visit Discord Server</a>",
"links": [
{
"text": "Discord Invite",
"url": "https://discord.gg/yourInviteCode"
}
]
},
{
"title": "Closing Remarks",
"content": "<p>Thank you for your interest in FastMCP. Together, let's build smarter AI applications that solve real-world challenges and enhance user experiences.</p>\n<a href='#FastMCPServer'>Back to Top</a>",
"links": [
{
"text": "Back to Top",
"url": "#fastmcpserver"
}
]
}
]
}
This JSON document outlines the structure and content for a comprehensive guide to FastMCP, an open-source framework designed to integrate complex data sources with AI applications. Here's a breakdown of its components:
Introduction to FastMCP
Installation & Setup
Usage Examples
Advanced Configuration
Community & Support
Closing Remarks
This structure ensures that the guide is easy to follow, comprehensive, and user-friendly. It can be easily converted into HTML or any other format suitable for documentation or online browsing. Each section has clear titles, content, and links for additional information where needed.
RuinedFooocus is a local AI image generator and chatbot image server for seamless creative control
Simplify MySQL queries with Java-based MysqlMcpServer for easy standard input-output communication
Learn to set up MCP Airflow Database server for efficient database interactions and querying airflow data
Build stunning one-page websites track engagement create QR codes monetize content easily with Acalytica
Explore CoRT MCP server for advanced self-arguing AI with multi-LLM inference and enhanced evaluation methods
Set up MCP Server for Alpha Vantage with Python 312 using uv and MCP-compatible clients