
simple agent and mcp server
exploring writing a simple agent and mcp server
Repository Info
About This Server
exploring writing a simple agent and mcp server
Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.
Documentation
Model Context Protocol (MCP) Server & Agent
A simple implementation of a Model Context Protocol server that manages context data for AI models.
Setup
- Install the required dependencies:
uv venv
uv pip install -r requirements.txt
- Run the server:
uv run server.py
The server will start on localhost:8080.
API Endpoints
Store Context
curl -X POST http://localhost:8080/mcp/context \
-H "Content-Type: application/json" \
-d '{
"context_id": "example-context",
"data": {
"key": "value",
"metadata": "example"
}
}'
Get Context
curl -X GET http://localhost:8080/mcp/context/example-context
Delete Context
curl -X DELETE http://localhost:8080/mcp/context/example-context
list all the tools
curl -X GET http://localhost:8080/mcp/tools
Run the agent
OPENAI_API_KEY=$OPENAI_API_KEY uv run agent.py
Sample output:
Connected to server
LLM decided to use: calculator
Reasoning: The user is asking for the sum of 5 and 3, which is a basic arithmetic operation suitable for the calculator tool.
Tool 'calculator' executed with result: {'status': 'success', 'result': 8}
Final result: {'status': 'success', 'result': 8}
LLM decided to use: calculator
Reasoning: The user requested to multiply two numbers, so a calculator tool is appropriate to perform this arithmetic operation.
Tool 'calculator' executed with result: {'status': 'success', 'result': 24}
Final result: {'status': 'success', 'result': 24}
Disconnected from server
Quick Start
Clone the repository
git clone https://github.com/linsun/simple-agent-and-mcp-serverInstall dependencies
cd simple-agent-and-mcp-server
npm installFollow the documentation
Check the repository's README.md file for specific installation and usage instructions.
Repository Details
Recommended MCP Servers
Discord MCP
Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.
Knit MCP
Connect AI agents to 200+ SaaS applications and automate workflows.
Apify MCP Server
Deploy and interact with Apify actors for web scraping and data extraction.
BrowserStack MCP
BrowserStack MCP Server for automated testing across multiple browsers.
Zapier MCP
A Zapier server that provides automation capabilities for various apps.