mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-06-25 03:16:28 +02:00
Run oxfmt across repo, add format script and docs
Add .oxfmtignore to skip generated bindings and wasm-pack output. Add npm format script, update DEVELOPMENT.md for Vite+ toolchain, and format all non-generated files with oxfmt. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,19 +1,19 @@
|
||||
import { StreamableHTTPTransport } from '@hono/mcp';
|
||||
import { serve } from '@hono/node-server';
|
||||
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
||||
import { Hono } from 'hono';
|
||||
import { registerFolderTools } from './tools/folder.js';
|
||||
import { registerHttpRequestTools } from './tools/httpRequest.js';
|
||||
import { registerToastTools } from './tools/toast.js';
|
||||
import { registerWindowTools } from './tools/window.js';
|
||||
import { registerWorkspaceTools } from './tools/workspace.js';
|
||||
import type { McpServerContext } from './types.js';
|
||||
import { StreamableHTTPTransport } from "@hono/mcp";
|
||||
import { serve } from "@hono/node-server";
|
||||
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
||||
import { Hono } from "hono";
|
||||
import { registerFolderTools } from "./tools/folder.js";
|
||||
import { registerHttpRequestTools } from "./tools/httpRequest.js";
|
||||
import { registerToastTools } from "./tools/toast.js";
|
||||
import { registerWindowTools } from "./tools/window.js";
|
||||
import { registerWorkspaceTools } from "./tools/workspace.js";
|
||||
import type { McpServerContext } from "./types.js";
|
||||
|
||||
export function createMcpServer(ctx: McpServerContext, port: number) {
|
||||
console.log('Creating MCP server on port', port);
|
||||
console.log("Creating MCP server on port", port);
|
||||
const mcpServer = new McpServer({
|
||||
name: 'yaak-mcp-server',
|
||||
version: '0.1.0',
|
||||
name: "yaak-mcp-server",
|
||||
version: "0.1.0",
|
||||
});
|
||||
|
||||
// Register all tools
|
||||
@@ -26,14 +26,14 @@ export function createMcpServer(ctx: McpServerContext, port: number) {
|
||||
const app = new Hono();
|
||||
const transport = new StreamableHTTPTransport();
|
||||
|
||||
app.all('/mcp', async (c) => {
|
||||
app.all("/mcp", async (c) => {
|
||||
if (!mcpServer.isConnected()) {
|
||||
// Connect the mcp with the transport
|
||||
await mcpServer.connect(transport);
|
||||
void ctx.yaak.toast.show({
|
||||
message: `MCP Server connected`,
|
||||
icon: 'info',
|
||||
color: 'info',
|
||||
icon: "info",
|
||||
color: "info",
|
||||
timeout: 5000,
|
||||
});
|
||||
}
|
||||
@@ -43,15 +43,15 @@ export function createMcpServer(ctx: McpServerContext, port: number) {
|
||||
const honoServer = serve(
|
||||
{
|
||||
port,
|
||||
hostname: '127.0.0.1',
|
||||
hostname: "127.0.0.1",
|
||||
fetch: app.fetch,
|
||||
},
|
||||
(info) => {
|
||||
console.log('Started MCP server on ', info.address);
|
||||
console.log("Started MCP server on ", info.address);
|
||||
void ctx.yaak.toast.show({
|
||||
message: `MCP Server running on http://127.0.0.1:${info.port}`,
|
||||
icon: 'info',
|
||||
color: 'secondary',
|
||||
icon: "info",
|
||||
color: "secondary",
|
||||
timeout: 10000,
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user