Extend your tools with eMCP enhance authentication middleware and flexible MCP server features
eMCP, an enhanced version of LiteMCP, serves as a robust and flexible infrastructure for developers aiming to integrate Model Context Protocol (MCP) into their AI applications. Built on the principle of near drop-in replacement compatibility with LiteMCP, eMCP not only offers all its features but also introduces built-in authentication handling and custom middleware support. This server acts as a bridge, enabling AI applications like Claude Desktop, Continue, and Cursor to access specific data sources and tools via MCP.
eMCP provides a wide array of capabilities that make it an ideal choice for developers aiming to leverage Model Context Protocol across their projects. This server supports:
These features are designed to make eMCP a versatile tool that can be tailored to meet specific project needs, all while maintaining compatibility with existing MCP clients and tools.
The architecture of eMCP is built around the Model Context Protocol (MCP), ensuring that data interactions follow standardized formats. The server leverages MCP for seamless communication between AI applications and their respective MCP clients and tools. At its core, eMCP handles requests from MCP clients, processes them through a series of middleware, and eventually sends responses back to the client.
graph TD
A[AI Application] -->|MCP Client| B[MCP Protocol]
B --> C[MCP Server]
C --> D[Data Source/Tool]
style A fill:#e1f5fe
style C fill:#f3e5f5
style D fill:#e8f5e8
To get started, developers can install eMCP via Bun or NPM. The following instructions provide a straightforward guide.
For developers who want to quickly implement custom functionalities within their AI application, the example
packages offer useful templates and best practices.
Here's a basic usage example:
const server = new eMCP("mcp-server-with-auth", "1.0.0", {
authenticationHandler: async (request) => {
// implement your custom auth logic here
return true;
},
});
// Request to this tool, or any other resource or prompt will
// require authentication governed by the handler
server.addTool({
name: "add",
description: "Add two numbers",
parameters: z.object({
a: z.number(),
b: z.number(),
}),
execute: async (args) => {
server.logger.debug("Adding two numbers", args);
return args.a + args.b;
},
});
Middleware can be used to implement custom processing during request-response cycles.
const server = new eMCP("mcp-server-with-middleware", "1.0.0", {
authenticationHandler: async (request) => {
// implement your custom auth logic here
return true;
},
});
// This will time entire req -> res cycle, including middlewares
server.use(async (request, next) => {
const startTime = Date.now();
server.logger.debug("Request started", { method: request.method });
// Wait for all inner middleware and the handler to complete
const response = await next();
const endTime = Date.now();
server.logger.debug("Request completed", {
method: request.method,
duration: `${endTime - startTime}ms`,
});
return response;
});
Imagine a scenario where an AI application needs to integrate a custom tool for data analysis. With eMCP, developers can easily add this tool and configure it to work seamlessly with the rest of their system.
server.addTool({
name: "dataAnalysis",
description: "Perform complex data analysis tasks.",
parameters: z.object({ ... }),
execute: async (args) => { /* ... */ },
});
For applications that require strict security, eMCP provides a built-in authentication handler. This ensures that only authorized users can access sensitive tools and data.
server.use(async (request, next) => {
const result = await server.authenticationHandler(request);
if (!result) return "Unauthorized";
// Proceed with processing the request
// ...
return next();
});
eMCP supports a diverse range of MCP clients, ensuring seamless integration and compatibility. The provided MCP client compatibility matrix highlights which clients are fully supported.
MCP Client | Resources | Tools | Prompts | Status |
---|---|---|---|---|
Claude Desktop | ✅ | ✅ | ✅ | Full Support |
Continue | ✅ | ✅ | 👇 | Full Support |
Cursor | ❌ | ✅ | 👇 | Tools Only |
This matrix can help developers understand the level of support for various clients, allowing them to plan their MCP integration accordingly.
eMCP has been designed with performance in mind. Here are some key metrics:
Client | Auth | Middleware |
---|---|---|
✅ | ✅ | ✅ |
This compatibility matrix ensures that eMCP can be easily integrated into a wide range of environments, from simple scripts to complex microservices architectures.
server.use(async (request) => {
// Implement your custom authentication logic here.
return request.token !== null && validateToken(request.token);
});
Registering middleware is straightforward:
server.addMiddleware((request, next) => {
server.logger.info("Executing middleware", { method: request.method });
return next();
});
Q: Can eMCP be used with all popular AI application clients?
Q: What are the main security features of eMCP?
Q: How does eMCP handle concurrency in request processing?
Q: Is there documentation available for custom tool integration?
Q: Can I customize the authentication process in eMCP?
Contributions to eMCP are encouraged to help shape its future direction. Developers interested in contributing can find detailed guidelines and best practices on the official repository.
The MCP ecosystem is growing rapidly, with various tools and resources available. eMCP integrates seamlessly into this environment, providing a robust foundation for AI applications.
By leveraging eMCP, developers can build and deploy advanced AI applications with ease, ensuring they remain competitive in the ever-evolving tech landscape.
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
Build stunning one-page websites track engagement create QR codes monetize content easily with Acalytica
Learn to set up MCP Airflow Database server for efficient database interactions and querying airflow data
Explore CoRT MCP server for advanced self-arguing AI with multi-LLM inference and enhanced evaluation methods
Access NASA APIs for space data, images, asteroids, weather, and exoplanets via MCP integration