Simple MCP
A simple Model Context Protocol server in Go configurable to use shell commands.
Ask AI about Simple MCP
Powered by Claude Β· Grounded in docs
I know everything about Simple MCP. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
FastAPI MCP Project
This project contains two main components:
crud-api: A FastAPI-based RESTful API for basic Create, Read, Update, and Delete (CRUD) operations.mcp-server: A server that exposes thecrud-apiendpoints as "tools" using the FastMCP library, allowing other services to interact with the API in a standardized way.
Project Structure
FASTAPI-MCP/
βββ crud-api/ # The FastAPI CRUD application
β βββ main.py # Main application logic
β βββ test_main.py # Tests for the API
β βββ ...
βββ mcp-server/ # The MCP server
βββ mcp-server.py # Exposes the API as tools
βββ ...
Visualization
The following diagram illustrates the workflow of the project:
graph TD
subgraph "User/Client"
A[User/Client]
end
subgraph "MCP Server"
B[mcp-server.py]
end
subgraph "CRUD API"
C[crud-api/main.py]
end
subgraph "Database"
D[(crud-api.db)]
end
A -- "Interacts with MCP tools" --> B
B -- "Makes HTTP requests to" --> C
C -- "Performs CRUD operations on" --> D
Getting Started
Prerequisites
- Python 3.12+
- uv (or pip) for installing dependencies.
Running the Applications
You will need two separate terminals to run both the crud-api and the mcp-server.
Terminal 1: Run the crud-api
-
Navigate to the
crud-apidirectory:cd crud-api -
Build the Docker Image:
docker build -t fastapi-app . -
Run the FastAPI server:
# Creating a docker network so that DNS can be resolved docker network create mcp-network # Run the FastAPI server docker run -d --name crudapi --network mcp-network -p 8000:8000 fastapi-appThe API will be available at
http://localhost:8000.
Terminal 2: Run the mcp-server
-
Navigate to the
mcp-serverdirectory:cd mcp-server -
Build the Docker Image:
docker build -t mcp-server . -
Run the MCP server:
# Ensure docker-network is in place and crudapi container is running. docker run -d --name mcp --network mcp-network -p 9000:9000 mcp-serverThe MCP server will be running on
http://localhost:9000/sse.
How It Works
crud-api
- Uses FastAPI to create a simple REST API.
- Defines an
Itemmodel withid,name, anddescription. - Uses SQLAlchemy to interact with a SQLite database (
crud-api.db). - Provides the following endpoints:
POST /items/: Create a new item.GET /items/: Get a list of all items.GET /items/{item_id}: Get a specific item by its ID.PUT /items/{item_id}: Update an item.DELETE /items/{item_id}: Delete an item.
mcp-server
- Uses the
FastMCPlibrary to create a server that exposes "tools". - Each tool corresponds to an endpoint in the
crud-api. - When a tool is called on the
mcp-server, it makes an HTTP request to the corresponding endpoint on thecrud-api. - This acts as a bridge, allowing services that can communicate with an MCP server to indirectly interact with the REST API.
Connecting with Gemini CLI
You can connect to the mcp-server using the Gemini CLI.
-
Open the Gemini CLI settings.
/home/itsayushs/.gemini/settings.json -
Append the new MCP server configuration.
-
Example settings.json:
{ "theme": "...", "selectedAuthType": "...", ... "mcpServers": { "crudmcp": { "url": "http://0.0.0.0:9000/sse" } } } -
Save the settings.
-
Now you can use the
crudmcpmcp tools in the Gemini CLI. (Reload Required) -
Use
/mcpto list the Configured MCP servers.crudmcpshould be visible.
Connecting with Copilot Chat in VSCode
- Open VSCode -> Copilot Chat -> Configure Tool.. (Next to Voice Chat Button) -> Add More Tools
- Add MCP Server -> Select HTTP/SSE
- Provide
http://127.0.0.1:9000/sseas the URL - Ref mcp.json:
{
"servers": {
"crudmcp-itsayushs": {
"url": "http://127.0.0.1:9000/sse",
"type": "sse"
}
},
"inputs": []
}
