-
Notifications
You must be signed in to change notification settings - Fork 1
Restructure MCP to Mastra convention with public-first surface #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,9 @@ | ||
| #:schema https://developers.openai.com/codex/config-schema.json | ||
|
|
||
| [mcp_servers.fpf_memory] | ||
| command = "node" | ||
| args = ["--import", "tsx", "src/mcp-stdio.ts"] | ||
| command = "bun" | ||
| args = ["src/mastra/stdio.ts"] | ||
| cwd = "." | ||
| enabled_tools = [ | ||
| "ask_fpf", | ||
| "query_fpf_spec", | ||
| "get_fpf_index_status", | ||
| "refresh_fpf_index", | ||
| "read_fpf_doc", | ||
| "trace_fpf_path", | ||
| "inspect_fpf_node", | ||
| "inspect_fpf_anchor", | ||
| "expand_fpf_citations", | ||
| ] | ||
| required = false | ||
| startup_timeout_sec = 15 | ||
| tool_timeout_sec = 60 |
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,16 +2,22 @@ | |
| "name": "fpf-memory", | ||
| "version": "1.0.0", | ||
| "description": "Bun-first local vectorless FPF spec runtime exposed through Mastra MCP surfaces with a Hono server engine.", | ||
| "private": true, | ||
| "private": false, | ||
| "packageManager": "bun@1.3.5", | ||
| "bin": "dist/stdio.js", | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| "files": [ | ||
| "dist", | ||
| "FPF-spec.md" | ||
| ], | ||
|
Comment on lines
6
to
+11
|
||
| "scripts": { | ||
| "dev": "bun --watch src/server.ts", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Useful? React with 👍 / 👎. |
||
| "build": "bun build ./src/cli.ts ./src/mcp-stdio.ts ./src/server.ts --outdir dist --target bun", | ||
| "build": "bun build ./src/cli.ts ./src/server.ts --outdir dist --target bun", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The package is now publishable ( Useful? React with 👍 / 👎. |
||
| "build:mcp": "tsup src/mastra/stdio.ts --format esm,cjs --out-dir dist --no-splitting && node -e \"const fs=require('node:fs');const path='dist/stdio.js';const data=fs.readFileSync(path,'utf8');const shebang='#!/usr/bin/env node';if(!data.startsWith(shebang))fs.writeFileSync(path, shebang + '\\\\n' + data);\" && chmod +x dist/stdio.js", | ||
| "start": "bun src/server.ts", | ||
| "lint": "rslint --type-check src tests scripts/generate-docs.ts *.config.ts", | ||
| "check": "tsc --noEmit", | ||
| "cli": "bun src/cli.ts", | ||
| "mcp": "bun src/mcp-stdio.ts", | ||
| "mcp": "bun src/mastra/stdio.ts", | ||
| "test": "rstest run", | ||
| "docs:generate": "bun scripts/generate-docs.ts", | ||
| "docs:dev": "bun run docs:generate && rspress", | ||
|
|
@@ -41,6 +47,7 @@ | |
| "@types/node": "^25.6.0", | ||
| "bun-types": "^1.3.12", | ||
| "mastra": "^1.5.0", | ||
| "tsup": "^8.5.1", | ||
| "tsx": "^4.21.0", | ||
| "typescript": "^6.0.2" | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,17 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| import { MCPServer } from '@mastra/mcp'; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| import { fpfMcpTools, fpfPublicTools } from '../../mcp/tools.js'; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| export const fpfMemory = new MCPServer({ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| name: 'fpf_memory', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| version: '1.0.0', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| description: 'Local vectorless MCP runtime for FPF-spec.md with full tool surface.', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| tools: fpfMcpTools, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| export const fpfMemoryPublic = new MCPServer({ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| name: 'fpf_memory', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| version: '1.0.0', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| description: 'FPF-spec query runtime with public tool surface (ask, query, status).', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| tools: fpfPublicTools, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+5
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| #!/usr/bin/env node | ||
| import { getRuntimeLogger } from '../logging/runtime-logger.js'; | ||
| import { fpfMemory, fpfMemoryPublic } from './mcp/server.js'; | ||
|
|
||
| const logger = getRuntimeLogger(); | ||
| const server = process.env.FPF_MCP_SURFACE === 'full' ? fpfMemory : fpfMemoryPublic; | ||
|
|
||
| logger.info('MCP stdio server start'); | ||
|
|
||
| function normalizeErrorMessage(error: unknown): string { | ||
| if (error instanceof Error) { | ||
| return error.message; | ||
| } | ||
|
|
||
| if (typeof error === 'string') { | ||
| return error; | ||
| } | ||
|
|
||
| try { | ||
| return JSON.stringify(error); | ||
| } catch { | ||
| return String(error); | ||
| } | ||
| } | ||
|
|
||
| server | ||
| .startStdio() | ||
| .catch(async (error) => { | ||
| logger.error('MCP stdio server failed', { | ||
| error: normalizeErrorMessage(error), | ||
| cause: error instanceof Error ? error.stack ?? error : error, | ||
| }); | ||
| await new Promise<void>((resolve) => setImmediate(resolve)); | ||
| process.exit(1); | ||
| }); |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section says
verify-runtime.shchecks the “direct stdio launcher” usingbun src/mastra/stdio.ts, but the script currently still starts the direct launcher vianode --import tsx src/mcp-stdio.ts. Update either the script or this documentation so they match; otherwise readers will follow a verification path that the script doesn’t actually cover.