You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
g := genkit.Init(ctx, genkit.WithPlugins(&googlegenai.GoogleAI{}))
57
-
// Your flows and logic here
58
-
<-ctx.Done()
59
-
}
60
-
```
61
-
62
17
## Best Practices
63
18
64
19
1.**Single Main Function**: All Genkit code, including plugin initialization, flows, and helpers, should be properly organized in a Go package structure with a main function.
@@ -216,23 +171,24 @@ func main() {
216
171
217
172
## Running and Inspecting Flows
218
173
219
-
1. **Start Genkit**: Run this command from your terminal to startthe Genkit Developer UI.
174
+
**Start Genkit**: Genkit can be started locally by using the `genkit start` command, along with the process startup command:
220
175
221
-
```bash
222
-
genkit start -- <command to run your code>
223
-
```
176
+
```bash
177
+
genkit start --<command to run your code>
178
+
```
224
179
225
-
For Go applications:
180
+
For e.g.:
226
181
227
-
```bash
228
-
# Running a Go application directly
229
-
genkit start -- go run main.go
182
+
```bash
183
+
genkit start -- go run main.go
184
+
```
230
185
231
-
# Running a compiled binary
232
-
genkit start -- ./my-genkit-app
233
-
```
186
+
You can can automate starting genkit using the following steps:
234
187
235
-
The command should output a URL for the Genkit Dev UI. Direct the user to visit this URL to run and inspect their Genkit app.
188
+
1. Identify the command to start the user's project's (e.g., `go run main.go`)
189
+
2. Use the `start_runtime` tool to start the runtime process. This is required for Genkit to discover flows.
190
+
- Example: If the project uses `go run main.go`, call `start_runtime` with `{ command: "go", args: ["run", "main.go"] }`.
191
+
3. After starting the runtime, instruct the user to run `genkit start` in their terminal to launch the Developer UI.
All code should be in a single `src/index.ts` file.
42
-
43
-
```ts
44
-
// src/index.ts
45
-
import { genkit, z } from 'genkit';
46
-
import { googleAI } from '@genkit-ai/google-genai';
47
-
48
-
export const ai = genkit({
49
-
plugins: [googleAI()],
50
-
});
51
-
```
52
-
53
17
## Best Practices
54
18
55
19
1.**Single File Structure**: All Genkit code, including plugin initialization, flows, and helpers, must be placed in a single `src/index.ts` file. This ensures all components are correctly registered with the Genkit runtime.
## 🚀 Genkit MCP Server: Model Context Protocol Integration
2
+
3
+
The **Genkit MCP (Model Context Protocol) Server** bridges your Genkit projects with external AI tools and development environments. It exposes Genkit flows and functionalities via the Model Context Protocol, allowing **LLM agents** and **IDEs** to discover, interact with, and monitor your application.
4
+
5
+
> **Note:** The Genkit MCP server is an experimental feature and may change.
6
+
7
+
---
8
+
9
+
### What It Does
10
+
11
+
The MCP Server enables external tools to:
12
+
13
+
***Discover Flows:** List all available Genkit flows, including their input schemas.
14
+
***Run Flows:** Execute Genkit flows by providing inputs and receiving outputs.
15
+
***Access Traces:** Retrieve and analyze detailed execution traces for performance insights.
16
+
***Look up Documentation:** Access Genkit documentation directly.
17
+
18
+
---
19
+
20
+
### Available MCP Tools
21
+
22
+
The following tools allow MCP-aware environments to interact with the Genkit server:
23
+
24
+
| Tool Name | Description |
25
+
| :--- | :--- |
26
+
|**`get_usage_guide`**| Fetches the Genkit AI framework usage guide (specifiable by language). Intended for AI assistants. |
27
+
|**`lookup_genkit_docs`**| Retrieves Genkit documentation (specifiable by language and files). |
28
+
|**`list_flows`**| Discovers and lists all defined Genkit flows with their input schemas. |
29
+
|**`run_flow`**| Executes a specified Genkit flow, requiring `flowName` and a JSON `input` conforming to the flow's schema. |
30
+
|**`get_trace`**| Retrieves the detailed execution trace for a flow using a `traceId`. |
0 commit comments