- Explore MCP Servers
- AI-ChatAgent-With-MCP
Ai Chatagent With Mcp
What is Ai Chatagent With Mcp
AI-ChatAgent-With-MCP is a .NET-based chat agent that integrates OpenAI models with the Model Context Protocol (MCP) to provide extensible tool integration and custom AI capabilities.
Use cases
Use cases include providing automated customer support, creating personalized learning experiences, developing interactive gaming characters, and enhancing user engagement in applications through conversational interfaces.
How to use
To use AI-ChatAgent-With-MCP, clone the repository, build the solution, configure your AI settings in ‘appsettings.json’, run the MCP.Server project, and then run the ChatAgent project to start interacting with the chat interface.
Key features
Key features include an interactive chat interface with AI-powered responses, integration with Model Context Protocol (MCP) for extensible tools, support for multiple MCP servers, custom tool implementation, environment-specific configuration, and streaming chat responses.
Where to use
AI-ChatAgent-With-MCP can be used in various fields such as customer support, virtual assistants, educational tools, and any application requiring interactive AI-driven communication.
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 Ai Chatagent With Mcp
AI-ChatAgent-With-MCP is a .NET-based chat agent that integrates OpenAI models with the Model Context Protocol (MCP) to provide extensible tool integration and custom AI capabilities.
Use cases
Use cases include providing automated customer support, creating personalized learning experiences, developing interactive gaming characters, and enhancing user engagement in applications through conversational interfaces.
How to use
To use AI-ChatAgent-With-MCP, clone the repository, build the solution, configure your AI settings in ‘appsettings.json’, run the MCP.Server project, and then run the ChatAgent project to start interacting with the chat interface.
Key features
Key features include an interactive chat interface with AI-powered responses, integration with Model Context Protocol (MCP) for extensible tools, support for multiple MCP servers, custom tool implementation, environment-specific configuration, and streaming chat responses.
Where to use
AI-ChatAgent-With-MCP can be used in various fields such as customer support, virtual assistants, educational tools, and any application requiring interactive AI-driven communication.
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
ChatAgent with Model Context Protocol (MCP)
A .NET-based chat agent implementation that uses OpenAI’s models and Model Context Protocol (MCP) for extensible tool integration. This project demonstrates how to create an AI-powered chat agent with custom tool capabilities.
Project Structure
The solution consists of two main projects:
- ChatAgent: The main application that implements the chat interface using OpenAI and MCP client.
- MCP.Server: A Model Context Protocol server that provides tools for the chat agent.
Prerequisites
- .NET 9.0
- Visual Studio 2022 or later
- OpenAI API access
Configuration
- Configure your AI settings in
appsettings.json:
{
"AI": {
"ModelId": "YOUR-MODEL",
"APIKey": "YOUR-KEY",
"Endpoint": "YOUR-ENDPOINT"
},
"MCPServers": "PATH-TO-MCP-SERVER"
}
Replace the placeholders with your actual values:
ModelId: Your OpenAI model ID (e.g., “gpt-4”, “gpt-3.5-turbo”)APIKey: Your OpenAI API keyEndpoint: Your OpenAI API endpoint (usually “https://api.openai.com”)MCPServers: Path to the MCP.Server executable (semicolon-separated for multiple servers)
Features
- Interactive chat interface with AI-powered responses
- Integration with Model Context Protocol (MCP) for extensible tools
- Custom tool implementation example (UserTool) that fetches user data
- Support for multiple MCP servers
- Environment-specific configuration support
- Streaming chat responses for better user experience
Technologies Used
- Microsoft.SemanticKernel for AI integration
- Model Context Protocol (MCP) for tool integration
- OpenAI API for chat completion
- .NET 9.0 features
- Microsoft.Extensions.Configuration for configuration management
Getting Started
- Clone the repository
- Build the solution
- Configure your
appsettings.jsonwith appropriate AI credentials - Run the MCP.Server project
- Run the ChatAgent project
Usage
- Start the application
- Type your messages in the console
- Use ‘EXIT’ to end the chat session
- The agent will respond using both its AI capabilities and available MCP tools
Tool Integration
The project includes a sample tool (UserTool) that demonstrates how to integrate external functionality:
[McpServerToolType]
public class UserTool
{
[McpServerTool, Description("Tüm kullanıcıları, bilgileriyle birlikte getirir.")]
public async Task<List<object>> GetUsersAsync()
{
// Implementation
}
}
You can add more tools by creating new classes with the [McpServerToolType] attribute and methods with [McpServerTool] attribute.
Development
- Use
appsettings.Development.jsonfor development-specific settings - The project supports environment-specific configurations through
DOTNET_ENVIRONMENTvariable - Tool development should follow the MCP protocol specifications
Contributing
Feel free to contribute to this project by:
- Forking the repository
- Creating a feature branch
- Submitting 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.










