linsun/simple-agent-and-mcp-server
If you are the rightful owner of simple-agent-and-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
A simple implementation of a Model Context Protocol server that manages context data for AI models.
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