Document inline command shorthand
This commit is contained in:
parent
87f273e3a0
commit
c22bea8d04
@ -4,7 +4,7 @@ import type { CliArtifactMetadata } from '../../cli-metadata.js';
|
||||
import { type HttpCommand, loadServerDefinitions, type ServerDefinition, type StdioCommand } from '../../config.js';
|
||||
import type { ServerToolInfo } from '../../runtime.js';
|
||||
import { createRuntime } from '../../runtime.js';
|
||||
import { extractHttpServerTarget, normalizeHttpUrl, normalizeHttpUrlCandidate } from '../http-utils.js';
|
||||
import { extractHttpServerTarget, normalizeHttpUrl } from '../http-utils.js';
|
||||
|
||||
export interface ResolvedServer {
|
||||
definition: ServerDefinition;
|
||||
@ -259,15 +259,6 @@ function toCommandSpec(
|
||||
};
|
||||
return httpCommand;
|
||||
}
|
||||
const normalizedHttp = normalizeHttpUrlCandidate(command);
|
||||
if (normalizedHttp) {
|
||||
const httpCommand: HttpCommand = {
|
||||
kind: 'http',
|
||||
url: new URL(normalizedHttp),
|
||||
...(extra?.headers ? { headers: extra.headers } : {}),
|
||||
};
|
||||
return httpCommand;
|
||||
}
|
||||
const stdio: StdioCommand = {
|
||||
kind: 'stdio',
|
||||
command,
|
||||
|
||||
@ -15,12 +15,11 @@ describe('resolveServerDefinition HTTP selectors', () => {
|
||||
expect(name).toBe('shadcn');
|
||||
});
|
||||
|
||||
it('normalizes raw HTTPS paths without scheme when building inline definitions', async () => {
|
||||
it('treats raw HTTPS paths without scheme as stdio commands in inline definitions', async () => {
|
||||
const inline = JSON.stringify({ name: 'context7-inline', command: 'mcp.context7.com/mcp' });
|
||||
const { definition, name } = await resolveServerDefinition(inline);
|
||||
expect(name).toBe('context7-inline');
|
||||
expect(definition.command.kind).toBe('http');
|
||||
expect((definition.command as { url: URL }).url.protocol).toBe('https:');
|
||||
expect((definition.command as { url: URL }).url.hostname).toBe('mcp.context7.com');
|
||||
expect(definition.command.kind).toBe('stdio');
|
||||
expect((definition.command as { command: string }).command).toBe('mcp.context7.com/mcp');
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user