- Explore MCP Servers
- any-to-mcp
Any To Mcp
What is Any To Mcp
any-to-mcp is a Node.js framework designed to facilitate the integration of Large Language Models (LLMs) with Model Context Protocol (MCP) servers, enabling LLMs to execute tools via the MCP protocol without the need for desktop applications.
Use cases
Use cases for any-to-mcp include automating customer service inquiries, providing real-time information retrieval, and facilitating complex multi-step interactions in conversational AI applications.
How to use
To use any-to-mcp, install it via npm with ‘npm install any-to-mcp’. Then, create an instance of the framework by initializing it with your LLM provider and MCP server configuration, and start a conversation by calling the ‘start’ method with a user message.
Key features
Key features include LLM adapters for different providers, XML response parsing for MCP-related tags, automatic MCP server management, tool execution routing, step-by-step processing for interactions, and support for follow-up questions.
Where to use
any-to-mcp can be utilized in various fields such as customer support, virtual assistants, and any application requiring interaction between LLMs and MCP servers.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Overview
What is Any To Mcp
any-to-mcp is a Node.js framework designed to facilitate the integration of Large Language Models (LLMs) with Model Context Protocol (MCP) servers, enabling LLMs to execute tools via the MCP protocol without the need for desktop applications.
Use cases
Use cases for any-to-mcp include automating customer service inquiries, providing real-time information retrieval, and facilitating complex multi-step interactions in conversational AI applications.
How to use
To use any-to-mcp, install it via npm with ‘npm install any-to-mcp’. Then, create an instance of the framework by initializing it with your LLM provider and MCP server configuration, and start a conversation by calling the ‘start’ method with a user message.
Key features
Key features include LLM adapters for different providers, XML response parsing for MCP-related tags, automatic MCP server management, tool execution routing, step-by-step processing for interactions, and support for follow-up questions.
Where to use
any-to-mcp can be utilized in various fields such as customer support, virtual assistants, and any application requiring interaction between LLMs and MCP servers.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Content
any-to-mcp
A Node.js framework to bridge Large Language Models (LLMs) with Model Context Protocol (MCP) servers.
Overview
any-to-mcp is a framework that enables seamless integration between LLMs and MCP servers. It allows LLMs to execute tools via the MCP protocol without requiring desktop applications like Claude Desktop or Cursor. The framework handles parsing LLM responses for XML tags, executing the appropriate MCP tool calls, and managing the conversation flow.
Features
- LLM Adapters: Connect to different LLM providers (OpenAI, Anthropic)
- XML Response Parsing: Parse LLM responses for MCP-related XML tags
- MCP Server Management: Automatically handle MCP server connections
- Tool Execution: Route tool calls to the appropriate MCP servers
- Step-by-step Processing: Coordinate multi-step LLM-MCP interactions
- Follow-up Questions: Support follow-up questions to users
Installation
npm install any-to-mcp
Quick Start
import { createAnyToMcp, CoordinatorState } from 'any-to-mcp';
async function main() {
// Create and initialize the framework
const coordinator = await createAnyToMcp({
llm: {
provider: 'openai',
apiKey: 'your-openai-api-key',
model: 'gpt-4',
},
// Optional MCP server configuration
mcp: {
name: 'example-server',
url: 'http://localhost:3000/mcp',
type: 'http',
},
// Maximum iterations before forcing completion
maxIterations: 10,
});
// Start a conversation with a user message
const result = await coordinator.start('Hello, can you help me find the weather in San Francisco?');
// Process the result based on state
if (result.state === CoordinatorState.COMPLETED) {
console.log('Final answer:', result.message);
} else if (result.state === CoordinatorState.WAITING_FOR_USER) {
console.log('Question for user:', result.message);
// User can respond with:
// const nextResult = await coordinator.provideUserResponse('User response');
}
// Clean up when done
await coordinator.close();
}
main();
Supported LLM Providers
- OpenAI: GPT-3.5, GPT-4, and other OpenAI models
- Anthropic: Claude models (Opus, Sonnet, etc.)
- Custom HTTP: Support for custom HTTP endpoints
XML Tags Supported
The framework can detect and process the following XML tags in LLM responses:
<use_mcp_tool>: Execute a tool on an MCP server<access_mcp_resource>: Access a resource from an MCP server<ask_followup_question>: Ask a follow-up question to the user<attempt_completion>: Finish the conversation with a result<fetch_instructions>: Fetch instructions for a specific task<thinking>: Internal thought process (ignored for execution)
Advanced Usage
Custom LLM Adapters
import { BaseLLMAdapter, LLMRequestOptions, LLMResponse, LLMResponseChunk } from 'any-to-mcp';
// Create a custom LLM adapter
class CustomAdapter extends BaseLLMAdapter {
async sendRequest(messages, options) {
// Implement your custom request logic
return {
content: 'Response from custom LLM',
model: 'custom-model',
};
}
async sendStreamingRequest(messages, callback, options) {
// Implement your custom streaming logic
}
}
// Use the custom adapter
const coordinator = await createAnyToMcp({
llm: {
provider: 'custom',
// Custom adapter will be used
},
});
Working with MCP Servers
import { MCPManager } from 'any-to-mcp';
// Create an MCP manager
const manager = new MCPManager({
configPath: './mcpserver.json',
});
// Initialize and connect
await manager.initialize();
await manager.connectAll();
// Execute a tool
const result = await manager.executeTool({
serverName: 'example-server',
toolName: 'example-tool',
arguments: { param1: 'value1' },
});
// Clean up
await manager.disconnectAll();
Examples
Check the examples directory for more usage examples:
simple-chat.ts: Basic chat interface using the framework
API Reference
Core Functions
createAnyToMcp(config): Create and initialize the frameworkcoordinator.start(userMessage): Start a conversationcoordinator.provideUserResponse(response): Provide user inputcoordinator.getState(): Get the current statecoordinator.reset(): Reset the conversationcoordinator.close(): Clean up resources
State Management
The coordinator can be in one of the following states:
CoordinatorState.IDLE: Ready for a new conversationCoordinatorState.PROCESSING: Processing a requestCoordinatorState.WAITING_FOR_USER: Waiting for user inputCoordinatorState.COMPLETED: Conversation completedCoordinatorState.ERROR: Error occurred
License
MIT
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Dev Tools Supporting MCP
The following are the main code editors that support the Model Context Protocol. Click the link to visit the official website for more information.










