This is a generated MCP (Model Context Protocol) service for my-mcp-service.
A generated MCP service
- src/ - Source code
- docs/ - Documentation
- bin/ - Binary files
- Go 1.24.7 or later
- Clone the repository
- Install dependencies:
cd src go mod tidy
Copy docs/config.env.example to src/config.env and update the values:
cp docs/config.env.example src/config.env
# Edit src/config.env with your API detailscd src
go run main.gocd src
SERVER_MODE=http go run main.gocd src
SERVER_MODE=sse go run main.go-
getPosts: Get list of posts
-
createPost: Create a new post
-
updatePost: Update an existing post
-
deletePost: Delete a post
-
getPosts: Get list of posts
-
createPost: Create a new post
-
updatePost: Update an existing post
-
deletePost: Delete a post
To build the service:
cd src
go build -o ../bin/mcp-server main.goYou can use any MCP client to interact with this service. Here's an example using curl:
# Stdio mode
echo '{"toolcall":{"thought":"","name":"getPosts","params":{"page":1,"per_page":10}}}' | ./bin/mcp-server
# HTTP mode
curl -X POST http://localhost:8080/mcp -H "Content-Type: application/json" -d '{"toolcall":{"thought":"","name":"getPosts","params":{"page":1,"per_page":10}}}'- API connection errors: Check your API_URL and API_KEY in config.env
- Server mode issues: Ensure SERVER_MODE is set to one of: stdio, http, sse
- Port conflicts: If port 8080 is in use, change SERVER_PORT in config.env
The service logs information to the console. For more detailed logs, set the DEBUG environment variable:
DEBUG=true go run main.goTo use this MCP service with other applications, you can configure it as a tool in your MCP client. Here's an example configuration:
{
"name": "my-mcp-service",
"description": "A generated MCP service",
"tools": [
{
"name": "getPosts",
"description": "Get list of posts",
"parameters": [
{
"name": "page",
"type": "integer",
"required": false,
"description": "Page number"
},
{
"name": "per_page",
"type": "integer",
"required": false,
"description": "Posts per page"
},
]
},
{
"name": "createPost",
"description": "Create a new post",
"parameters": [
{
"name": "title",
"type": "string",
"required": true,
"description": "Post title"
},
{
"name": "content",
"type": "string",
"required": true,
"description": "Post content"
},
{
"name": "status",
"type": "string",
"required": false,
"description": "Post status"
},
]
},
{
"name": "updatePost",
"description": "Update an existing post",
"parameters": [
{
"name": "id",
"type": "integer",
"required": true,
"description": "Post ID"
},
{
"name": "title",
"type": "string",
"required": false,
"description": "Post title"
},
{
"name": "content",
"type": "string",
"required": false,
"description": "Post content"
},
{
"name": "status",
"type": "string",
"required": false,
"description": "Post status"
},
]
},
{
"name": "deletePost",
"description": "Delete a post",
"parameters": [
{
"name": "id",
"type": "integer",
"required": true,
"description": "Post ID"
},
]
},
]
}