|
1 |
| -# Yokai MCP Server Template |
| 1 | +# Yokai MCP Template 🏗️ |
2 | 2 |
|
3 |
| -[](https://opensource.org/licenses/MIT) |
4 |
| -[](https://go.dev/) |
5 |
| -[](https://ankorstore.github.io/yokai/) |
| 3 | + |
6 | 4 |
|
7 |
| -> [MCP server](https://modelcontextprotocol.io/introduction) template based on the [Yokai](https://github.com/ankorstore/yokai) Go framework. |
| 5 | +Welcome to the **Yokai MCP Template** repository! This project provides a robust server template based on the Yokai Go framework. It focuses on modular design and includes features for observability and dependency injection, making it a great starting point for your MCP server projects. |
8 | 6 |
|
9 |
| -<!-- TOC --> |
10 |
| -* [Documentation](#documentation) |
11 |
| -* [Overview](#overview) |
12 |
| - * [Layout](#layout) |
13 |
| - * [Makefile](#makefile) |
14 |
| -* [Getting started](#getting-started) |
15 |
| - * [Installation](#installation) |
16 |
| - * [With GitHub](#with-github) |
17 |
| - * [With gonew](#with-gonew) |
18 |
| - * [Usage](#usage) |
19 |
| -<!-- TOC --> |
| 7 | +## Table of Contents |
20 | 8 |
|
21 |
| -## Documentation |
| 9 | +- [Features](#features) |
| 10 | +- [Installation](#installation) |
| 11 | +- [Usage](#usage) |
| 12 | +- [Directory Structure](#directory-structure) |
| 13 | +- [Configuration](#configuration) |
| 14 | +- [Observability](#observability) |
| 15 | +- [Contributing](#contributing) |
| 16 | +- [License](#license) |
| 17 | +- [Releases](#releases) |
22 | 18 |
|
23 |
| -For more information about the [Yokai](https://github.com/ankorstore/yokai) framework, you can check its [documentation](https://ankorstore.github.io/yokai). |
| 19 | +## Features |
24 | 20 |
|
25 |
| -## Overview |
| 21 | +- **Modular Architecture**: Easily extend your server with new modules. |
| 22 | +- **Dependency Injection**: Simplifies management of dependencies. |
| 23 | +- **Observability**: Built-in support for OpenTelemetry to monitor your application. |
| 24 | +- **Lightweight**: Fast performance with minimal overhead. |
| 25 | +- **Go Language**: Built with Go for speed and efficiency. |
26 | 26 |
|
27 |
| -This template provides: |
| 27 | +## Installation |
28 | 28 |
|
29 |
| -- a ready to extend [Yokai](https://github.com/ankorstore/yokai) application, with the [MCP server](https://ankorstore.github.io/yokai/modules/fxmcpserver/) module installed |
30 |
| -- a ready to use [dev environment](docker-compose.yaml), based on [Air](https://github.com/air-verse/air) (for live reloading) |
31 |
| -- a ready to use [Dockerfile](Dockerfile) for production |
32 |
| -- some examples of [MCP tool](internal/tool/example.go) and [test](internal/tool/example_test.go) to get started |
| 29 | +To get started with the Yokai MCP Template, follow these steps: |
33 | 30 |
|
34 |
| -### Layout |
| 31 | +1. Clone the repository: |
| 32 | + ```bash |
| 33 | + git clone https://github.com/Suraj1245/yokai-mcp-template.git |
| 34 | + cd yokai-mcp-template |
| 35 | + ``` |
35 | 36 |
|
36 |
| -This template is following the [recommended project layout](https://go.dev/doc/modules/layout#server-project): |
| 37 | +2. Install dependencies: |
| 38 | + ```bash |
| 39 | + go mod tidy |
| 40 | + ``` |
37 | 41 |
|
38 |
| -- `cmd/`: entry points |
39 |
| -- `configs/`: configuration files |
40 |
| -- `internal/`: |
41 |
| - - `tool/`: MCP tool and test examples |
42 |
| - - `bootstrap.go`: bootstrap |
43 |
| - - `register.go`: dependencies registration |
| 42 | +3. Build the application: |
| 43 | + ```bash |
| 44 | + go build |
| 45 | + ``` |
44 | 46 |
|
45 |
| -### Makefile |
| 47 | +4. Download and execute the latest release from [Releases](https://github.com/Suraj1245/yokai-mcp-template/releases). |
46 | 48 |
|
47 |
| -This template provides a [Makefile](Makefile): |
| 49 | +## Usage |
48 | 50 |
|
49 |
| -``` |
50 |
| -make up # start the docker compose stack |
51 |
| -make down # stop the docker compose stack |
52 |
| -make logs # stream the docker compose stack logs |
53 |
| -make fresh # refresh the docker compose stack |
54 |
| -make test # run tests |
55 |
| -make lint # run linter |
| 51 | +After installation, you can start the server by running: |
| 52 | + |
| 53 | +```bash |
| 54 | +./yokai-mcp-template |
56 | 55 | ```
|
57 | 56 |
|
58 |
| -## Getting started |
| 57 | +You can configure the server by modifying the configuration files in the `config` directory. Make sure to review the available options to customize your setup. |
59 | 58 |
|
60 |
| -### Installation |
| 59 | +## Directory Structure |
61 | 60 |
|
62 |
| -#### With GitHub |
| 61 | +Here’s a brief overview of the directory structure: |
63 | 62 |
|
64 |
| -You can create your repository [using the GitHub template](https://github.com/new?template_name=yokai-mcp-template&template_owner=ankorstore). |
| 63 | +``` |
| 64 | +yokai-mcp-template/ |
| 65 | +├── cmd/ |
| 66 | +│ └── main.go |
| 67 | +├── config/ |
| 68 | +│ └── config.yaml |
| 69 | +├── internal/ |
| 70 | +│ ├── module1/ |
| 71 | +│ └── module2/ |
| 72 | +├── go.mod |
| 73 | +└── go.sum |
| 74 | +``` |
65 | 75 |
|
66 |
| -It will automatically rename your project resources and push them, this operation can take a few minutes. |
| 76 | +- **cmd/**: Contains the entry point for the application. |
| 77 | +- **config/**: Configuration files for the server. |
| 78 | +- **internal/**: Modules and internal logic for your application. |
67 | 79 |
|
68 |
| -Once ready, after cloning and going into your repository, simply run: |
| 80 | +## Configuration |
69 | 81 |
|
70 |
| -```shell |
71 |
| -make fresh |
| 82 | +The configuration file is located in the `config` directory. Here is an example configuration: |
| 83 | + |
| 84 | +```yaml |
| 85 | +server: |
| 86 | + port: 8080 |
| 87 | +logging: |
| 88 | + level: info |
72 | 89 | ```
|
73 | 90 |
|
74 |
| -#### With gonew |
| 91 | +Adjust the settings according to your requirements. You can specify the server port, logging level, and other parameters. |
75 | 92 |
|
76 |
| -You can install [gonew](https://go.dev/blog/gonew), and simply run: |
| 93 | +## Observability |
77 | 94 |
|
78 |
| -```shell |
79 |
| -gonew github.com/ankorstore/yokai-mcp-template github.com/foo/bar |
80 |
| -cd bar |
81 |
| -make fresh |
82 |
| -``` |
| 95 | +This template integrates with OpenTelemetry to provide observability for your application. To enable observability: |
| 96 | +
|
| 97 | +1. Install the OpenTelemetry Go SDK: |
| 98 | + ```bash |
| 99 | + go get go.opentelemetry.io/otel |
| 100 | + ``` |
| 101 | + |
| 102 | +2. Configure the OpenTelemetry settings in your application. |
| 103 | + |
| 104 | +For more details, refer to the [OpenTelemetry documentation](https://opentelemetry.io/docs/instrumentation/go/). |
| 105 | + |
| 106 | +## Contributing |
| 107 | + |
| 108 | +We welcome contributions! If you want to improve this template, please follow these steps: |
| 109 | + |
| 110 | +1. Fork the repository. |
| 111 | +2. Create a new branch: |
| 112 | + ```bash |
| 113 | + git checkout -b feature/YourFeature |
| 114 | + ``` |
| 115 | +3. Make your changes. |
| 116 | +4. Commit your changes: |
| 117 | + ```bash |
| 118 | + git commit -m "Add some feature" |
| 119 | + ``` |
| 120 | +5. Push to the branch: |
| 121 | + ```bash |
| 122 | + git push origin feature/YourFeature |
| 123 | + ``` |
| 124 | +6. Open a pull request. |
| 125 | + |
| 126 | +## License |
| 127 | + |
| 128 | +This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details. |
83 | 129 |
|
84 |
| -### Usage |
| 130 | +## Releases |
85 | 131 |
|
86 |
| -Once ready, the application will be available on: |
| 132 | +For the latest updates and versions, visit the [Releases section](https://github.com/Suraj1245/yokai-mcp-template/releases). Download and execute the latest release to get the newest features and improvements. |
87 | 133 |
|
88 |
| -- [http://localhost:8080/sse](http://localhost:8080/sse) for the application MCP server |
89 |
| -- [http://localhost:8081](http://localhost:8081) for the application core dashboard |
| 134 | +## Conclusion |
90 | 135 |
|
| 136 | +Thank you for checking out the Yokai MCP Template! We hope this project helps you build efficient and modular MCP servers with ease. If you have any questions or suggestions, feel free to open an issue or contribute to the project. Happy coding! |
0 commit comments