|
| 1 | +--- |
| 2 | +title: Demos - MCP application |
| 3 | +icon: material/folder-eye-outline |
| 4 | +--- |
| 5 | + |
| 6 | +# :material-folder-eye-outline: Demo - MCP application |
| 7 | + |
| 8 | +> Yokai's [showroom](https://github.com/ankorstore/yokai-showroom) provides an [MCP server demo application](https://github.com/ankorstore/yokai-showroom/tree/main/mcp-demo). |
| 9 | +
|
| 10 | +## Overview |
| 11 | + |
| 12 | +This [MCP server demo application](https://github.com/ankorstore/yokai-showroom/tree/main/mcp-demo) is a simple [MCP server](https://modelcontextprotocol.io/introduction) to manage [gophers](https://go.dev/blog/gopher). |
| 13 | + |
| 14 | +It provides: |
| 15 | + |
| 16 | +- a [Yokai](https://github.com/ankorstore/yokai) application container, with the [MCP server](../modules/fxmcpserver.md) and [SQL](../modules/fxsql.md) modules to offer the gophers MCP server |
| 17 | +- a [MySQL](https://www.mysql.com/) container to store the gophers |
| 18 | +- a [MCP Inspector](https://modelcontextprotocol.io/docs/tools/inspector) container to interact with the MCP server |
| 19 | +- a [Jaeger](https://www.jaegertracing.io/) container to collect the application traces |
| 20 | + |
| 21 | +### Layout |
| 22 | + |
| 23 | +This demo application is following the [recommended project layout](https://go.dev/doc/modules/layout#server-project): |
| 24 | + |
| 25 | +- `cmd/`: entry points |
| 26 | +- `configs/`: configuration files |
| 27 | +- `db/`: |
| 28 | + - `migrations/`: database migrations |
| 29 | + - `seeds/`: database seeds |
| 30 | +- `internal/`: |
| 31 | + - `domain/`: domain |
| 32 | + - `model.go`: gophers model |
| 33 | + - `repository.go`: gophers repository |
| 34 | + - `service.go`: gophers service |
| 35 | + - `mcp/`: MCP registrations |
| 36 | + - `prompt/`: MCP prompts |
| 37 | + - `resource/`: MCP resources |
| 38 | + - `tool/`: MCP tools |
| 39 | + - `bootstrap.go`: bootstrap |
| 40 | + - `register.go`: dependencies registration |
| 41 | + |
| 42 | +### Makefile |
| 43 | + |
| 44 | +This demo application provides a `Makefile`: |
| 45 | + |
| 46 | +``` |
| 47 | +make up # start the docker compose stack |
| 48 | +make down # stop the docker compose stack |
| 49 | +make logs # stream the docker compose stack logs |
| 50 | +make fresh # refresh the docker compose stack |
| 51 | +make migrate # run database migrations |
| 52 | +make test # run tests |
| 53 | +make lint # run linter |
| 54 | +``` |
| 55 | + |
| 56 | +## Usage |
| 57 | + |
| 58 | +### Start the application |
| 59 | + |
| 60 | +To start the application, simply run: |
| 61 | + |
| 62 | +```shell |
| 63 | +make fresh |
| 64 | +``` |
| 65 | + |
| 66 | +After a short moment, the application will offer: |
| 67 | + |
| 68 | +- [http://localhost:8080/mcp](http://localhost:8080/mcp): application MCP server (Streamable HTTP) |
| 69 | +- [http://localhost:8081](http://localhost:8081): application core dashboard |
| 70 | +- [http://localhost:6274](http://localhost:6274): MCP inspector |
| 71 | +- [http://localhost:16686](http://localhost:16686): jaeger UI |
| 72 | + |
| 73 | +### Interact with the application |
| 74 | + |
| 75 | +#### MCP inspector |
| 76 | + |
| 77 | +You can use the provided [MCP Inspector](https://modelcontextprotocol.io/docs/tools/inspector), available on [http://localhost:6274](http://localhost:6274). |
| 78 | + |
| 79 | +To connect to the MCP server, use: |
| 80 | + |
| 81 | +- `Streamable HTTP` as transport type |
| 82 | +- `http://mcp-demo-app:8080/mcp` as URL |
| 83 | + |
| 84 | +Then simply click `Connect`: from there, you will be able to interact with the resources, prompts and tools of the application. |
| 85 | + |
| 86 | +#### MCP hosts |
| 87 | + |
| 88 | +If you use MCP compatible applications like [Cursor](https://www.cursor.com/), or [Claude desktop](https://claude.ai/download), you can register this application as MCP server: |
| 89 | + |
| 90 | +```json |
| 91 | +{ |
| 92 | + "mcpServers": { |
| 93 | + "mcp-demo-app": { |
| 94 | + "url": "http://localhost:8080/mcp" |
| 95 | + } |
| 96 | + } |
| 97 | +} |
| 98 | +``` |
| 99 | + |
| 100 | +Note, if you client does not support remote MCP servers, you can use a [local proxy](https://developers.cloudflare.com/agents/guides/test-remote-mcp-server/#connect-your-remote-mcp-server-to-claude-desktop-via-a-local-proxy): |
| 101 | + |
| 102 | +```json |
| 103 | +{ |
| 104 | + "mcpServers": { |
| 105 | + "mcp-demo-app": { |
| 106 | + "command": "npx", |
| 107 | + "args": ["mcp-remote", "http://localhost:8080/mcp"] |
| 108 | + } |
| 109 | + } |
| 110 | +} |
| 111 | +``` |
0 commit comments